Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

javax.naming.NamingException- Cannot create resource instance

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Report post to moderator
Did you rename the driver lib from .zip to .jar? Tomcat will only load .jar files.
 
Ravikumar Jambunathan
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Report post to moderator
thanks carl, yes i have already done it.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!