Reputation: 60
I recently deployed a web app that I built in eclipse to an AWS ec2 instance. Worked fine in eclipse but got a NoClassDefNotFound error on my server. I wrote a test main method in my servlet and was able to get rid of the error by running
java -cp .:(class paths to all imported classes). packageName.myservlet
So my question is how do I configure tomcat7 to include the class paths I did to get my servlet running properly, thanks.
Apr 06, 2014 10:53:37 PM org.apache.catalina.startup.HostConfig deleteRedeployResources
INFO: Undeploying context [/ArtGallery]
Apr 06, 2014 10:53:52 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with JAR file [/usr/share/java/tomcat7/log4j.jar], exists: [false] canRead:[false]
Apr 06, 2014 10:53:52 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with JAR file [/usr/share/java/tomcat7/log4j.jar], exists: [false] canRead:[false]
Apr 06, 2014 10:53:52 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with JAR file [/usr/share/tomcat7/usr/lib/jvm/jre/lib/j2ee.jar]exists:[false],canRead:[false]
Apr 06, 2014 10:53:52 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory[/usr/share/tomcat7/usr/share/tomcat7/webapps/ArtGallery/WEB-INF/lib], exists: [false], isDirectory: [false], canRead: [false]
Apr 06, 2014 10:53:52 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with JAR file [/usr/share/tomcat7/usr/lib/jvm/jre/lib/j2ee.jar], exists: [false], canRead: [false]
Apr 06, 2014 10:53:52 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory[/usr/share/tomcat7/usr/share/tomcat7/webapps/ArtGallery/WEB-INF/lib], exists: [false], isDirectory: [false], canRead: [false]
Apr 06, 2014 10:53:53 PM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
SEVERE: Exception processing Global JNDI Resources
javax.naming.NamingException: The markup in the document following the root element must be well-formed.
Here some suspicious warning I found in catalina.out, and below is what I can use to get the servlet to run my test main method.
java -classpath .:/usr/lib/jvm/jre/lib/j2ee.jar:/usr/share/tomcat7/webapps/ArtGallery/WEB-INF/lib/* ArtworkServlet/ArtworkDB
Upvotes: 1
Views: 2074
Reputation: 247
Looking at the log file it seems there is an issue with Your tomcat installation. see the commenta For more info.
as brute Force Solution I suggest to reinstall tomcat.
working with the classpath is not the right way to solve the problem
Upvotes: 1