Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javax.naming.NamingException: Cannot create resource instance

 
Pankaj Tripathi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I am using Tomcat 5.0.
I am using this code for getting datasource,

private static DataSource locateDataSource() {
Context initialContext = null;
String DATASOURCE_CONTEXT = "java:comp/env/jdbc/quotesDS";
try {
initialContext = new InitialContext();
datasource = (DataSource) initialContext.lookup(DATASOURCE_CONTEXT);

} catch (NamingException e) {
LOGGER.error("Cannot get connection:" + e.getMessage() +e);
}
return datasource;

}

I have added ojdbe14.jar and p6spy-1.3-patch.jar in Tomcat 5.0\common\lib
In Contex.xml entry is this

<Resource name="jdbc/quotesDS" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbcracle:thin:@192.168.3.176:1521:test"
username="test" password="test"/>

</Context>

When i run the application, it is giving following error


javax.naming.NamingException: Cannot create resource instance

Thanks in advance.


Regards
Pankaj
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic