I have web application written in Java using gucie-servlet framework being built by Maven 3. When I deploy it on Tomcat 7 container and try to access it using browser, Tomca
I have resolved this issue by adding the Tomcat Server into the Java Build Path in eclipse.
Right click on the project -> Build Path -> Configure Build Path -> Add library..(appears on the right side of the dialog box) -> Server Runtime -> Select "Apache Tomcat v.." -> Finish
Then run the project on the server.
Copy the files
in your ServletProjectName/WebContent/Web-INF/lib
OK, I've found the solution. After careful study of my <TOMCAT_HOME>/logs/catalina.log
I've found this record:
Apr 5, 2013 1:38:26 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/frodo/apache-tomcat-7.0.37/webapps/hive/WEB-INF/lib/base-0.0.42-SNAPSHOT.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
This question explains the reason of this message - my JAR base-0.0.42-SNAPSHOT.jar
contains something related to Servlet API and can't be loaded by Tomcat because of it. So, my web app can't find classes in this JAR after start. I'm using some parts of Twitter commons inside this JAR which contain realization of Servlet API. After revision of the dependencies of base-0.0.42-SNAPSHOT.jar
my app starts and loads classes needed. Thank you to everyone!
The root cause may be the maven-war-plugin
has been configured as the
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
The above configuration is for Creating Skinny WARs which refers all war libs
to the ear/lib
instead.
Please try to remove all of them from the maven-war-plugin
configuration. Then build and deploy to the Tomcat again.
I hope this may help.