aspose file tools*
The moose likes JDBC and the fly likes javax.naming.NamingException- Cannot create resource instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

javax.naming.NamingException- Cannot create resource instance

Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
Greetings,
while i am trying to connect oracle database thru JNDI, i am getting this exception.The oracle jdbc driver is availavle in %CATALINA-HOME/common/lib as well as in my application context directory under WEB-INF(/lib).
I have given below my codings for reference.
This is my context in server.xml.
<!-- MyServlets Context-->
<Context path="/MyServlets" docBase="MyServlets" debug="0"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_MyServlets_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/test" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/test">
<parameter><name>user</name><value>scott</value></parameter>
<parameter><name>password</name><value>tiger</value></parameter>
<parameter><name>driverClassName</name>
<value>jdbc racle:thin:@localhost:1521:test</value></parameter>
<parameter><name>driverName</name>
<value>oracle.jdbc.driver.OracleDriver</value></parameter>
</ResourceParams>
</Context>
<!-- End of MyServlets Context -->
My application web.xml.
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and this is my JDBC connection part of my code,
try{

InitialContext ctx= new InitialContext();
DataSource ds=(DataSource) ctx.lookup("java:comp/env/jdbc/test");
conn=ds.getConnection();
}
anybody could help me out to solve this problem?.
thanks in advance.
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Did you rename the driver lib from .zip to .jar? Tomcat will only load .jar files.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
thanks carl, yes i have already done it.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The same question has been asked in the EJB and J2EE forum.
Anyone who wants to help should go HERE.
Ravikumar Jambunathan,
Please don't post the same question in multiple forums, it creates duplicate conversations and wastes the time of those who are trying to help you. I'm going to ask for this thread to be closed.
thanks,
Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.naming.NamingException- Cannot create resource instance