Classloader issue in Tomcat 7 installation

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Classloader issue in Tomcat 7 installation

DaveWeb
Trying to perform an installation of the Txn Manager into Tomcat 7.0.30 following the instructions listed both on this site and in JBoss' jBPM installation to Tomcat 7 wiki here:

https://community.jboss.org/wiki/JBPM53Tomcat7H2Demo

Restarting Tomcat with the LifecycleListener installed always throws a ClassNotFoundException below:

INFO: reading resources configuration from H:/software/apache-tomcat-7.0.33/conf/resources.properties
bitronix.tm.utils.InitializationException: initialization failed, cannot safely start the transaction manager
        at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:102)
        at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:75)
        at bitronix.tm.integration.tomcat55.BTMLifecycleListener.lifecycleEvent(BTMLifecycleListener.java:18)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451)
Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot configure resource for configuration entries with name [ds1]
- failing property is [className]
        at bitronix.tm.resource.ResourceLoader.buildXAResourceProducer(ResourceLoader.java:254)
        at bitronix.tm.resource.ResourceLoader.initXAResourceProducers(ResourceLoader.java:170)
        at bitronix.tm.resource.ResourceLoader.init(ResourceLoader.java:152)
        at bitronix.tm.resource.ResourceLoader.init(ResourceLoader.java:84)
        at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:86)
        ... 13 more
Caused by: java.lang.ClassNotFoundException: bitronix.tm.resource.jdbc.lrc.LrcXADataSource
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at bitronix.tm.utils.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:63)
        at bitronix.tm.resource.ResourceLoader.instantiate(ResourceLoader.java:119)
        at bitronix.tm.resource.ResourceLoader.createBean(ResourceLoader.java:271)
        at bitronix.tm.resource.ResourceLoader.buildXAResourceProducer(ResourceLoader.java:239)





This is a freshly downloaded Tomcat without any other customizations running JDK1.6u29, 64bit Windows, following the instructions precisely.  I've tried several different versions of Tomcat with the same result.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Classloader issue in Tomcat 7 installation

Mathrusse, Chris (SFO-CAD)
Did you add your JDBC driver to the class path? Specifically, the <catalina home>/lib directory?

Look at the stack trace. It seems obvious that BTM cannot locate the driver for ds1.

Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
configure resource for configuration entries with name [ds1]

- failing property is [className]

On Nov 27, 2012, at 8:52 AM, DaveWeb <[hidden email]> wrote:

Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
configure resource for configuration entries with name [ds1]
- failing property is [className]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Classloader issue in Tomcat 7 installation

Ludovic Orban-2
The LrcXADataSource is part of the btm jar so either you're using a corrupt jar file, or you mis-typed it. Maybe there's a heading or trailing whitespace character lying somewhere?

On Tue, Nov 27, 2012 at 6:22 PM, Mathrusse, Chris (SFO-CAD) <[hidden email]> wrote:
Did you add your JDBC driver to the class path? Specifically, the <catalina home>/lib directory?

Look at the stack trace. It seems obvious that BTM cannot locate the driver for ds1.

Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
configure resource for configuration entries with name [ds1]

- failing property is [className]

On Nov 27, 2012, at 8:52 AM, DaveWeb <[hidden email]> wrote:

Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
configure resource for configuration entries with name [ds1]
- failing property is [className]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Classloader issue in Tomcat 7 installation

DaveWeb
resource properties:

resource.ds1.className=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
resource.ds1.uniqueName=jdbc/testDS1
resource.ds1.minPoolSize=0
resource.ds1.maxPoolSize=5
resource.ds1.driverProperties.driverClassName=org.h2.Driver
resource.ds1.driverProperties.url=jdbc:h2:tcp://localhost/~/test
resource.ds1.driverProperties.user=sa
resource.ds1.driverProperties.password=
resource.ds1.allowLocalTransactions=true
resource.ds1.testQuery=SELECT 1+1

The JDBC driver (and H2 in-memory database for dev purposes) and the btm-2.1.3.jar are all on ${CATALINA_HOME}/lib.

The error is referring to the className property, i.e. the LrcXADataSource.  Have checked all spelling, jars are valid, came right on this project's site.  Have both the DriverClassName jar and the btm jar on the classpath
There are no applications deployed to this Tomcat instance, as well, simply a pristine, Tomcat image with the BTM stuff installed out of the guide.....

This is why I'm not understanding why I have a class loading issue....all the pieces-parts seem to be where they need to be.

Ludovic Orban-2 wrote
The LrcXADataSource is part of the btm jar so either you're using a corrupt
jar file, or you mis-typed it. Maybe there's a heading or trailing
whitespace character lying somewhere?

On Tue, Nov 27, 2012 at 6:22 PM, Mathrusse, Chris (SFO-CAD) <
Chris.Mathrusse@map-global.com> wrote:

> Did you add your JDBC driver to the class path? Specifically, the
> <catalina home>/lib directory?
>
> Look at the stack trace. It seems obvious that BTM cannot locate the
> driver for ds1.
>
> *Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
> configure resource for configuration entries with name [ds1]
> - failing property is [className]
> *
>
> On Nov 27, 2012, at 8:52 AM, DaveWeb <zoomiene1980@yahoo.com> wrote:
>
> Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
> configure resource for configuration entries with name [ds1]
> - failing property is [className]
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Classloader issue in Tomcat 7 installation

Mathrusse, Chris (SFO-CAD)
The resource.ds1.className should be the JDBC driver class name. For example, in my datasource.properties file I have the following:

resource.tt.className=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
resource.tt.uniqueName=jdbc/myDataSource
resource.tt.minPoolSize=10
resource.tt.maxPoolSize=50
resource.tt.driverProperties.databaseName=myDatabase
resource.tt.testQuery=SELECT COUNT(1) FROM INFORMATION_SCHEMA.TABLES
resource.tt.driverProperties.user=myUser
resource.tt.driverProperties.password=myPassword
resource.tt.driverProperties.URL=jdbc:mysql://localhost:3306/myDatabase
resource.tt.driverProperties.useTimezone=true
resource.tt.driverProperties.serverTimezone=UTC
resource.tt.allowLocalTransactions=true

On Nov 27, 2012, at 11:57 AM, DaveWeb <[hidden email]> wrote:

>
> resource properties:
>
> resource.ds1.className=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
> resource.ds1.uniqueName=jdbc/testDS1
> resource.ds1.minPoolSize=0
> resource.ds1.maxPoolSize=5
> resource.ds1.driverProperties.driverClassName=org.h2.Driver
> resource.ds1.driverProperties.url=jdbc:h2:tcp://localhost/~/test
> resource.ds1.driverProperties.user=sa
> resource.ds1.driverProperties.password=
> resource.ds1.allowLocalTransactions=true
> resource.ds1.testQuery=SELECT 1+1
>
> The JDBC driver (and H2 in-memory database for dev purposes) and the
> btm-2.1.3.jar are all on ${CATALINA_HOME}/lib.
>
> The error is referring to the className property, i.e. the LrcXADataSource.
> Have checked all spelling, jars are valid, came right on this project's
> site.  Have both the DriverClassName jar and the btm jar on the classpath
> There are no applications deployed to this Tomcat instance, as well, simply
> a pristine, Tomcat image with the BTM stuff installed out of the guide.....
>
> This is why I'm not understanding why I have a class loading issue....all
> the pieces-parts seem to be where they need to be.
>
>
> Ludovic Orban-2 wrote:
>>
>> The LrcXADataSource is part of the btm jar so either you're using a
>> corrupt
>> jar file, or you mis-typed it. Maybe there's a heading or trailing
>> whitespace character lying somewhere?
>>
>> On Tue, Nov 27, 2012 at 6:22 PM, Mathrusse, Chris (SFO-CAD) <
>> [hidden email]> wrote:
>>
>>> Did you add your JDBC driver to the class path? Specifically, the
>>> <catalina home>/lib directory?
>>>
>>> Look at the stack trace. It seems obvious that BTM cannot locate the
>>> driver for ds1.
>>>
>>> *Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
>>> configure resource for configuration entries with name [ds1]
>>> - failing property is [className]
>>> *
>>>
>>> On Nov 27, 2012, at 8:52 AM, DaveWeb <[hidden email]> wrote:
>>>
>>> Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
>>> configure resource for configuration entries with name [ds1]
>>> - failing property is [className]
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Classloader-issue-in-Tomcat-7-installation-tp34728478p34729286.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Classloader issue in Tomcat 7 installation

DaveWeb
Only if your database provides an XA Driver.  H2 does not.  Right out of BTM's own Tomcat doc in Step 3:

http://docs.codehaus.org/display/BTM/Tomcat

If your database vendor does not provide an XADataSource, you can use BTM's bitronix.tm.resource.jdbc.lrc.LrcXADataSource as the XADataSource to allow your database connections to be controlled by the transaction manager:
resource.ds2.className=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
resource.ds2.uniqueName=jdbc/exampleNonXADS
resource.ds2.minPoolSize=0
resource.ds2.maxPoolSize=5
resource.ds2.driverProperties.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
resource.ds2.driverProperties.url=jdbc:derby:../work/db2;create=true

I tried Derby intead of H2, with the same exact stack trace above.....


I would suggest, anyone really interested in figuring this one out, go download Tomcat 7.0.33 and then follow the doc in the link above.  It won't work and will generate the above stack trace.

Maybe something has changed in the LifecycleListener implimentation of TC in later releases?






Mathrusse, Chris (SFO-CAD) wrote
The resource.ds1.className should be the JDBC driver class name. For example, in my datasource.properties file I have the following:

resource.tt.className=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
resource.tt.uniqueName=jdbc/myDataSource
resource.tt.minPoolSize=10
resource.tt.maxPoolSize=50
resource.tt.driverProperties.databaseName=myDatabase
resource.tt.testQuery=SELECT COUNT(1) FROM INFORMATION_SCHEMA.TABLES
resource.tt.driverProperties.user=myUser
resource.tt.driverProperties.password=myPassword
resource.tt.driverProperties.URL=jdbc:mysql://localhost:3306/myDatabase
resource.tt.driverProperties.useTimezone=true
resource.tt.driverProperties.serverTimezone=UTC
resource.tt.allowLocalTransactions=true

On Nov 27, 2012, at 11:57 AM, DaveWeb <zoomiene1980@yahoo.com> wrote:

>
> resource properties:
>
> resource.ds1.className=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
> resource.ds1.uniqueName=jdbc/testDS1
> resource.ds1.minPoolSize=0
> resource.ds1.maxPoolSize=5
> resource.ds1.driverProperties.driverClassName=org.h2.Driver
> resource.ds1.driverProperties.url=jdbc:h2:tcp://localhost/~/test
> resource.ds1.driverProperties.user=sa
> resource.ds1.driverProperties.password=
> resource.ds1.allowLocalTransactions=true
> resource.ds1.testQuery=SELECT 1+1
>
> The JDBC driver (and H2 in-memory database for dev purposes) and the
> btm-2.1.3.jar are all on ${CATALINA_HOME}/lib.
>
> The error is referring to the className property, i.e. the LrcXADataSource.
> Have checked all spelling, jars are valid, came right on this project's
> site.  Have both the DriverClassName jar and the btm jar on the classpath
> There are no applications deployed to this Tomcat instance, as well, simply
> a pristine, Tomcat image with the BTM stuff installed out of the guide.....
>
> This is why I'm not understanding why I have a class loading issue....all
> the pieces-parts seem to be where they need to be.
>
>
> Ludovic Orban-2 wrote:
>>
>> The LrcXADataSource is part of the btm jar so either you're using a
>> corrupt
>> jar file, or you mis-typed it. Maybe there's a heading or trailing
>> whitespace character lying somewhere?
>>
>> On Tue, Nov 27, 2012 at 6:22 PM, Mathrusse, Chris (SFO-CAD) <
>> Chris.Mathrusse@map-global.com> wrote:
>>
>>> Did you add your JDBC driver to the class path? Specifically, the
>>> <catalina home>/lib directory?
>>>
>>> Look at the stack trace. It seems obvious that BTM cannot locate the
>>> driver for ds1.
>>>
>>> *Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
>>> configure resource for configuration entries with name [ds1]
>>> - failing property is [className]
>>> *
>>>
>>> On Nov 27, 2012, at 8:52 AM, DaveWeb <zoomiene1980@yahoo.com> wrote:
>>>
>>> Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
>>> configure resource for configuration entries with name [ds1]
>>> - failing property is [className]
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Classloader-issue-in-Tomcat-7-installation-tp34728478p34729286.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Classloader issue in Tomcat 7 installation

DaveWeb
Got working.....

The poster above was actually correct about the properties files having bad "whitespace".  One has to be very careful what Windows editors like WordPad, Notepad, etc... add at the end of line.  There were some invisible cr/lf characters at the end that so up when loaded in vi on linux.  It can be a real problem if cutting and pasting from web site example files.  Removed those, and it works, now....

Sorry for the churn...
 
DaveWeb wrote
Only if your database provides an XA Driver.  H2 does not.  Right out of BTM's own Tomcat doc in Step 3:

http://docs.codehaus.org/display/BTM/Tomcat

If your database vendor does not provide an XADataSource, you can use BTM's bitronix.tm.resource.jdbc.lrc.LrcXADataSource as the XADataSource to allow your database connections to be controlled by the transaction manager:
resource.ds2.className=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
resource.ds2.uniqueName=jdbc/exampleNonXADS
resource.ds2.minPoolSize=0
resource.ds2.maxPoolSize=5
resource.ds2.driverProperties.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
resource.ds2.driverProperties.url=jdbc:derby:../work/db2;create=true

I tried Derby intead of H2, with the same exact stack trace above.....


I would suggest, anyone really interested in figuring this one out, go download Tomcat 7.0.33 and then follow the doc in the link above.  It won't work and will generate the above stack trace.

Maybe something has changed in the LifecycleListener implimentation of TC in later releases?






Mathrusse, Chris (SFO-CAD) wrote
The resource.ds1.className should be the JDBC driver class name. For example, in my datasource.properties file I have the following:

resource.tt.className=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
resource.tt.uniqueName=jdbc/myDataSource
resource.tt.minPoolSize=10
resource.tt.maxPoolSize=50
resource.tt.driverProperties.databaseName=myDatabase
resource.tt.testQuery=SELECT COUNT(1) FROM INFORMATION_SCHEMA.TABLES
resource.tt.driverProperties.user=myUser
resource.tt.driverProperties.password=myPassword
resource.tt.driverProperties.URL=jdbc:mysql://localhost:3306/myDatabase
resource.tt.driverProperties.useTimezone=true
resource.tt.driverProperties.serverTimezone=UTC
resource.tt.allowLocalTransactions=true

On Nov 27, 2012, at 11:57 AM, DaveWeb <zoomiene1980@yahoo.com> wrote:

>
> resource properties:
>
> resource.ds1.className=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
> resource.ds1.uniqueName=jdbc/testDS1
> resource.ds1.minPoolSize=0
> resource.ds1.maxPoolSize=5
> resource.ds1.driverProperties.driverClassName=org.h2.Driver
> resource.ds1.driverProperties.url=jdbc:h2:tcp://localhost/~/test
> resource.ds1.driverProperties.user=sa
> resource.ds1.driverProperties.password=
> resource.ds1.allowLocalTransactions=true
> resource.ds1.testQuery=SELECT 1+1
>
> The JDBC driver (and H2 in-memory database for dev purposes) and the
> btm-2.1.3.jar are all on ${CATALINA_HOME}/lib.
>
> The error is referring to the className property, i.e. the LrcXADataSource.
> Have checked all spelling, jars are valid, came right on this project's
> site.  Have both the DriverClassName jar and the btm jar on the classpath
> There are no applications deployed to this Tomcat instance, as well, simply
> a pristine, Tomcat image with the BTM stuff installed out of the guide.....
>
> This is why I'm not understanding why I have a class loading issue....all
> the pieces-parts seem to be where they need to be.
>
>
> Ludovic Orban-2 wrote:
>>
>> The LrcXADataSource is part of the btm jar so either you're using a
>> corrupt
>> jar file, or you mis-typed it. Maybe there's a heading or trailing
>> whitespace character lying somewhere?
>>
>> On Tue, Nov 27, 2012 at 6:22 PM, Mathrusse, Chris (SFO-CAD) <
>> Chris.Mathrusse@map-global.com> wrote:
>>
>>> Did you add your JDBC driver to the class path? Specifically, the
>>> <catalina home>/lib directory?
>>>
>>> Look at the stack trace. It seems obvious that BTM cannot locate the
>>> driver for ds1.
>>>
>>> *Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
>>> configure resource for configuration entries with name [ds1]
>>> - failing property is [className]
>>> *
>>>
>>> On Nov 27, 2012, at 8:52 AM, DaveWeb <zoomiene1980@yahoo.com> wrote:
>>>
>>> Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot
>>> configure resource for configuration entries with name [ds1]
>>> - failing property is [className]
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Classloader-issue-in-Tomcat-7-installation-tp34728478p34729286.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Loading...