• 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

ClassNotFound?

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am deploying for the first time an app in a dedicated mashine, in which both MySQL and Tomcat will be running. I am using the IceFaces Framework. The first page loads correctly but when accessing the database for the first time, it throws a ClassNotFound Exception. The driver is there although under WEBINF/lib/mysql-connector-java-5.1.10-bin.jar . I tried placing the driver in the server instance (Tomcat 6.0/lib/[the same file]) but no luck. How is that possible? Can the mistake be due to any other reason, but the thrown exception keep being ClassNotFound?It is really weird, since IceFaces for instance requires several libraries, which are all of them found, then the page displays the first page which alreadycontains IceFaces components. All jars are placed inside the same folder, therefore I am not being able to understand the reason for that.

Could anyone please point me out?
Of course in the dev mashine everything worked as expected,without exceptions. Developed with Eclipse Galileo.

Thanks for your help!
Carlos Conti.
 
Carlos Conti
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok finally I found a solution to the problem.
Since the Resource is declared in the context.xml in the $CATALINA_HOME/conf folder, and the Driver class identifier is also specified there, I pressumed that the driver should not only be in the WebApp/lib folder, but also in the $CATALINA_HOME/lib folder.
I read a couple of Tomcat articles where it was explained that the 'common' lib folder was the one to hold common drivers such as JDBC. Then I beared in mind the reference in context.xml and tried moving the driver to this 'common' library folder, without removing the webapp/lib one, and it worked.
Must still try removing the webapp/lib .jar, to see if it still works. It should work, then apparently the $CATALINA_HOME/lib jar'classes are also loadable from within any of the webapplications hosted by Tomcat.

This is the link to the Tomcat Documentation article which threw some light over my issue.
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

Hope this helps anyone.
Regards,
Carlos Conti.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The driver is there although under WEBINF/lib/mysql-connector-java-5.1.10-bin.jar


You meant WEB-INF/lib/, didn't you ?
 
What's brown and sticky? ... a stick. Or a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic