噩梦:将Tomcat 5.5升级到6.0 [英] Nightmare: Upgrading Tomcat 5.5 to 6.0
问题描述
我正在尝试将运行良好的嵌入式Tomcat 5.5升级到Tomcat 6.0.我了解我所要做的就是用6.0替换Tomcat 5.5 jar. 那就是我所做的.
I'm trying to upgrade a perfectly running embedded Tomcat 5.5 to Tomcat 6.0. I understand that all I need to do is replace Tomcat 5.5 jars with 6.0. That's what I did.
所以我更换了以下罐子:
So I replaced the following jars:
catalina-5.0.28.jar catalina-5.5.9.jar catalina-optional-5.5.9.jar
commons-el.jar commons-modeler-1.1.0.jar jasper-compiler-jdt.jar
jasper-compiler.jar jasper-runtime.jar jmx-5.0.28.jar jsp-api-2.0.jar
naming-factory.jar naming-resources.jar servlet-api-2.4.jar
servlets-default.jar tomcat-coyote.jar tomcat-http.jar tomcat-util.jar
具有:
annotations-api.jar catalina.jar jasper.jar tomcat-dbcp.jar
catalina-ant.jar el-api.jar jsp-api.jar tomcat-i18n-es.jar
catalina-ha.jar jasper-el.jar servlet-api.jar tomcat-i18n-fr.jar
catalina-tribes.jar jasper-jdt.jar tomcat-coyote.jar tomcat-i18n-ja.jar
tomcat-juli.jar
启动服务器后,我会在INFO级别的日志中收到以下消息:
As soon as I start the server, I get the following message in the logs at INFO level:
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Dec 31, 2010 6:04:18 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/blah/blue/./WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Based on the this explanation, I need to remove a jar file which has a conflicting Servlet.class. I swear to God, there is no other conflicting jar file, I grepped system wide for Servlet.class, it matched only servlet-api.jar.
我也下载了javaee.jar,并用servlet-api.jar替换了它.
I also downloaded javaee.jar and replaced it by servlet-api.jar, to same avail.
尝试了很多这些东西之后,我没有太多需要看的东西,因此将tomcat日志记录级别设置为ALL.在日志中,我可以看到它正在尝试在每个正在加载的jar中检查Servlet.class,直到找到servlet-api.jar并在找到servlet-api.jar时立即抛出未加载jar"消息. .见下文:
Having tried lot of these stuff, I did not have much to look upto, so set the tomcat logging level to ALL. In the log I could see that it is trying to check for Servlet.class in each and every jar it is loading until it finds servlet-api.jar and throws "jar not loaded" message as soon as it finds servlet-api.jar. See below:
FINE: Checking for javax/servlet/Servlet.class
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappLoader setRepositories
FINE: Deploy JAR /WEB-INF/lib/servlet-api.jar to /usr/local/blah/blue/./WEB-INF/lib/servlet-api.jar
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappClassLoader addJar
FINE: addJar(/WEB-INF/lib/servlet-api.jar)
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
FINE: Checking for javax/servlet/Servlet.class
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/blah/blue/./WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jan 2, 2011 7:39:33 AM org.apache.catalina.loader.WebappLoader setRepositories
更新 通过将servlet-api.jar放在一个单独的文件夹(例如$ CATALINA_HOME/common/lib)中,我可以消除上面的未添加jar"错误.但是,当我命中URL时,GUI仍然显示空白(错误404):(.命中URL时的日志消息如下所述. 更新结束
UPDATE I'm able to remove the above "jar not added" error by placing servlet-api.jar in a separate folder(like $CATALINA_HOME/common/lib). However the GUI still shows blank(Error 404) when I hit an URL :(. The log message when the URL is hit is described below. UPDATE ends
但是请注意,Tomcat已成功启动! 而且,当我在浏览器中点击URL时,我会得到空白页(仅在我的情况下,我猜想我的web.xml的cuz与大多数情况有所不同.互联网上的其他人却收到了错误404代替.)和以下日志语句(最高级)
Please note however, that Tomcat starts successfully! And as soon as I hit the URL on the browser, I get blank page(this may be in my case only, I guess 'cuz of my web.xml, sorta different from most. Other people on the internet have got Error 404 instead.) with following log statements(at finest level)
Jan 2, 2011 9:40:01 AM org.apache.catalina.connector.CoyoteAdapter parseSessionCookiesId
FINE: Requested cookie session id is 0FBA716E3F9B0147C3AF7ABAE3B1C27B
Jan 2, 2011 9:40:01 AM org.apache.catalina.authenticator.AuthenticatorBase invoke
FINE: Security checking request GET /login.jsp
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[protected]' against GET /login.jsp --> false
Jan 2, 2011 9:40:01 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: No applicable constraint located
Jan 2, 2011 9:40:01 AM org.apache.catalina.authenticator.AuthenticatorBase invoke
FINE: Not subject to any constraint
Jan 2, 2011 9:40:01 AM org.apache.catalina.core.StandardWrapper allocate
FINEST: Returning non-STM instance
我不确定上述日志消息是否重要,但我希望在此处进行全面披露.
I'm not sure if the above log message is important, but I'm for all-out disclosure here.
但是,有趣的是,我在WEB-INF文件夹之外手动创建了一个仅包含"helloooo"的虚拟jsp文件(此文件没有安全约束).该文件是可访问的并且可以显示.但是,我所有的jsp和类都在WEB-INF(ofcourse)内部.
One interesting thing though, I manually created a dummy jsp file containing only "helloooo" just outside WEB-INF folder(no security constraints for this file). This file was accessible and could be displayed. But, all my jsp's and classes are inside WEB-INF(ofcourse).
对此问题感到厌倦,请帮助我解决它.我已经花了20到24个小时,但未成功.
Sick and tired of this issue, please help me solve it. I've already spent 20-24 hours on this unsuccessfully.
任何指针方向提示线索吗?
Any pointers directions hints leads?
推荐答案
因此,问题实际上是:不使用最新的jar来编译源代码.计算机上存在的类是预先存在的,并且是使用Tomcat 5.5 jar(而不是Tomcat 6.0)编译的.转移新鲜的课程解决了我的问题.
So the issue really was: not compiling the source code with latest jars. The classes present on the machine were pre-existent and compiled using Tomcat 5.5 jars and not Tomcat 6.0. Transferring fresh classes solved my problem.
非常感谢mtraut对这个问题表现出兴趣.希望我能多次投票给您. :)
Big thanks to mtraut for showing interest on this question. I wish I could up-vote you more than once. :)
这篇关于噩梦:将Tomcat 5.5升级到6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!