Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 91057 invoked from network); 12 Aug 2004 15:35:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 12 Aug 2004 15:35:14 -0000 Received: (qmail 77782 invoked by uid 500); 12 Aug 2004 15:34:45 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 77751 invoked by uid 500); 12 Aug 2004 15:34:45 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 77727 invoked by uid 99); 12 Aug 2004 15:34:44 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [63.244.250.133] (HELO warhawk.mpi.com) (63.244.250.133) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 12 Aug 2004 08:34:44 -0700 Received: from lightning.mpi.com (lightning [63.244.252.11]) by warhawk.mpi.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id i7CFYfPD011751 for ; Thu, 12 Aug 2004 11:34:41 -0400 (EDT) Received: from US-VS1.corp.mpi.com (us-be2.corp.mpi.com [63.244.252.32]) by lightning.mpi.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id i7CFXwjf012106 for ; Thu, 12 Aug 2004 11:34:39 -0400 (EDT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: InitialContextFactory Date: Thu, 12 Aug 2004 11:33:48 -0400 Message-ID: <9C5166762F311146951505C6790A9CF80229BE91@US-VS1.corp.mpi.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: InitialContextFactory Thread-Index: AcSAfTg/6hsqsgZIRV+LgAnftfosawABC5tw From: "Shapira, Yoav" To: "Tomcat Users List" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, Tomcat has its own, org.apache.catalina.naming.java.javaURLContextFactory. See code at http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-catalina/catalina/src/s 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 [mailto:rsternberg@state.pa.us] >Sent: Thursday, August 12, 2004 11:01 AM >To: tomcat-user@jakarta.apache.org >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 >%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 =3D new Hashtable(); > initContextProps.put(javax.naming.Context.PROVIDER_URL,(String) >configService.getProperty("JNDI.ProviderURL")); > >initContextProps.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,(Stri n >g) configService.getPropert("JNDI.InitialContextFactory")); > javax.naming.InitialContext context =3D new >javax.naming.InitialContext(initContextProps); > > DataSource ds =3D >(DataSource)context.lookup(configService.getProperty("DB.DataSourceName " >)); > > >dbConn=3Dds.getConnection(configService.getProperty("DB.Userid"),configS= e r >vice.getProperty("DB.Password")); > if (dbConn!=3Dnull) 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 --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org