views:

539

answers:

3

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...

  1. The logging mechanism: I altered the conf/logging.properties to include my webapp.
  2. 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)
A: 

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.

Ravi Wallau
My application does not include any jars which include javax.* or java.*.
dacracot
It is at any way a bad practice to include appserver specific libraries in webapplication. Just because of those kind of unportability problems.
BalusC
@BalusC It came from some other dependency that we were adding. When we noticed this problem we reviewed our dependencies to make sure that nothing unwanted was being carried.
Ravi Wallau
+1  A: 

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 and conf/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?

Pascal Thivent
I looked at the "Migration Guide"... and to be honest... its lame. Only 270 words and nothing said.
dacracot
Oh, and the reason to migrate... We are considering using Liferay which is dependent upon 6.0.x apparently, and we don't want to maintain two versions of Tomcat.
dacracot
+1  A: 

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.

BalusC
I am having the problem you describe, the "unexplainable" ClassNotFoundException. My /WEB-INF/lib consists of orai18n.jar, saxon9.jar, and my own tox.jar. Honestly can't remember why orai18n is there. Perhaps this is a starting point.Also, what do you mean by a "clean" webapp?
dacracot
First, what's the name of the missing class? If it is one of the Java EE classes which ought to be default supplied by the appserver, then it means that the `WEB-INF/lib` is dirty (see 3rd paragraph). If it concerns another class which is not by default supplied by the appserver then verify if there aren't any JAR's in Tomcat 5.5's library paths which should be copied to Tomcat 6 (see 2nd paragraph).
BalusC
It is the former... the logging mechanism which should be part of tomcat is being reported as missing. But I'm still not clear as to what you mean by "dirty". I've only three jars in my app's WEB-INF/lib. My jar is "clean". I certainly trust the saxon9.jar. Perhaps the oracle orai18n.jar is the issue?
dacracot
With "dirty" I mean that the `WEB-INF/lib` contains appserver-specific JAR's which doesn't belong in there. This is likely not the root cause of your problem. Can you please post the entire exception and the stacktrace? Edit it in your topicstart if it gets long.
BalusC
Posted the exception.
dacracot
That's part of the commons logging which has been package renamed as pointed out by Pascal Thivent in his reply. You can download it here: http://commons.apache.org/downloads/download_logging.cgi
BalusC