You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Matt Raible <mr...@gmail.com> on 2006/02/07 01:40:56 UTC

UserTransaction, JOTM and Tomcat 5.5.x

Howdy all,

I'm trying to get JOTM working on Tomcat 5.5.x.  I'm using 5.5.15 and
I've run into some strange issues.  More than anything, I'm looking
for explanations and (hopefully) some help.

I've updated the following tutorial for Tomcat 5.5.x:

http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html

My update: http://static.raibledesigns.com/downloads/howto-tomcat-jotm.html

I uploaded this update only temporarily - hopefully the patch I
submitted (http://tinyurl.com/9q4vl) will get committed to the JOTM
project. ;-)

Strange things:

1. it's no longer possible to put a <Resource> for UserTransaction in
context.xml.  Why is that?  It works fine in Tomcat 5.0.x.

For 5.5.x, it seems you have to put the UserTransaction resource in
the <GlobalNamingResources> part of server.xml.

    <Resource name="UserTransaction" auth="Container"
        type="javax.transaction.UserTransaction"
        factory="org.objectweb.jotm.UserTransactionFactory"
        jotm.timeout="60"/>

Then you have to link to it from your context.xml:

    <ResourceLink name="UserTransaction" global="UserTransaction"
        type="javax.transaction.UserTransaction"/>

2. For the demo (dbtest.war) listed in this howto to work, it seems
it's essential that factory="org.objectweb.jndi.DataSource" be
specified on the "jdbc/myDB" <Resource>.  However, if you specify that
in context.xml for Tomcat 5.5.x, the DataSource doesn't get
registered.  Removing it gets the DS registered, but rollback doesn't
occur properly in the application.

    <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
        factory="org.objectweb.jndi.DataSourceFactory"
        driverClassName="com.mysql.jdbc.Driver"
        username="mojo" password="jojo"
        url="jdbc:mysql://localhost/javatest"/>

To summarize:

Why can't a UserTransaction resource be in context.xml with Tomcat 5.5.x?
Why can't a factory attribute be specified on a datasource with Tomcat 5.5.x?

Both of these settings work fine on Tomcat 5.0.28.  I'm on OS X with JDK 5.

Of course, if anyone knows of a easier transaction manager to
integrate into Tomcat, I'm all ears. ;0)

Thanks,

Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Ignacio de Córdoba <ic...@skios.es>.
Hi there,
I am trying to follow docs in these messages to implement transaction
support in my stand alone Tomcat 5.5.17, but not to use it with JDBC but
with a remote JBoss server.
I get a "comp not bound" error:

Caused by: javax.naming.NameNotFoundException: comp not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
        at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)

when doing the lookup. I've tried to register the <Transaction> element in
all places in tomcat (conf/context.xml, server.xml, META-INF/context.xml in
my webapp, ...) but can't make it create the java:comp/UserTransaction name
in the initial context.
The code I am using is:
	   return (UserTransaction)new
javax.naming.InitialContext().lookup("java:comp/UserTransaction");

Thanks for any help...

Ignacio
-- 
View this message in context: http://www.nabble.com/UserTransaction%2C-JOTM-and-Tomcat-5.5.x-tf1073172.html#a6244225
Sent from the Tomcat - User forum at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by sxm <sx...@yahoo.com>.
I am able to work with JOTM when I run tomcat stand alone, but when I run it
from maven (embedded), UserTransaction doesn't get bind in the context
resulting in following error. 

javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactor\
y.java:98)
at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:792)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at
flex.data.DataServiceTransaction.doBegin(DataServiceTransaction.java:653)
at
flex.data.DataServiceTransaction.begin(DataServiceTransaction.java:624)
at
flex.data.DataService.serviceTransactedMessage(DataService.java:474)
at flex.data.DataService.serviceMessage(DataService.java:241)
at
flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:548)
at
flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:3\
02)
at
flex.messaging.endpoints.rtmp.AbstractRTMPServer.dispatchMessage(AbstractRTMPSer\
ver.java:682)
at
flex.messaging.endpoints.rtmp.NIORTMPConnection$RTMPReader.run(NIORTMPConnection\
.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask\
(ThreadPoolExecutor.java:643)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(Thr\
eadPoolExecutor.java:668)


Matt Raible-3 wrote:
> 
> Just to follow up on this, the settings below work - but HSQLDB
> doesn't seem to support nested transactions.
> 
> <<< beginning the transaction >>>
> DBTest >> javax.transaction.NotSupportedException: Nested transactions not
> suppo
> rted
>         at org.objectweb.jotm.Current.begin(Current.java:233)
>         at foo.DBTest.init(DBTest.java:30)
>         at org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:54)
> 
> The DBTest class is from the JOTM + Tomcat example at
> http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html.
> 
> Changing to use MySQL solves the problem and everything works great.
> 
> Also, it looks like JOTM (or maybe Carol) has issues with JDK 5.  I
> googled for the following error and it appears to be known about on
> the ObjectWeb mailing lists - but there doesn't seem to be a
> documented solution.
> 
> java.lang.NoSuchMethodError:
> sun.rmi.transport.ObjectTable.getStub(Ljava/rmi/Remote;)Ljava/rmi/server/RemoteStub;
> 
> org.objectweb.carol.rmi.jrmp.server.JUnicastRemoteObject.unexportObject(JUnicastRemoteObject.java:138)
> 
> org.objectweb.carol.rmi.multi.JrmpPRODelegate.unexportObject(JrmpPRODelegate.java:107)
> 
> org.objectweb.carol.rmi.multi.MultiPRODelegate.unexportObject(MultiPRODelegate.java:107)
> 
> javax.rmi.PortableRemoteObject.unexportObject(PortableRemoteObject.java:119)
> 
> org.objectweb.jotm.SubCoordinator.doAfterCompletion(SubCoordinator.java:1584)
> 	org.objectweb.jotm.SubCoordinator.doRollback(SubCoordinator.java:1370)
> 	org.objectweb.jotm.SubCoordinator.rollback(SubCoordinator.java:330)
> 	org.objectweb.jotm.TransactionImpl.rollback(TransactionImpl.java:668)
> 	org.objectweb.jotm.Current.rollback(Current.java:538)
> 	foo.DBTest.init(DBTest.java:50)
> 	org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:54)
> 
> Thanks,
> 
> Matt
> 
> On 2/8/06, Remy Maucherat <re...@gmail.com> wrote:
>> Since you're doing docs, META-INF/context.xml should be simplified to:
>> <Context>
>>
>>     <Resource name="jdbc/myDB" auth="Container"
>> type="javax.sql.DataSource"
>>         factory="org.objectweb.jndi.DataSourceFactory"
>>         driverClassName="org.hsqldb.jdbcDriver"
>>         username="sa" password=""
>>         url="jdbc:hsqldb:."/>
>>
>>     <Transaction factory="org.objectweb.jotm.UserTransactionFactory"
>>         jotm.timeout="60"/>
>>
>> </Context>
>>
>> No servlet class reloading anymore (not useful to many people), and
>> the Transaction element has all the necessary defaults since it's a
>> special resource.
>>
>> --
>> xxxxxxxxxxxxxxxxxxxxxxxxx
>> Rémy Maucherat
>> Developer & Consultant
>> JBoss Group (Europe) SàRL
>> xxxxxxxxxxxxxxxxxxxxxxxxx
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/UserTransaction%2C-JOTM-and-Tomcat-5.5.x-tf1073172.html#a10830695
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Remy Maucherat <re...@gmail.com>.
On 2/11/06, Matt Raible <mr...@gmail.com> wrote:
> Just to follow up on this, the settings below work - but HSQLDB
> doesn't seem to support nested transactions.
>
> <<< beginning the transaction >>>
> DBTest >> javax.transaction.NotSupportedException: Nested transactions not suppo
> rted
>         at org.objectweb.jotm.Current.begin(Current.java:233)
>         at foo.DBTest.init(DBTest.java:30)
>         at org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:54)
>
> The DBTest class is from the JOTM + Tomcat example at
> http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html.
>
> Changing to use MySQL solves the problem and everything works great.

Yes, I noticed hsql had that lack of transaction support, but I
assumed things would work with a regular DB.

I added some documentation for the Transaction element.

--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Derek Hulley <de...@alfresco.org>.
The "java.lang.NoSuchMethodError" goes away if you recompile the carol
library using JDK 1.5.  The JOTM uses the carol stubs, I presume.  Anyway, I
got the hint from this location:
http://jira.ofbiz.org/browse/OFBIZ-737 

I compiled JOTM for good measure as well.  All seemed to work fine after
that.

Regards
--
View this message in context: http://www.nabble.com/UserTransaction%2C-JOTM-and-Tomcat-5.5.x-t1073172.html#a3891129
Sent from the Tomcat - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Matt Raible <mr...@gmail.com>.
Just to follow up on this, the settings below work - but HSQLDB
doesn't seem to support nested transactions.

<<< beginning the transaction >>>
DBTest >> javax.transaction.NotSupportedException: Nested transactions not suppo
rted
        at org.objectweb.jotm.Current.begin(Current.java:233)
        at foo.DBTest.init(DBTest.java:30)
        at org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:54)

The DBTest class is from the JOTM + Tomcat example at
http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html.

Changing to use MySQL solves the problem and everything works great.

Also, it looks like JOTM (or maybe Carol) has issues with JDK 5.  I
googled for the following error and it appears to be known about on
the ObjectWeb mailing lists - but there doesn't seem to be a
documented solution.

java.lang.NoSuchMethodError:
sun.rmi.transport.ObjectTable.getStub(Ljava/rmi/Remote;)Ljava/rmi/server/RemoteStub;
	org.objectweb.carol.rmi.jrmp.server.JUnicastRemoteObject.unexportObject(JUnicastRemoteObject.java:138)
	org.objectweb.carol.rmi.multi.JrmpPRODelegate.unexportObject(JrmpPRODelegate.java:107)
	org.objectweb.carol.rmi.multi.MultiPRODelegate.unexportObject(MultiPRODelegate.java:107)
	javax.rmi.PortableRemoteObject.unexportObject(PortableRemoteObject.java:119)
	org.objectweb.jotm.SubCoordinator.doAfterCompletion(SubCoordinator.java:1584)
	org.objectweb.jotm.SubCoordinator.doRollback(SubCoordinator.java:1370)
	org.objectweb.jotm.SubCoordinator.rollback(SubCoordinator.java:330)
	org.objectweb.jotm.TransactionImpl.rollback(TransactionImpl.java:668)
	org.objectweb.jotm.Current.rollback(Current.java:538)
	foo.DBTest.init(DBTest.java:50)
	org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:54)

Thanks,

Matt

On 2/8/06, Remy Maucherat <re...@gmail.com> wrote:
> Since you're doing docs, META-INF/context.xml should be simplified to:
> <Context>
>
>     <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
>         factory="org.objectweb.jndi.DataSourceFactory"
>         driverClassName="org.hsqldb.jdbcDriver"
>         username="sa" password=""
>         url="jdbc:hsqldb:."/>
>
>     <Transaction factory="org.objectweb.jotm.UserTransactionFactory"
>         jotm.timeout="60"/>
>
> </Context>
>
> No servlet class reloading anymore (not useful to many people), and
> the Transaction element has all the necessary defaults since it's a
> special resource.
>
> --
> xxxxxxxxxxxxxxxxxxxxxxxxx
> Rémy Maucherat
> Developer & Consultant
> JBoss Group (Europe) SàRL
> xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Remy Maucherat <re...@gmail.com>.
Since you're doing docs, META-INF/context.xml should be simplified to:
<Context>

    <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
        factory="org.objectweb.jndi.DataSourceFactory"
        driverClassName="org.hsqldb.jdbcDriver"
        username="sa" password=""
        url="jdbc:hsqldb:."/>

    <Transaction factory="org.objectweb.jotm.UserTransactionFactory"
        jotm.timeout="60"/>

</Context>

No servlet class reloading anymore (not useful to many people), and
the Transaction element has all the necessary defaults since it's a
special resource.

--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Remy Maucherat <re...@gmail.com>.
On 2/8/06, Matt Raible <mr...@gmail.com> wrote:
> > No. It's not useful to anyone (well, almost) either.
>
> Just curious - what do you mean?  Are you saying that no one uses a
> JTA TransactionManager with Tomcat? Is it something you don't
> recommend?  My guess is it's better to use a server like JBoss,
> Geronimo or JOnAS.  Unfortunately, I have clients that aren't
> interested in moving off Tomcat.

I heard of a couple people using that, that's it.

> OK - then I must be missing something.  It's probably so small I can't
> see it. ;-)

Actually, it's an elephant.

> WEB-INF/classes/carol.properties:
>
> # JNDI (Protocol Invocation)
> carol.protocols=jrmp
>
> # do not use CAROL JNDI wrapper
> carol.start.jndi=false
>
> # do not start a name server
> carol.start.ns=false
>
> I'm using the DBTest and test.jsp from the example I pointed to
> earlier.  When I hit test.jsp, I get:
>
> DBTest >> javax.naming.NameNotFoundException
>         at org.objectweb.carol.jndi.enc.java.CompNamingContext.lookupCtx(CompNamingContext.java:689)
>         at org.objectweb.carol.jndi.enc.java.CompNamingContext.lookup(CompNamingContext.java:179)
>         at org.objectweb.carol.jndi.enc.java.JavaURLContext.lookup(JavaURLContext.java:138)
>         at javax.naming.InitialContext.lookup(InitialContext.java:351)
>         at foo.DBTest.init(DBTest.java:23)
>         at org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:52)

It's doing the JNDI lookup in Carol, while it should do it in Tomcat's
JNDI. As I said, for some reason, Carol manages to hijack Tomcat's
JNDI. I simply used the carol.properties from your *own* docs to
disable it:

# JNDI (Protocol Invocation)
carol.protocols=jrmp

# Local RMI Invocation
carol.jvm.rmi.local.call=true

# do not use CAROL JNDI wrapper
carol.start.jndi=false

# do not start a name server
carol.start.ns=false

# Naming Factory
carol.jndi.java.naming.factory.url.pkgs=org.apache.naming

--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Matt Raible <mr...@gmail.com>.
On 2/7/06, Remy Maucherat <re...@gmail.com> wrote:
> On 2/7/06, Matt Raible <mr...@gmail.com> wrote:
> > Thanks Remy - this is good stuff, I didn't know about the
> > <Transaction> element.  Is that new in 5.5.x?  Is it documented
> > anywhere?
>
> No. It's not useful to anyone (well, almost) either.

Just curious - what do you mean?  Are you saying that no one uses a
JTA TransactionManager with Tomcat? Is it something you don't
recommend?  My guess is it's better to use a server like JBoss,
Geronimo or JOnAS.  Unfortunately, I have clients that aren't
interested in moving off Tomcat.

>
> > As far as the JARs location - this shouldn't matter should it?  I can
> > put it in $CATALINA_HOME/common/lib *or* in WEB-INF/lib - right?
>
> No, it does not matter.
>
> > I've tried changing my context, and moving all JARs/properties local
> > to my WAR, but it still doesn't work.  Can you post your WAR for
> > download?  dropload.com works for me if you can't post it somewhere.
>
> I am not doing anything special besides what I wrote. You have all the
> configuration files.

OK - then I must be missing something.  It's probably so small I can't
see it. ;-)

I'm using an exploded dbtest WAR in "webapps" with 5.5.15 and OS X +
JDK 5.  In META-INF/context.xml, I have:

<Context reloadable="true">

    <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
        factory="org.objectweb.jndi.DataSourceFactory"
        driverClassName="org.hsqldb.jdbcDriver"
        username="sa" password="" url="jdbc:hsqldb:."/>

    <Transaction name="UserTransaction" auth="Container"
        type="javax.transaction.UserTransaction"
        factory="org.objectweb.jotm.UserTransactionFactory"
        jotm.timeout="60"/>

</Context>

In WEB-INF/lib I have:

commons-cli-1.0.jar
commons-logging.jar
connector-1_5.jar
howl.jar
hsqldb.jar
jotm_iiop_stubs.jar
jotm_jrmp_stubs.jar
jotm.jar
jta-spec1_0_1.jar
jts1_0.jar
objectweb-datasource.jar
ow_carol.jar
xapool.jar

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
	http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

	<resource-env-ref>
		<description>DB Connection</description>
		<resource-env-ref-name>jdbc/myDB</resource-env-ref-name>
		<resource-env-ref-type>
			javax.sql.DataSource
		</resource-env-ref-type>
	</resource-env-ref>
</web-app>

WEB-INF/classes/carol.properties:

# JNDI (Protocol Invocation)
carol.protocols=jrmp

# do not use CAROL JNDI wrapper
carol.start.jndi=false

# do not start a name server
carol.start.ns=false

I'm using the DBTest and test.jsp from the example I pointed to
earlier.  When I hit test.jsp, I get:

DBTest >> javax.naming.NameNotFoundException
        at org.objectweb.carol.jndi.enc.java.CompNamingContext.lookupCtx(CompNamingContext.java:689)
        at org.objectweb.carol.jndi.enc.java.CompNamingContext.lookup(CompNamingContext.java:179)
        at org.objectweb.carol.jndi.enc.java.JavaURLContext.lookup(JavaURLContext.java:138)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at foo.DBTest.init(DBTest.java:23)
        at org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:52)

Which is this line:

(DataSource)ctx.lookup("java:comp/env/jdbc/myDB");

I've uploaded my dbtest.war to
http://static.raibledesigns.com/downloads/dbtest.war.

Thanks for all your help so far.

Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Remy Maucherat <re...@gmail.com>.
On 2/7/06, Matt Raible <mr...@gmail.com> wrote:
> Thanks Remy - this is good stuff, I didn't know about the
> <Transaction> element.  Is that new in 5.5.x?  Is it documented
> anywhere?

No. It's not useful to anyone (well, almost) either.

> As far as the JARs location - this shouldn't matter should it?  I can
> put it in $CATALINA_HOME/common/lib *or* in WEB-INF/lib - right?

No, it does not matter.

> I've tried changing my context, and moving all JARs/properties local
> to my WAR, but it still doesn't work.  Can you post your WAR for
> download?  dropload.com works for me if you can't post it somewhere.

I am not doing anything special besides what I wrote. You have all the
configuration files.

--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Matt Raible <mr...@gmail.com>.
Thanks Remy - this is good stuff, I didn't know about the
<Transaction> element.  Is that new in 5.5.x?  Is it documented
anywhere?

As far as the JARs location - this shouldn't matter should it?  I can
put it in $CATALINA_HOME/common/lib *or* in WEB-INF/lib - right?

I've tried changing my context, and moving all JARs/properties local
to my WAR, but it still doesn't work.  Can you post your WAR for
download?  dropload.com works for me if you can't post it somewhere.

I'll make sure and submit a patch to JOTM's documentation once I get
this figured out.

Thanks,

Matt

On 2/7/06, Remy Maucherat <re...@gmail.com> wrote:
> On 2/7/06, Remy Maucherat <re...@gmail.com> wrote:
> > For 1), it's simple: Resources are bound in "comp/env", while the
> > UserTransaction should go in "comp". ResourceLink has a special case
> > for UserTransaction, so it works. There's a special Transaction
> > element which would avoid having to do that, but it's not implemented.
> > It wouldn't be hard to add support for it in
> > org.apache.catalina.core.NamingContextListener.
>
> Actually, I checked again and the Transaction element seems to be
> properly implemented, and it should be used since it will bind the UT
> to the right place (unlike the Resource element).
>
> It works very well for me right now.
>
> META-INF/context.xml:
> <Context reloadable="true" crossContext="true">
>
>     <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
>         factory="org.objectweb.jndi.DataSourceFactory"
>         driverClassName="org.hsqldb.jdbcDriver"
>         username="sa" password="" url="jdbc:hsqldb:."/>
>
>     <Transaction name="UserTransaction" auth="Container"
>         type="javax.transaction.UserTransaction"
>         factory="org.objectweb.jotm.UserTransactionFactory"
>         jotm.timeout="60"/>
>
> </Context>
>
> WEB-INF/lib contains all the jotm JARs (and the hsql JAR).
> WEB-INF/classes contains the carol.properties config (the lmi protocol
> didn't work for me, so I switched to jrmp). So it can be packaged as a
> ready to run WAR. I still don't understand how that &%ç!ç& carol
> hijacks the java: ENC in its default configuration, however.
>
> --
> xxxxxxxxxxxxxxxxxxxxxxxxx
> Rémy Maucherat
> Developer & Consultant
> JBoss Group (Europe) SàRL
> xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Remy Maucherat <re...@gmail.com>.
On 2/7/06, Remy Maucherat <re...@gmail.com> wrote:
> For 1), it's simple: Resources are bound in "comp/env", while the
> UserTransaction should go in "comp". ResourceLink has a special case
> for UserTransaction, so it works. There's a special Transaction
> element which would avoid having to do that, but it's not implemented.
> It wouldn't be hard to add support for it in
> org.apache.catalina.core.NamingContextListener.

Actually, I checked again and the Transaction element seems to be
properly implemented, and it should be used since it will bind the UT
to the right place (unlike the Resource element).

It works very well for me right now.

META-INF/context.xml:
<Context reloadable="true" crossContext="true">

    <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
        factory="org.objectweb.jndi.DataSourceFactory"
        driverClassName="org.hsqldb.jdbcDriver"
        username="sa" password="" url="jdbc:hsqldb:."/>

    <Transaction name="UserTransaction" auth="Container"
        type="javax.transaction.UserTransaction"
        factory="org.objectweb.jotm.UserTransactionFactory"
        jotm.timeout="60"/>

</Context>

WEB-INF/lib contains all the jotm JARs (and the hsql JAR).
WEB-INF/classes contains the carol.properties config (the lmi protocol
didn't work for me, so I switched to jrmp). So it can be packaged as a
ready to run WAR. I still don't understand how that &%ç!ç& carol
hijacks the java: ENC in its default configuration, however.

--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UserTransaction, JOTM and Tomcat 5.5.x

Posted by Remy Maucherat <re...@gmail.com>.
On 2/7/06, Matt Raible <mr...@gmail.com> wrote:
> Howdy all,
>
> I'm trying to get JOTM working on Tomcat 5.5.x.  I'm using 5.5.15 and
> I've run into some strange issues.  More than anything, I'm looking
> for explanations and (hopefully) some help.
>
> I've updated the following tutorial for Tomcat 5.5.x:
>
> http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html
>
> My update: http://static.raibledesigns.com/downloads/howto-tomcat-jotm.html

> To summarize:
>
> Why can't a UserTransaction resource be in context.xml with Tomcat 5.5.x?
> Why can't a factory attribute be specified on a datasource with Tomcat 5.5.x?
>
> Both of these settings work fine on Tomcat 5.0.28.  I'm on OS X with JDK 5.
>
> Of course, if anyone knows of a easier transaction manager to
> integrate into Tomcat, I'm all ears. ;0)

The main thing I don't understand is how that jndi implementation
manages to take over the enc without any configuration. IMO, since
it's there and you have to disable it explicitely anyway with special
config, the best thing (assuming it works) is to configure their JNDI
rather than using Tomcat's JNDI.

For 1), it's simple: Resources are bound in "comp/env", while the
UserTransaction should go in "comp". ResourceLink has a special case
for UserTransaction, so it works. There's a special Transaction
element which would avoid having to do that, but it's not implemented.
It wouldn't be hard to add support for it in
org.apache.catalina.core.NamingContextListener.

For 2), it seems to work for me in all cases (the factory attribute is
never ignored, although classloading may fail).

This is unrelated, but your context.xml is wrong, and should not
include "path="/dbtest" docBase="dbtest.war" debug="0"".

--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org