aspose 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply 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: 8795

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, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

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: 14487
    
    7

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: 8795

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

Joined: Sep 26, 2006
Posts: 8795

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

Joined: Jun 25, 2001
Posts: 14487
    
    7

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: 8795

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Maven / Tomcat issue with Servlet jar
 
Similar Threads
java.lang.NoClassDefFoundError: oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider
please help about the error
Apache Tomcat: startup failed due to previous errors
log4j Error
Help, I dont know why Tomcat 5.5 give me this error