tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remy Maucherat" <>
Subject Re: Tomcat & JNDI
Date Tue, 07 Nov 2000 07:41:26 GMT
> If I recall correctly, it's actually sort of tricky to get this right.
> might want to check the source for the Tomcat 4 implementation for
ideas -- I
> believe it depends on the servlet container calling
> Thread.setContextClassLoader() once you know which webapp you're running
> This only works in a Java2 environment, though.

Almost. I use thread binding instead (which is more or less the same here).
I'll add class loader binding as an alternative to thread binding.

What is supported right now :

Only Tyrex is supported right now as the provider for javax.sql.DataSource
type (so get Tyrex first ( Then put it into the
"lib" directory in the Catalina distribution.

Then add to the web.xml :
      <description>Test DataSource</description>
(that's an exemple, you can give it another name)

Of course, the factory doesn't really know what to do, so it will go to the
defaults, and try to create a memory based data source using hSQL. So to use
the defaults, you also need to get Hypersonic SQL from Sourceforge (and put
the hsql.jar file into "lib").

To set parameters for the data source, use env-entries with special names.
Here's a (self explanatory, IMO) example :

That's it. The lookup on "java:/comp/jdbc/TestDB" should return a usable
data source. A new instance of the data source is instantiated each time you
do the lookup, so I recommend that you bind that data source into the
per-web app writable initial context which is also provided to your servlet.

For transactions support a UserTransaction object is mapped at
"java:/comp/UserTransaction". I didn't test that functionality yet, so it
may not work.

Both resource-env-ref and ejb-ref are unsupported right now (actually, they
are, but there is no factory to instantiate the objects).
Resource references to JMS, JavaMail, .... types are also unsupported.


View raw message