This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tomcat 7 not loading classes/jars in Web-Inf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 7 not loading classes/jars in Web-Inf" Watch "Tomcat 7 not loading classes/jars in Web-Inf" New topic
Author

Tomcat 7 not loading classes/jars in Web-Inf

Hugh Acland
Greenhorn

Joined: Jul 29, 2007
Posts: 3
Hello -

I'm on Mac OS X, using Tomcat 7. I can see the JAR libraries in the {webapp}/WEB-INF/lib directory fine

However I am still getting the cursed java.lang.NoClassDefFoundError

Even if I then manual delete the .jar file the error remains with same stacktrace so to my mind it appears the classloaders are not kicking in correctly?

Can anyone please point me in the correct direction.

Many thanks
Sachin Pachari
Ranch Hand

Joined: Jan 16, 2012
Posts: 56

posting the error stack strace might help a little bit.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Note that a "NoClassDefFound" exception is something entirely different than a ClassNotFoundException!


Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
It could mean that the jar file that contains the missing class is damaged; make sure you can do a "jar tf ..." on it.
Hugh Acland
Greenhorn

Joined: Jul 29, 2007
Posts: 3
Sachin Pachari wrote:posting the error stack strace might help a little bit.


Thanks here it is:

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.AmazonS3Client
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
org.apache.jsp.index_jsp._jspService(index_jsp.java:143)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.AmazonS3Client
org.apache.jsp.index_jsp._jspService(index_jsp.java:111)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

The class can be found, just not initialized. That means that a RuntimeException or Error occurs when the class is loaded and initialized. The most occurring problems are a native library file that fails to be load, or a dependency that's missing.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 7 not loading classes/jars in Web-Inf
 
Similar Threads
Does Anyone Successfully Deploy TLD in JAR
clarification about an exception needed..
ANT <jar>: How NOT to include META-INF folder
AspectJ-1.6.3rc1 getting java.lang.OutOfMemoryError: Java heap space
Deployment Environment