Quantcast

transaction manager cannot load in Tomcat 6

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

transaction manager cannot load in Tomcat 6

tmo256
I've been trying to use Tomcat 6 (with Java 6) on FC6, but I cannot seem
to get the third-party transaction manager integrated as in previous
versions. I have configured everything just as in Tomcat 5.5, but there
seems to be a change in the classloading structure, which simply
prevents the classes from loading.
 
Originally, I had the all the necessary Objectweb (JOTM is my
transaction manager) in a directory outside of the CATALINA_BASE but had
appended them to the beginning of the classpath in setclasspath.sh,
which is how it currently works. With the failure to initialize, I moved
all needed jars into CATALINA_BASE/bin, after first trying
CATALINA_BASE/lib. My suspicion is that there's a class that is needed
by the Objectweb DataSourceFactory that was previously included but is
no longer found, due to a change in the classloading architecture; but,
that's almost purely theoretical.
 
This is the error from catalina.out:
 
WARNING: Failed to register in JMX: javax.naming.NamingException: Could
not create resource factory instance [Root exception is
java.lang.NoClassDefFoundError: Could not initialize class
org.objectweb.jndi.DataSourceFactory]
 
This is what's configured as a global resource in server.xml:
<Resource name="AdminCop"
                    min="1"
                    max="1"
                    auth="Container"
                    type="javax.sql.DataSource"
                    factory="org.objectweb.jndi.DataSourceFactory"
                   driverClassName="oracle.jdbc.driver.OracleDriver"
                    username="xxx"
                    password="xxx"
                    url="jdbc:oracle:thin:@localhost:xxxx:XXX" />
 
I have, of course, read the appropriate JNDI How-To, but, as I say, I
have configured all resources, properties, paths, etc, exactly the same
as in Tomcat 5.5 with no luck. Any help would be greatly appreciated.
 
Thanks!
 
-- Teresa
 

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

Re: transaction manager cannot load in Tomcat 6

Rashmi Rubdi-2
On 5/17/07, Molina, Teresa <[hidden email]> wrote:

> I've been trying to use Tomcat 6 (with Java 6) on FC6, but I cannot seem
> to get the third-party transaction manager integrated as in previous
> versions. I have configured everything just as in Tomcat 5.5, but there
> seems to be a change in the classloading structure, which simply
> prevents the classes from loading.
>
> Originally, I had the all the necessary Objectweb (JOTM is my
> transaction manager) in a directory outside of the CATALINA_BASE but had
> appended them to the beginning of the classpath in setclasspath.sh,
> which is how it currently works. With the failure to initialize, I moved
> all needed jars into CATALINA_BASE/bin, after first trying
> CATALINA_BASE/lib.

I don't know anything about Objectweb or JOTM transaction manager, but
just trying to point a few corrections with the configuration.

I think you should keep the JAR files in the lib folder and not the bin folder.

I did configure MySQL JDBC Datasource (for connection pooling)
successfully, so I have some basic idea about it how it is supposed to
be configured for Oracle and MySQL.

>My suspicion is that there's a class that is needed
> by the Objectweb DataSourceFactory that was previously included but is
> no longer found, due to a change in the classloading architecture; but,
> that's almost purely theoretical.
>
> This is the error from catalina.out:
>
> WARNING: Failed to register in JMX: javax.naming.NamingException: Could
> not create resource factory instance [Root exception is
> java.lang.NoClassDefFoundError: Could not initialize class
> org.objectweb.jndi.DataSourceFactory]

I would try to connect directly without using JNDI first, to make sure
a direct connection works.

> This is what's configured as a global resource in server.xml:
> <Resource name="AdminCop"
>                     min="1"
>                     max="1"
>                     auth="Container"
>                     type="javax.sql.DataSource"
>                     factory="org.objectweb.jndi.DataSourceFactory"
>                    driverClassName="oracle.jdbc.driver.OracleDriver"
>                     username="xxx"
>                     password="xxx"
>                     url="jdbc:oracle:thin:@localhost:xxxx:XXX" />


Where have you placed the above <Resource /> tag ?

It should be placed either inside your applications <Context node
(please note that it is possible that your Context node could be
defined outside server.xml, in that case you would place it where ever
the Context node is defined --- may be in server.xml or may be
outside)

 , or in <GlobalNamingResources node.

I'm not sure if you can use min and max attributes above. I couldn't
find any attributes with those names here:
http://jakarta.apache.org/commons/dbcp/configuration.html

> I have, of course, read the appropriate JNDI How-To, but, as I say, I
> have configured all resources, properties, paths, etc, exactly the same
> as in Tomcat 5.5 with no luck. Any help would be greatly appreciated.
>
> Thanks!
>
> -- Teresa
>

Regards
Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

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

Re: transaction manager cannot load in Tomcat 6

Rashmi Rubdi-2
On 5/19/07, Rashmi Rubdi <[hidden email]> wrote:

> > This is what's configured as a global resource in server.xml:
> > <Resource name="AdminCop"
> >                     min="1"
> >                     max="1"
> >                     auth="Container"
> >                     type="javax.sql.DataSource"
> >                     factory="org.objectweb.jndi.DataSourceFactory"
> >                    driverClassName="oracle.jdbc.driver.OracleDriver"
> >                     username="xxx"
> >                     password="xxx"
> >                     url="jdbc:oracle:thin:@localhost:xxxx:XXX" />
>

In addition to the configuration checks I've mentioned in my previous
post, also check that you've configured the web.xml correctly.

Here's my configuration for reference, it works with Tomcat 6.0.10 and
Oracle 10g

-------------------------------------------------------------------
web.xml
-------------------------------------------------------------------
<resource-ref>
 <description>Oracle Datasource example</description>
 <res-ref-name>jdbc/myoracle</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>

-------------------------------------------------------------------
<Context> xml  or server.xml <Context tag
-------------------------------------------------------------------

<Context path="" docBase="......." reloadable="true" debug="true">

                <Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource"
                        maxActive="20" maxIdle="10"  maxWait="-1"
                        username="xxxxx" password="xxxxx" driverClassName="oracle.jdbc.OracleDriver"
                        url="jdbc:oracle:thin:@Venus:1521:XE"/>

</Context>

----------------------------------------------------------------------
Place ojdbc14_g.jar under
....\apache-tomcat-6.0.10\lib\  folder

-Regards
Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

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

Re: transaction manager cannot load in Tomcat 6

tmo256
Hi: Thanks for trying to help out. Let me clarify a couple of points.

The main thing is that my problem is very specifically with the transaction manager factory; I have successfully set up other dhcp connection pools (non-transactional).

>>With the failure to initialize, I moved
>>all needed jars into CATALINA_BASE/bin, after first trying
>> CATALINA_BASE/lib.
...
>I think you should keep the JAR files in the lib folder and not the bin folder.

As originally stated, I've tried placing the putting the jars in that folder, with no difference.

>>I have configured everything just as in Tomcat 5.5, but there
>> seems to be a change in the classloading structure
...
>I would try to connect directly without using JNDI first, to make sure
>a direct connection works.

Because these connections are configured in 5.5 exactly as here (in 6), I know the connection is correct.

>>This is what's configured as a global resource in server.xml
...
>Where have you placed the above <Resource /> tag ?

As stated, I the tag is a global resource and the resourceLink referecing it is in the default context.xml context.

>In addition to the configuration checks I've mentioned in my previous
>post, also check that you've configured the web.xml correctly.

Considering that the main error I've listed is a ClassNotFoundDef, I question whether my web.xml configuration could change that, though I will certainly give it a try. Actually: the rest of my Oracle connections work without any references in web.xml; my understanding from the documentation was this was optional. You need either the web.xml reference OR a context reference.

Thanks so much for trying to help, though. Any further suggestions would be welcome.

Thanks,
Teresa

I've been trying to use Tomcat 6 (with Java 6) on FC6, but I cannot seem
to get the third-party transaction manager integrated as in previous
versions. I have configured everything just as in Tomcat 5.5, but there
seems to be a change in the classloading structure, which simply
prevents the classes from loading.
 
Originally, I had the all the necessary Objectweb (JOTM is my
transaction manager) in a directory outside of the CATALINA_BASE but had
appended them to the beginning of the classpath in setclasspath.sh,
which is how it currently works. With the failure to initialize, I moved
all needed jars into CATALINA_BASE/bin, after first trying
CATALINA_BASE/lib. My suspicion is that there's a class that is needed
by the Objectweb DataSourceFactory that was previously included but is
no longer found, due to a change in the classloading architecture; but,
that's almost purely theoretical.
 
This is the error from catalina.out:
 
WARNING: Failed to register in JMX: javax.naming.NamingException: Could
not create resource factory instance [Root exception is
java.lang.NoClassDefFoundError: Could not initialize class
org.objectweb.jndi.DataSourceFactory]
 
This is what's configured as a global resource in server.xml:
<Resource name="AdminCop"
                    min="1"
                    max="1"
                    auth="Container"
                    type="javax.sql.DataSource"
                    factory="org.objectweb.jndi.DataSourceFactory"
                   driverClassName="oracle.jdbc.driver.OracleDriver"
                    username="xxx"
                    password="xxx"
                    url="jdbc:oracle:thin:@localhost:xxxx:XXX" />
 
I have, of course, read the appropriate JNDI How-To, but, as I say, I
have configured all resources, properties, paths, etc, exactly the same
as in Tomcat 5.5 with no luck. Any help would be greatly appreciated.
 
Thanks!
 
-- Teresa
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: transaction manager cannot load in Tomcat 6

Rashmi Rubdi-2
On 5/21/07, tmo256 <[hidden email]> wrote:

> Thanks so much for trying to help, though. Any further suggestions would be
> welcome.

Sorry I couldn't be of help here, the only other thing I can think of
is that the CLASSPATH may be partially correct or incorrect.

It is better to not set the systemwide classpath. It is sufficient to
set the JAVA_HOME and CATALINA_BASE or CATALINA_HOME in the system
environment variables, then Tomcat detects the other JAR files.

I don't know if you already consulted this list:
http://www.objectweb.org/wws/lists/projects/jotm , I'm just posting
the link in case you didn't.

> Thanks,
> Teresa

-Regards
Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

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

Re: transaction manager cannot load in Tomcat 6

mwaltz
In reply to this post by tmo256

tmo256 wrote
The main thing is that my problem is very specifically with the transaction manager factory
I'm in *exactly* the same situation, with exactly the same environment (Tomcat 6, JDK1.6, FC 6).  We're also getting the ClassNotFound exception on org.objectweb.jndi.DataSourceFactory.  We've got all of our jars in the right places, per:
http://static.raibledesigns.com/downloads/howto-tomcat-jotm.html

We also rebuilt carol and jotm under jdk1.6 to get rid of a different issue.  If you'd like, I can send you our recipe for doing our builds.

To make sure it isn't a classpath issue, we instantiated other classes in other jars in common/lib in our test.jsp with success.  However, when we specifically try to instantiate org.objectweb.jndi.DataSourceFactory, we get the class not found exception.

The source for that class is included in the jar, and we're just now beginning to collect all the bits that this class is dependent upon.  We're going to try to rebuild the whole deal.

If we find out anything -- we'll post back here.  Good luck;  transactional db activity in a most ubiquitous java-based webserver shouldn't be this tough. :)

Regards,
Mark

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

Re: transaction manager cannot load in Tomcat 6

tmo256
Matt:
I got it working, and I think I figured this out. What I believe happens is that the ClassNotFound Exception is a little misleading: the JOTM classes ARE found, but the CommonsLogging class needed by the JOTM factory is NOT. I believe we had a different version of the necessary jar in the classpath, and ultimately just needed to make sure the commons-logging.jar was "highest" in the classpath.

FYI, I did need to recompile using Java 1.6 the Carol jars (ow_carol.jar) used by JOTM in order to avoid the RMI method exception (noted by several on the JOTM list).

mwaltz wrote
tmo256 wrote
The main thing is that my problem is very specifically with the transaction manager factory
I'm in *exactly* the same situation, with exactly the same environment (Tomcat 6, JDK1.6, FC 6).  We're also getting the ClassNotFound exception on org.objectweb.jndi.DataSourceFactory.  We've got all of our jars in the right places, per:
http://static.raibledesigns.com/downloads/howto-tomcat-jotm.html

We also rebuilt carol and jotm under jdk1.6 to get rid of a different issue.  If you'd like, I can send you our recipe for doing our builds.

To make sure it isn't a classpath issue, we instantiated other classes in other jars in common/lib in our test.jsp with success.  However, when we specifically try to instantiate org.objectweb.jndi.DataSourceFactory, we get the class not found exception.

The source for that class is included in the jar, and we're just now beginning to collect all the bits that this class is dependent upon.  We're going to try to rebuild the whole deal.

If we find out anything -- we'll post back here.  Good luck;  transactional db activity in a most ubiquitous java-based webserver shouldn't be this tough. :)

Regards,
Mark
Loading...