tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Monclar <>
Subject Does Tomcat4.0 create automatically an InitialContext ?
Date Thu, 21 Feb 2002 10:45:47 GMT

I try to access to my Oracle database thanks to the new services of
I read all the interesting documentation on the Jakarta-Tomcat web site
"Tomcat 4 provides a JNDI InitialContext implementation instance to web
applications running under it,
 in a manner that is compatible with those provided by a Java2
Enterprise Edition application server.
Entries in this InitialContext are configured in the
$CATALINA_HOME/conf/server.xml file, and may be referenced by the
following elements in the web application deployment descriptor
(/WEB-INF/web.xml) of your web application:"

and I tried the following :

server.xml (located in /usr/local/jakarta-tomcat-4.0.2/conf):
<Context path="/Test" docBase="/home/fmo/myWebProject/" debug="4"
         reloadable="true" crossContext="true">

  <Logger className="org.apache.catalina.logger.FileLogger"
          prefix="localhost_test." suffix=".txt"

  <Resource name="jdbc/SIR_DB" auth="Container"

  <ResourceParams name="jdbc/SIR_DB">


my web.xml (located in /home/fred/myproject/WEB-INF/):
        <description>Resource reference to a factory for

my jsp file (located in /home/fred/myproject/):
      javax.naming.Context  initCtx       = null;
      javax.naming.Context  envCtx        = null;
      // Obtain our environment naming context
      initCtx = new javax.naming.InitialContext();
      envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
      // Look up our data source
      ds = (oracle.jdbc.pool.OracleDataSource)
Where "ds" is always null.

So, do we have to create an initialContext, or to had a subcontext or to
install an LDAP directory to manage these resources ?
Does anyone could help me ?
Thanks in advance,

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message