从 Tomcat 5.5.x 迁移到 6.0.x

发布于 2024-08-11 14:48:12 字数 4874 浏览 4 评论 0原文

我正在将成熟的应用程序从 Tomcat 5.5.x 迁移到 6.0.x。我需要确保解决哪些症结?

我使用了一些 Tomcat 的服务,我怀疑这些服务需要调整...

  1. 日志记录机制:我更改了 conf/logging.properties 以包含我的 web 应用程序。
  2. type="javax.sql.DataSource" 的资源:我用它来连接到 Oracle。

编辑我从一些 Tomcat 文档中看到,这些内容属于应用程序的 context.xml,而不是使用 $TOMCAT_HOME/conf 的 server.xml 和logging.properties和 WEB-INF。也许 6.0 坚持这一点?

注意:交叉发布于 serverfault.com

Edit-2:这是 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)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

孤芳又自赏 2024-08-18 14:48:13

将 Tomcat 5.5 升级到 6 没什么大不了的。基本上你只需要按原样重新配置 /conf 中的内容即可。

一个重要的细节是,Tomcat 6 将所有默认库放在一个 /lib 文件夹中,而 Tomcat 5.x 将它们分布在 /lib/shared 和 /common 及其子文件夹。验证是否没有删除额外的非应用程序服务器特定的 JAR 文件,这些文件可能需要复制到 Tomcat 6。通常这些文件只是容器管理的数据源和其他资源所需的 JDBC 驱动程序和其他 JAR 文件。此外,Tomcat 6 的 /conf/catalina.properties 还具有新属性 shared.loadercommon.loader,您可以在其中指定这些类型自己的路径。对于外部化 webapp 属性文件、xslt 文件、i18n 文件等很有用。

将 Web 应用程序迁移到另一台服务器是另一回事。最大的问题将出现在类路径中。开发人员可能会以某种方式在 /WEB-INF/lib 中删除一些特定于应用程序服务器的 JAR 文件。每当 Web 应用程序部署在不同品牌/版本的应用程序服务器上时,这都会导致“无法解释的”ClassNotFoundExceptionNoClassDefFoundError 问题。但如果网络应用程序都是“干净的”,那么我不会预见到真正的问题。

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.

稚然 2024-08-18 14:48:13

当我们迁移到 Tomcat 6.0 时,我们的应用程序遇到了一些问题,因为它是随标准 EE 库一起提供的,这些库声明了 javax.servlet 和类似的东西 - 我现在不记得具体的名称了。它在 Tomcat 5.5 中运行良好,但在 Tomcat 6.0 中不起作用。我们有一些为什么它不起作用的理论:

  • Tomcat 5.5 会简单地忽略类加载器中的这些库,而 Tomcat 6.0 不会;
  • 这些库与 Tomcat 5.5 的 EE 规范兼容,但与 6.0 不兼容。

该项目是 Maven 构建的。我们跟踪依赖关系,排除包含这些库的人,并将正确的库添加到我们正在使用的 tomcat 版本中,但作为“提供”,这意味着打包应用程序时不会提供它们。然后就成功了。

除此之外,我不记得有任何问题。但这个很难找到。当他们为 Tomcat 5.5 提供支持时,我不会迁移到 Tomcat 6.0。

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.

甜柠檬 2024-08-18 14:48:12

Apache Tomcat 网站有一个迁移指南,您可能需要查看。您可能会在其中找到一些有用的信息,因为您比 SO 读者更了解您的应用程序使用什么:)

Matt Raible 在 这篇文章

  • 他能够毫无问题地复制 XML 文件(通过 conf/server.xmlconf/Catalina/** ),
  • 他必须在某些 Web 应用程序中包含 commons-logging.jar,因为它已被打包重命名,
  • 他必须为 JSF 删除 el-api.jar

关于您所做的具体更改,我想您必须再次应用它们。但我不确定他们是否需要调整。

但实际上,我想知道为什么您要迁移成熟应用程序。您计划使用 Servlet 2.5 和 JSP 2.1 API 吗?您对其他改进感兴趣吗?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文