tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Austad" <>
Subject javax.naming.NoInitialContextException:
Date Wed, 20 Feb 2002 19:35:07 GMT
I am getting the error:
	 javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.

I am using Tomcat 4.0.2, and trying to use its database pooling.  The first
few calls work, but then I eventually get this error.  I have a separate
class that manages retrieving and releasing the connections to the pool.
Here is the method that is used to retrieve the connection.

     public static Connection getConnection (String dsName) throws
       Context initCtx = new InitialContext();
       Context envCtx = (Context) initCtx.lookup("java:comp/env");
       DataSource ds = (DataSource)
       Connection conn = ds.getConnection();
       return conn;

There error gets thrown on the line:
     Context envCtx = (Context) initCtx.lookup("java:comp/env");

Once again, it works when you first try to get a connection.  Here are the
settings I have in server.xml for the database.

           <!-- Apache SOAP Context -->
	<Context path="/soap" docBase="soap"
        	<Resource name="jdbc/DaVinci" auth="SERVLET"
          	<ResourceParams name="jdbc/DaVinci">


Here are the web.xml settings I have...
    Resource reference to a factory for java.sql.Connection
    instances that may be used for talking to a particular
    database that is configured in the server.xml file.

Can anyone help me?

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

View raw message