tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sternbergh, Cornell" <rsternb...@state.pa.us>
Subject InitialContextFactory
Date Thu, 12 Aug 2004 15:01:25 GMT
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
%CATALINA_HOME%\webapps.

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:
  com.ibm.ejs.ns.jndi.CNInitialContextFactory (for testing in VAJ's WTE)
and
  com.ibm.websphere.naming.WsnInitialContextFactory (for production) on
Websphere.

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
JNDI.InitialContextFactory:

...
  try {
    Hashtable initContextProps = new Hashtable();
    initContextProps.put(javax.naming.Context.PROVIDER_URL,(String)
configService.getProperty("JNDI.ProviderURL"));
 
initContextProps.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,(Strin
g) configService.getPropert("JNDI.InitialContextFactory"));
    javax.naming.InitialContext context = new
javax.naming.InitialContext(initContextProps);

    DataSource ds =
(DataSource)context.lookup(configService.getProperty("DB.DataSourceName"
));

 
dbConn=ds.getConnection(configService.getProperty("DB.Userid"),configSer
vice.getProperty("DB.Password"));
  if (dbConn!=null) dbConn.setAutoCommit(false);


TIA
Cornell




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


Mime
View raw message