File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Naming Exception in tomcat-3.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Naming Exception in tomcat-3.3" Watch "Naming Exception in tomcat-3.3" New topic
Author

Naming Exception in tomcat-3.3

Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi,

I got an issue with JNDI look up in jakarta-tomcat-3.3a version.(I cannot upgrade my tomcat version.)

I'm getting this error while trying to lookup my jndi name.

"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.factory.initial"


With jakarta-tomcat-5.0.18 version i'm able to lookup jndi name,but the sad story is is i need to make this work in jakarta-tomcat-3.3a

The steps followed
(1) Created one apps_myapp.xml(I tired adding the context in server.xml also.)
<?xml version="1.0" encoding="ISO-8859-1"?>
<webapps>
<Context path="/myapp" docBase="webapps/myapp" debug="0">
<Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/mydb">
<parameter>
<name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

<parameter>
<name>maxActive</name>
<value>25</value>
</parameter>

<parameter>
<name>maxIdle</name>
<value>10</value>
` </parameter>

<parameter>
<name>username</name>
<value>admin</value>
</parameter>

<parameter>
<name>password</name>
<value>123</value>
</parameter>

<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>

<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/mydb</value>
</parameter>

<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>

</Context>
</webapps>

(2)Added to my web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
LoginInit
</servlet-name>
<servlet-class>
LoginInit
</servlet-class>
<load-on-startup>
1
</load-on-startup>
</servlet>
<resource-ref>
<description>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.</description>
<res-ref-name>jdbc/mydb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>

Any one who worked with jakarta-tomcat-3.3a ,please help me

Thanks in Advance
Chandrasekhar S.
SCJP


"Luck is when opportunity meets preparation"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Naming Exception in tomcat-3.3
 
Similar Threads
configure a servlet in tomcat
Tomcat Database Connection Pooling Error
Tomcat with MySQL Connection Pool
Configure tomcat resource factory
Is this true: JNDI equals Connection Pooling