- This topic has 3 replies, 2 voices, and was last updated 13 years, 5 months ago by jkennedy.
-
AuthorPosts
-
zmerza_altruikMemberHi,
I am trying to buld a web app using Myeclipse for Spring 9 with Java EE 6.
The project has a support for Maven and is being tested on Tomcat 6 that comes with MyEclipse
Here is the issue:
When I try to test the project on Tomcat 6 , there is an error message displayed on the console stating:
“WEB-INF\lib\javax.servlet-3.0.1.jar) – jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class”
I have seen few people mentinoning about similar issues, where the jar file was being copied to lib folder when it was already being provided by the tomcat server but no one properly noted the solution.
Please let me know how to fix it or point me in a right direction and if more info is needed to debug the issue.
Thank you.
jkennedyMemberHello,
If you look in your POM file you should have something like the following, my guess though is that you may be missing the scope of provided which would cause this jar file to get deployed with your application. If you started with an empty POM or a POM that did not include this entry, then we would emit it as provided when we scaffold, but if you already had this entry in the POM (for example, if the Maven Archetype you used included it) then we would not change the scope. If this is not the case, then it is likely that some other dependency that is in the POM file is pulling in another copy of this jar file through a transitive dependency. If you right click on the POM file and choose open with / Maven POM Editor you will get a nice POM editor that makes it easier to isolate this kind of issue. If you open the Dependency Hierarchy Tab, and type the word servlet into the search box, it should help you to see where the servlet jar file may be included. Look for a reference that has as scope that is not Provided or Compile. Let me know if you can’t get the issue resolved.In that case a copy of your POM file would be helpful.
Thanks,
Jack
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
zmerza_altruikMemberThank you for the help.
The cahnges and the method described above helped me resolve the issue.
After searching the servlet I found javax.servlet, javaxservlet.jsp, javax.servlet.jsp.jstl .
Once I changed the scope of these to provided, I was able to deply the code without any issues and was able to see the pages.
Thank you.
jkennedyMemberThanks for letting us know, glad it worked out.
Jack
-
AuthorPosts