Migrating from Tomcat 5.5.x to 6.0.x
I'm migrating 开发者_运维百科an mature application from Tomcat 5.5.x to 6.0.x. What are the sticking points that I need to make sure that I address?
I use a couple of Tomcat's services that I suspect will need adjustment...
- The logging mechanism: I altered the conf/logging.properties to include my webapp.
- The Resource of type="javax.sql.DataSource": I use this to connect to Oracle.
Edit: I'm seeing from some of the Tomcat documentation that rather than using the server.xml and logging.properties of the $TOMCAT_HOME/conf, that these belong in the application's context.xml and WEB-INF. Perhaps 6.0 insists upon this?
Note: Cross posted on serverfault.com.
Edit-2: Here is the exception as logged in the localhost.YYYY-MM-DD.log...
Nov 19, 2009 12:29:31 PM org.apache.catalina.core.ApplicationContext log
INFO: [gov.llnl.tox.toxServlet]@20091119122931.231 - initialized tox version: 1.5 build 0 with verbose logging
Nov 19, 2009 12:29:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.commons.httpclient.HttpMethodBase.<clinit>(HttpMethodBase.java:104)
at gov.llnl.tox.util.tag.doPost(tag.java:37)
at gov.llnl.tox.util.tag.doAfterBody(tag.java:66)
at org.apache.jsp.test_jsp._jspx_meth_tox_005ftoxTalk_005f0(test_jsp.java:241)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:595)
Nov 19, 2009 12:35:58 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.commons.httpclient.HttpMethodBase.<clinit>(HttpMethodBase.java:104)
at gov.llnl.tox.util.tag.doPost(tag.java:37)
at gov.llnl.tox.util.tag.doAfterBody(tag.java:66)
at org.apache.jsp.test_jsp._jspx_meth_tox_005ftoxTalk_005f0(test_jsp.java:241)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:595)
The Apache Tomcat website has a Migration Guide that you might want to check. You may find some usefull information in it as you know what your application uses better than SO readers do :)
Matt Raible reports some more feedback in this post:
- he was able to copy XML files without any problems (over
conf/server.xml
andconf/Catalina/**
), - he had to include
commons-logging.jar
in some webapp as it has been packaged renamed, - he had to remove
el-api.jar
for JSF.
Regarding the specific changes you made, I guess you'll have to apply them again. But I'm not sure they'll need adjustment.
But actually, I'm wondering why you migrate your mature application. Do you plan to use Servlet 2.5 and JSP 2.1 APIs? Are you interested by the other improvements?
Upgrading Tomcat 5.5 to 6 is no big deal. Basically you just need to reconfigure the stuff in /conf
as it was.
One important detail is that Tomcat 6 has all the default libraries in one /lib
folder while Tomcat 5.x has them spread over /lib
, /shared
and /common
and its subfolders. Verify if there aren't extra non-appserver-specific JAR files dropped which might need to be copied to Tomcat 6. Often those are only be the JDBC drivers and other JAR's which are required by the container managed datasources and other resources. Further on, Tomcat 6's /conf/catalina.properties
also has new properties shared.loader
and common.loader
wherein you can specify those kind of paths yourself. Useful to externalize webapp properties files, xslt files, i18n files and so on.
Migrating webapplications to another server is another story. The biggest problems would arise in the classpath. It may happen that the developer has somehow dropped some appserver-specific JAR files in the /WEB-INF/lib
. That would cause "unexplainable" ClassNotFoundException
or NoClassDefFoundError
problems whenever the webapp is deployed on an appserver of a different make/version. But if the webapp is all "clean", then I don't forsee real problems.
When we migrated to Tomcat 6.0 we had some problems with our application as it was shipped with the standard EE libraries, the ones that declare javax.servlet and similar stuff - I can't recall the specific name now. It worked fine in Tomcat 5.5 but did not work in Tomcat 6.0. We had some theories why it didn't work:
- Tomcat 5.5 would simply ignore these libraries in the class loader and Tomcat 6.0 would not;
- These libraries were compatible with the EE specification for Tomcat 5.5 but not for 6.0.
This project was a Maven build. We tracked the dependencies, excluded whoever included those libraries, and added the correct libraries to the version of tomcat that we were using, but as "provided", which means that they are not shipped when the application is packaged. Then it worked.
Other than that, I don't recall any problems. But this one was tricky to find. I will not migrate to Tomcat 6.0 while they're providing support for Tomcat 5.5.
精彩评论