Hi,

In the process of migrating an application from Tomcat 5.0.28 to Tomcat 6.0.18, 
I've identified a different behavior in processing jar files between the two 
versions.  I've attached a small test application (testapp.war) that can be run 
under both versions to display the differences.  I've also included the 
appropriate lines from the log files of the two versions below.

Essentially, when running my Java code which calls method getResource(String 
name) of class Class to find a resource that is part of a jar file, Tomcat 
5.0.28 finds the jar file in the classpath and expands it in directory 
jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader.  And then I can 
access the resource in the expanded jar file by calling the getPath() method on 
the instance of the URL class returned by the getResource(String name) method.

However, when running the same code with Tomcat 6.0.18, Tomcat finds the 
resource in the jar file, but it does not expand the jar file under the 
apache-tomcat-6.0.18/work/Catalina/localhost directory tree and therefore, I 
cannot access the resource from the jar file.

I've checked the Servlet Specification Version 2.4 (Tomcat 5) and Version 2.5 
(Tomcat 6) to see if this should be the expected behavior under Tomcat 6, but 
as far as I can tell, it should process jar files in the same was as Tomcat 5.

If anyone can let me know what the correct behavior should be for Tomcat 6, and 
if there is a way that I can force Tomcat 6 to process jar files in the same 
way as Tomcat 5, I would greatly appreciate it.

Thanks,

Pat



Tomcat 5.0.28:
-------------

~/opt/jakarta-tomcat-5.0.28/logs % cat 
~/opt/jakarta-tomcat-5.0.28/logs/catalina.out | fgrep StartupServlet
2009-05-22_11:56 StartupServlet_init - Initializing servlet StartupServlet
2009-05-22_11:56 StartupServlet_init - url = 
file:/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/queryDefns/
2009-05-22_11:56 StartupServlet_init - url.getPath() = 
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/queryDefns/
2009-05-22_11:56 StartupServlet_init - url.getFile() = 
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/queryDefns/
2009-05-22_11:56 StartupServlet_init - url.getProtocol() = file
2009-05-22_11:56 StartupServlet_processPath - pathName = 
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/queryDefns/
2009-05-22_11:56 StartupServlet_processPath - fileName = queryDefns
2009-05-22_11:56 StartupServlet_processPath - File queryDefns exists.
2009-05-22_11:56 StartupServlet_processPath - pathName = 
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/queryDefns/describeRawTables.xml
2009-05-22_11:56 StartupServlet_processPath - fileName = describeRawTables.xml
2009-05-22_11:56 StartupServlet_processPath - File describeRawTables.xml exists.
2009-05-22_11:56 StartupServlet_processFile - File describeRawTables.xml is a 
file.
~/opt/jakarta-tomcat-5.0.28/logs %
~/opt/jakarta-tomcat-5.0.28/logs %
~/opt/jakarta-tomcat-5.0.28/logs % find 
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/tldCache.ser
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/META-INF
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/META-INF/MANIFEST.MF
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/queryDefns
/usr/nlm/kss/opt/jakarta-tomcat-5.0.28/work/Catalina/localhost/testapp/loader/queryDefns/describeRawTables.xml
~/opt/jakarta-tomcat-5.0.28/logs %


Tomcat 6.0.18:
-------------

~/apps/apache-tomcat-6.0.18/logs % cat 
~/apps/apache-tomcat-6.0.18/log/catalina.out | fgrep StartupServlet
2009-05-22_12:27 StartupServlet_init - Initializing servlet StartupServlet
2009-05-22_12:27 StartupServlet_init - url = 
jar:file:/usr/nlm/kss/apps/apache-tomcat-6.0.18/webapps/testapp/WEB-INF/lib/sample.jar!/queryDefns
2009-05-22_12:27 StartupServlet_init - url.getPath() = 
file:/usr/nlm/kss/apps/apache-tomcat-6.0.18/webapps/testapp/WEB-INF/lib/sample.jar!/queryDefns
2009-05-22_12:27 StartupServlet_init - url.getFile() = 
file:/usr/nlm/kss/apps/apache-tomcat-6.0.18/webapps/testapp/WEB-INF/lib/sample.jar!/queryDefns
2009-05-22_12:27 StartupServlet_init - url.getProtocol() = jar
2009-05-22_12:27 StartupServlet_processPath - pathName = 
file:/usr/nlm/kss/apps/apache-tomcat-6.0.18/webapps/testapp/WEB-INF/lib/sample.jar!/queryDefns
2009-05-22_12:27 StartupServlet_processPath - fileName = queryDefns
2009-05-22_12:27 StartupServlet_processPath - File queryDefns DOES NOT exist.
~/apps/apache-tomcat-6.0.18/logs %
~/apps/apache-tomcat-6.0.18/logs %
~/apps/apache-tomcat-6.0.18/logs % find ../work/
../work/
../work/Catalina
../work/Catalina/localhost
../work/Catalina/localhost/UMLS08AB
../work/Catalina/localhost/UMLS08AB/SESSIONS.ser
../work/Catalina/localhost/manager
../work/Catalina/localhost/manager/org
../work/Catalina/localhost/manager/org/apache
../work/Catalina/localhost/manager/org/apache/jsp
../work/Catalina/localhost/manager/org/apache/jsp/_401_jsp.java
../work/Catalina/localhost/manager/org/apache/jsp/_401_jsp.class
../work/Catalina/localhost/manager/SESSIONS.ser
../work/Catalina/localhost/host-manager
../work/Catalina/localhost/host-manager/SESSIONS.ser
../work/Catalina/localhost/RegService
../work/Catalina/localhost/RegService/SESSIONS.ser
../work/Catalina/localhost/testapp
~/apps/apache-tomcat-6.0.18/logs %




Patricia T. Guimaraes
NIH/NLM/OCCS/MLB
SCI Contractor
E-mail: pguimar...@nlm.nih.gov
Phone:  301-496-3615
Building 38A, Room 2N-218



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to