tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Raible <mrai...@gmail.com>
Subject Re: UserTransaction, JOTM and Tomcat 5.5.x
Date Wed, 08 Feb 2006 00:45:22 GMT
On 2/7/06, Remy Maucherat <remy.maucherat@gmail.com> wrote:
> On 2/7/06, Matt Raible <mraible@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


Mime
View raw message