Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes validateJarFile - Reg 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 » Products » Tomcat
Bookmark "validateJarFile - Reg" Watch "validateJarFile - Reg" New topic
Author

validateJarFile - Reg

Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi,

I am working with Tomcat 4.1.18.

I have my own web application directory inside the webapps.
In the WEB-INF of my application, i have a foler "lib" where i place
oracle.jar and servlet.jar...

Coming to my problem, when i start my Tomcat up, he says that



WebAppClassLoader : validateJarFile("c:\Tomcat\webapps\Track\web-inf\
lib\servlet.jar) - jar not loaded. See servlet spec 2.3,section 9.7.2.
Offending class : javax/servlet/Servlet.class



What's causing this error? and what am i supposed to do, to avoid this?

Thanks....in advance..

Cheers,
Swamy.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi Swamy,

There is another servlet.jar under c:\tomcat\common\lib. The servlet.jar contains all the servlet and jsp api classes. You can view the content of servlet.jar using "jar tf servlet.jar". I suggest you remove the servlet.jar from the Track\web-inf\lib and place it in a temp directory.

Joyce
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Joyce,

Thanks for the reply,

On my removing the servlet.jar from my application, what if I am deployingit on another server? Isn't the "lib" directory of my application a mandatory one?

Cheers,
Swamy
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi Swamy,

Originally posted by Ramaswamy Srinivasan:
On my removing the servlet.jar from my application, what if I am deploying it on another server? Isn't the "lib" directory of my application a mandatory one?


Extracted from servlet specification 2.4, section 9.7.2:

SRV.9.7.2 Web Application Class Loader
The class loader that a container uses to load a servlet in a WAR must allow the developer to load any resources contained in library JARs within the WAR following normal J2SE semantics using getResource . As described in the J2EE license agreement, servlet containers that are not part of a J2EE product should not allow the application to override J2SE platform classes, such as those in the java.* and javax.* namespaces, that J2SE does not allow to be modified. Also, servlet containers that are part of a J2EE product should not allow the application to override J2SE or J2EE platform classes, such as those in java.* and javax.* namespaces, that either J2SE or J2EE do not allow to be modified. The container should not allow applications to override or access the container�s implementation classes. It is recommended also that the application class loader be implemented so that classes and resources packaged within the WAR are loaded in preference to classes and resources residing in container-wide library JARs.


I think by placing servlet.jar under the application lib violated the rule "servlet containers that are not part of a J2EE product should not allow the application to override J2SE platform classes, such as those in the java.* and javax.* namespaces,...". If you deploy on other web container such as Orion, such classes with namespaces javax.* can be found in orion.jar too.

Just curious, why do you need the servlet.jar in the application lib since a web container has its own version?

Let's see if others may have different opinions or workarounds.

Joyce
[ October 18, 2004: Message edited by: Joyce Lee ]
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Joyce,


Just curious, why do you need the servlet.jar in the application lib since a web container has its own version?


I too was curious of this. If I try removing the servlet.jar from my application lib, it is working fine. Thanks a lot.

By the way, while making some study over the internet, i came to know of the lib directory of your web application, containing the jar files. I am not sure about that...

But things are fine now...my Tomcat doesn't say that error...

Thanks..

Cheers,
Swamy
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: validateJarFile - Reg
 
Similar Threads
htaccess and mod_rewrite issue
Extraction of WAR, rebuild the WAR
Tomcat loading servlet ..twice..
init()
struts with tomcat -not recognizing servlet.api.jar