I have a servlet that contains the following code in its init() method:

public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
System.out.println("Context loaded: " );
ds = (DataSource) envCtx.lookup("ReportsDB");
System.out.println("DataSource found: " + ds.toString());
con = ds.getConnection();
con1 = ds.getConnection();
} catch(Exception e) {
System.err.println("Init Error " + e.getMessage());
}
System.out.println("Init Complete");
}


the server.xml file contains:

<Resource name="ReportsDB" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="ReportsDB">
<parameter><name>maxActive</name><value>100</value></parameter>
<parameter><name>maxIdle</name><value>10</value></parameter>
<parameter><name>maxWait</name><value>10000</value></parameter>
<parameter><name>user</name><value>user</value></parameter>
<parameter><name>password</name><value>password</value></parameter>
<parameter><name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value></parameter>
<parameter><name>driverName</name>
<value>jdbc:oracle:thin:@myhost.edu:1521:LIBR</value></parameter>
</ResourceParams>


When I deploy the servlet on my development server (Tomcat 4.06) it runs without error and reports "Init Complete" in the localhost log.

The same code and xml deployed on a test server (tomcat 4.1.12) a naming exception is thrown and the catch block reports "Init Error Name ReportsDB is not bound in this Context".

Is there a difference between the two releases that would explain this, or are other settings involved in "binding" that I should be examining?

All suggestions gratefully accepted :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to