Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat Throwing java.lang.ClassNotFoundException

 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

It seems that my Tomcat 6.0.28 has run into some problems. I was running an Servlet/JSP project in Eclipse today. And I found that its throwing some errors. I have made a post in the JDBC section as well.
http://www.coderanch.com/t/476480/JDBC/java/Unable-Load-Driver
At first i thought that i must coded something wrong but it seems that all third party classes which need JARS to be added in the Classpath are causing the same problem!!! Now even the POI API is causing issues. although i have all the JARS added in the Classpath of the project.

This is what i got:
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somnath Mallick wrote:seems that all third party classes which need JARS to be added in the Classpath


did you add into tomcat\lib folder ?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you add into tomcat\lib folder ?

Such libraries should be added to the WEB-INF/lib folder of the web app that uses them, not to Tomcat's lib folder.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
did you add into tomcat\lib folder ?

Such libraries should be added to the WEB-INF/lib folder of the web app that uses them, not to Tomcat's lib folder.


well ulf.but most of the time[i experienced] it is not loaded by container. what could be the problem?.[example, i was tried this by jdbc-connector.jar]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, *is* the library in the WEB-INF/lib folder, and did you restart the web app after placing it there? Earlier you were talking about "classpath of the project" which sounds like an Eclipse thing that is irrelevant to Tomcat.
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDBC jars SHOULD usually be placed in TOMCAT_HOME/lib. Application-specific resources such as Apache POI SHOULD usually be placed in the WAR's WEB-INF/lib folder, since they're not intended to be server-shared resources nor to be accessible from subsystems outside the webapp (like JDBC connection pools).
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Tim and Ulf
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well that was the problem! Some idiot had deleted the lib folder from the WEB-INF over the weekend! I had placed all the jars there knew that they were there.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somnath Mallick wrote:Some idiot had deleted the lib folder from the WEB-INF over the weekend!


Anyway thanks for that Idiot. because i get more clarification from this topic .
 
Theen-Theen Tan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.xa.client.OracleXADataSource'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at org.springframework.scheduling.quartz.LocalDataSourceJobStore$2.getConnection(LocalDataSourceJobStore.java:129)
at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:112)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:164)
... 71 more
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.xa.client.OracleXADataSource
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)


My data sources and transactionmanager are declared in context.xml, and the beans that are failing to create is part of a Spring context of the application.

I am seeing the error above will all the transaction and oracle driver located in by WEB-INF/lib We do not want to have anything in tomcat/lib

Is it possible?

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic