• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat Throwing java.lang.ClassNotFoundException

 
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
https://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:
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Tim and Ulf
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
He was expelled for perverse baking experiments. This tiny ad is a model student:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic