tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: InitialContextFactory
Date Thu, 12 Aug 2004 15:33:48 GMT
Tomcat has its own,  See code at
hare/org/apache/naming/java/ and a level above for the entire naming
package which might be of interest to you.

However, it is expected and supported that users use other
InitialContextFactories to connect to different remote servers via JNDI.
I routinely use the JBoss, OpenJMS, and Weblogic initial context
factories in exactly the manner in your code snippet, without a problem.
The client jar file for the remote server, which contains the initial
context factory implementation, should be in the WEB-INF/lib directory
of your web application.

Yoav Shapira
Millennium Research Informatics

>-----Original Message-----
>From: Sternbergh, Cornell []
>Sent: Thursday, August 12, 2004 11:01 AM
>Subject: InitialContextFactory
>Short version:
>What's the initial context factory for Tomcat (for use in accessing DB2
>via db2cli for Windows via ODBC/JDBC)?
>Long version:
>I'm trying to evaluate Eclipse as an IDE for maintaining a Java project
>(applications/servlets/jsps), originally written using VAJ for use on
>Websphere.  I've gotten Tomcat 4.1 running on my machine, I've the
>sysdeo plugin for Eclipse, which seems to be a bridge to Tomcat, so one
>can deal with it in Eclipse.
>I deployed a previously existing war, via Tomcat manager, into
>Now, I can get to my first .JSP successfully :-), but...
>It's a form whose contents are then checked against a database (JDBC to
>ODBC to db2cli for Windows to Mainframe DB2).
>In our project.props file, we set JNDI.InitialContextFactory to:
> (for testing in VAJ's
> (for production) on
>The project's framework reads the .props file and sets various things,
>I've included a code snippet below.
>Right now, I'm trying to find/figure out what to use for an initial
>context factory, that's not an IBM class.  When I continue and try the
>form, with the IBM class,
>javax.naming.spi.NamingManager.getInitialContext throws a
>ClassNotFoundException on the IBM class (cause it's not there)
>So... the two application servers from IBM have different initial
>context factories, I'm assuming that Tomcat also has an initial context
>factory.  What is it?
>Or... Maybe I need something completely different ;-)
>Anyway, here's the code snippet showing the use of the
>  try {
>    Hashtable initContextProps = new Hashtable();
>    initContextProps.put(javax.naming.Context.PROVIDER_URL,(String)
>g) configService.getPropert("JNDI.InitialContextFactory"));
>    javax.naming.InitialContext context = new
>    DataSource ds =
>  if (dbConn!=null) dbConn.setAutoCommit(false);
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message