File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven / Tomcat issue with Servlet jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven / Tomcat issue with Servlet jar" Watch "Maven / Tomcat issue with Servlet jar" New topic
Author

Maven / Tomcat issue with Servlet jar

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Guys,

I have an issue with offending jar file "servlet.class" in my web application. My web application is built using Maven and deployed to tomcat 5.x.x. I have a dependency on my Maven pom.xml for the servlet api as below,



But when I build it and deploy it to Tomcat, I get the following error message...



SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

I made the scope to provided in my Maven dependency declaration, but even after that I get the same problem.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

Make sure you delete any stale copies of the deployed servlet. Specifically, remove both the WAR and the exploded WAR from your TOMCAT_HOME/webapps directory and remove TOMCAT_HOME/work/Catalina/localhost/xxxxx, where "xxxxx" is the WAR's name.

The scope "provided" is correct for JARs like the servlet-api.jar that are provided by the runtime and not bundled as part of the deployable unit, so it's almost certain that you just have some leftover stuff from before you fixed that.


Customer surveys are for companies who didn't pay proper attention to begin with.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Yes, I did that and seems to work now.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Just deleted the exploded war and it started to work!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

One of the more irritating features of Tomcat is that if you copy a WAR into the webapps directory and Tomcat explodes it, that's the WAR it's going to use, even if you replace the original ".war" file with a newer version. So as part of my deployment process I make it a practice to clean house.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Thanks for the suggestion. I guess most of the web / app servers require a clean deployment to make use of the latest files.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven / Tomcat issue with Servlet jar
 
Similar Threads
java.lang.NoClassDefFoundError: oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider
Apache Tomcat: startup failed due to previous errors
please help about the error
log4j Error
Help, I dont know why Tomcat 5.5 give me this error