Thanks Rakesh,
You are right about jboss having issues with "java:comp/env" prefix
while accessing the jndi resource.
After resolving that I get a different exception:
Caused by: java.lang.ClassCastException:
org.jboss.resource.adapter.jdbc.WrapperDataSource cannot be cast to
javax.jcr.Repository
This is how I have configured the datasource in my property file from
where the resource is being read:
<local-tx-datasource>
<jndi-name>PsEdiObjectStoreDS</jndi-name>
<connection-url>jdbc:jtds:sqlserver://dev4sql1.qhg.local:1433/ObjStore</
connection-url>
<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
<user-name>qhg_obs_user</user-name>
<password>obs_user_pass</password>
</local-tx-datasource>
Please provide any inputs if you can think of something.
Thanks again
Anit
-----Original Message-----
From: Rakesh Vidyadharan [mailto:[email protected]]
Sent: Wednesday, November 11, 2009 6:52 PM
To: [email protected]
Subject: Re: JNDI datasource config help
Maybe you need to make the jcr-api jar files (or just use the jackrabbit
standalone all inclusive jar) available more globally to JBoss.
Also, if memory serves me right, JBoss does not like "java:comp/env"
prefix when accessing resources.
On 11 Nov 2009, at 7:21:36 PM, Phukan, Anit wrote:
> Hi,
>
> I am having some issues deploying my WAR on jboss server after I
change
> my repository.xml to include the JNDI lookup for the DB URL and
Driver.
>
> Following are the changes that I have done to change from a direct
> JDBC.JTDS reference to a JNDI based lookup:
>
> Repository.xml:
> ---------------
> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
> <param name="driver"
> value="javax.naming.InitialContext" />
> <param name="url"
> value="java:comp/env/jdbc/DSName"/>
> <param name="schemaObjectPrefix"
> value="J_FS_${wsp.name}_" />
> </FileSystem>
>
> <PersistenceManager
>
> class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager>
> <param name="driver"
> value="javax.naming.InitialContext"/>
> <param name="url" value="java:comp/env/jdbc/ DSName " />
> <param name="schema" value="mssql" />
> <param name="schemaObjectPrefix" value="J_V_PM_" />
> <param name="externalBLOBs" value="false" />
> </PersistenceManager>
>
> Jackrabbit Impl java class from where I am starting up the repository:
> ----------------------------------------------------------------------
>
> InitialContext ctx = new InitialContext() ;
> Repository repository = (Repository) ctx.lookup("java:comp/env/jdbc/
> DSName") ;
>
> session = repository.login(new
> SimpleCredentials("username","password".toCharArray()));
>
>
> jtds-ds.xml properties file which is placed at the
> JBOSS_HOME/server/default/deploy folder:
> ----------------------------------------
>
> <local-tx-datasource>
> <jndi-name>comp/env/jdbc/DSName</jndi-name>
>
>
<connection-url>jdbc:jtds:sqlserver://xxxxxx.xxx.xxxxx:1433/DBName</conn
> ection-url>
> <rar-name>jackrabbit-jca-1.6.0.rar</rar-name>
> <connection-definition>javax.jcr.Repository</connection-definition>
> <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
> <user-name>xxxxx</user-name>
> <password>xxxxxx</password>
> <config-property name="homeDir"
>
type="java.lang.String">${JBOSS_HOME}/temp/jackrabbit</config-property>
>
> <config-property name="configFile"
>
type="java.lang.String">${JBOSS_HOME}/bin/repository.xml</config-propert
> y>
> <config-property name="bindSessionToTransaction"
> type="java.lang.Boolean">true</config-property>
> </local-tx-datasource>
>
>
> This is the stack trace of the exception that I get while starting up
> the server:
>
> java.lang.NoClassDefFoundError: javax/jcr/RepositoryException
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at
> java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> at java.lang.Class.getConstructor0(Class.java:2699)
> at java.lang.Class.newInstance0(Class.java:326)
> at java.lang.Class.newInstance(Class.java:308)
> at
>
org.jboss.resource.connectionmanager.ManagedConnectionFactoryDeployment.
> startService(ManagedConnectionFactoryDeployment.java:354)
> at
>
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupp
> ort.java:376)
> at
>
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBean
> Support.java:322)
> at
>
org.jboss.system.ServiceDynamicMBeanSupport.invoke(ServiceDynamicMBeanSu
> pport.java:124)
> at
>
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
> at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
> at
>
org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:18
> 9)
> at $Proxy38.start(Unknown Source)
>
> DEPLOYMENTS IN ERROR:
> Deployment
> "vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/jtds-ds.xml" is in
> error due to the following reason(s):
java.lang.ClassNotFoundException:
> javax.jcr.RepositoryException from baseclassloa...@24ad8
>
>
> I am not sure if I am missing some jndi related parameter setting
> somewhere, and why the class loader is unable to load the
> RepositoryException class even though all related jars are present.
>
> Any advice/help would be appreciated.
>
> Thanks
> Anit
>
>
>
> -----Original Message-----
> From: Alexander Klimetschek [mailto:[email protected]]
> Sent: Wednesday, November 11, 2009 2:12 AM
> To: [email protected]
> Subject: Re: 1.0 or 2.0
>
> On Wed, Nov 11, 2009 at 01:03, Phukan, Anit <[email protected]>
> wrote:
>> Has anyone configured the repository.xml to use JNDI look up for
> making DB connections instead of directly specifying DB URLs with
> userid/password in the repository.xml?
>
> See http://wiki.apache.org/jackrabbit/UsingJNDIDataSource
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> [email protected]
Rakesh Vidyadharan
President & CEO
Sans Pareil Technologies, Inc.
http://sptci.com/
| 100 W. Chestnut, Suite 1305 | Chicago, IL 60610-3296 USA |
| Ph: +1 (312) 212 3933 | Mobile: +1 (312) 315-1596 (US), +91 949 611
0873 (IN) | Fax: +1 (312) 276-4410 | E-mail: [email protected]