Dear all,

Like several persons, I got this "null DataSource". I read several
mails, but i didn't find any answer.(example:
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg44065.html).

So I am trying to define the problem as accurate as possible :

Environment definition :
------------------------
- Running Tomcat v4.02 under Linux (installation directory :
/usr/local/jakarta-tomcat-4.0.2)
- Starting developping my web application with asimple JSP page
(installation directory : /home/james/myWebProject/)
- Creating subdirectrories /home/james/myWebProject/WEB-INF/ and
/home/james/myWebProject/WEB-INF/lib/
- Using Oracle 8 on my database server named ukki, and copying the
Oracle
driver in /home/james/myWebProject/WEB-INF/lib/
- The instance of my databse is named : develdb


My server.xml file (in /usr/local/jakarta-tomcat-4.0.2/conf) :
--------------------------------------------------------------
...
  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Tomcat-Standalone">
...

    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Standalone" defaultHost="localhost" debug="0">
...

      <!-- Define the default virtual host -->
      <Host name="localhost" debug="0" appBase="webapps"
            unpackWARs="true">
...
        <Context path="/Test" docBase="/home/james/myWebProject/"
                 debug="4" reloadable="true" crossContext="true">

          <Logger className="org.apache.catalina.logger.FileLogger"
                  prefix="localhost_test." suffix=".txt"
                  timestamp="true"/>

          <Resource name="jdbc/myDB" auth="Container"
                    type="javax.sql.DataSource"/>

          <ResourceParams name="jdbc/myDB">
            <parameter>
              <name>user</name>
              <value>james</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>bond007</value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>oracle.jdbc.driver.OracleDriver</value>
            </parameter>
            <parameter>
              <name>driverName</name>
              <value>jdbc:oracle:thin:@ukki:1521:develdb</value>
            </parameter>
          </ResourceParams>

        </Context>
...
      </Host>

    </Engine>

  </Service>
...


and my "web.xml" file (in /home/james/myWebProject/WEB-INF/) :
--------------------------------------------------------------
...
        <resource-ref>
                <description>
                  Resource reference to a factory for
                  java.sql.Connection
                </description>
                <res-ref-name>jdbc/myDB</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>
...

To start Tomcat :
-----------------
/usr/local/jakarta-tomcat-4.0.2/bin/startup.sh

and i got the following traces :
2002-02-15 15:15:42 StandardContext[/Test]: Starting
2002-02-15 15:15:42 StandardContext[/Test]: Processing start(), current
available=false
2002-02-15 15:15:42 StandardContext[/Test]: Configuring default
Resources
2002-02-15 15:15:42 StandardContext[/Test]: Configuring non-privileged
default Loader
2002-02-15 15:15:42 StandardContext[/Test]: Configuring default Manager
2002-02-15 15:15:42 StandardContext[/Test]: Processing standard
container startup
2002-02-15 15:15:42 WebappLoader[/Test]: Deploying class repositories to
work directory /usr/local/jakarta-tomcat-4.0.2/work/localhost/Test
2002-02-15 15:15:42 WebappLoader[/Test]: Deploy JAR
/WEB-INF/lib/oracledr.jar to
/home/james/myWebProject/WEB-INF/lib/oracledr.jar
2002-02-15 15:15:42 WebappLoader[/Test]: Reloading checks are enabled
for this Context
2002-02-15 15:15:42 StandardManager[/Test]: Seeding random number
generator class java.security.SecureRandom
2002-02-15 15:15:42 StandardManager[/Test]: Seeding of random number
generator has been completed
2002-02-15 15:15:42 ContextConfig[/Test]: ContextConfig: Processing
START
2002-02-15 15:15:43 StandardContext[/Test]: Setting deployment
descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN'
2002-02-15 15:15:43 StandardContext[/Test]: Setting deployment
descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN'
2002-02-15 15:15:43 ContextConfig[/Test]: Scanning web.xml tag libraries
2002-02-15 15:15:43 ContextConfig[/Test]: Scanning library JAR files
2002-02-15 15:15:43 ContextConfig[/Test]:    
tldConfigJar(/WEB-INF/lib/oracledr.jar): java.io.IOException: No such
file or directory
2002-02-15 15:15:43 Authenticator[/Test]: No SingleSignOn Valve is
present
2002-02-15 15:15:43 ContextConfig[/Test]: Configured an authenticator
for method BASIC
2002-02-15 15:15:43 ContextConfig[/Test]: Pipline Configuration:
2002-02-15 15:15:43 ContextConfig[/Test]:  
org.apache.catalina.authenticator.BasicAuthenticator/1.0
2002-02-15 15:15:43 ContextConfig[/Test]:  
org.apache.catalina.core.StandardContextValve/1.0
2002-02-15 15:15:43 ContextConfig[/Test]: ======================
2002-02-15 15:15:43 StandardContext[/Test]: Configuring application
event listeners
2002-02-15 15:15:43 StandardContext[/Test]: Sending application start
events
2002-02-15 15:15:43 StandardContext[/Test]: Starting filters
2002-02-15 15:15:43 StandardContext[/Test]: Posting standard context
attributes
2002-02-15 15:15:43 StandardWrapper[/Test:default]: Loading container
servlet default
2002-02-15 15:15:43 default: init
2002-02-15 15:15:43 StandardWrapper[/Test:invoker]: Loading container
servlet invoker
2002-02-15 15:15:43 invoker: init
2002-02-15 15:15:43 jsp: init
2002-02-15 15:15:44 StandardContext[/Test]: Starting completed



<<<< 1st PROBLEM >>>>
2002-02-15 15:15:43 ContextConfig[/Test]: Scanning library JAR files
2002-02-15 15:15:43 ContextConfig[/Test]:    
tldConfigJar(/WEB-INF/lib/oracledr.jar): java.io.IOException: No such
file or directory
<<<< 1st PROBLEM >>>>


Then I use a simple jsp page to execute a simple SQL statement :
----------------------------------------------------------------
...
      // Obtain our environment naming context
      initCtx = new javax.naming.InitialContext();
      envCtx = (Context) initCtx.lookup("java:comp/env");
      // Look up our data source
      DataSource ds = (DataSource) envCtx.lookup("jdbc/myDB");

<<<< 2nd PROBLEM >>>>
=> Then the DataSource is always null.
<<<< 2nd PROBLEM >>>>

Did someone already find a solution ?
Thanks in advance for your answers,
Fred.

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to