Mac OS X 上的 Tomcat 6.0

发布于 2024-09-06 11:14:53 字数 2678 浏览 6 评论 0原文

嘿,我正在尝试在 Mac OS X - Snow Leopard 上运行 Apache Tomcat 6.0.26,但没有运气:(

我已经从以下位置下载了 Tomcat 核心: http://tomcat.apache.org/download-60.cgi 将其解档到 /Livrary/Tomcat 目录,但是当我尝试运行它时使用 log/catalina.out 日志中的 ./bin/startup.sh 命令似乎找不到 servlet-api:

SEVERE: Error deploying configuration descriptor host-manager.xml
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
    at org.apache.catalina.core.StandardHost$MemoryLeakTrackingListener.lifecycleEvent(StandardHost.java:561)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4462)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

在启动过程中,它登录到它正在使用的控制台 CLASSPATH:

Using CLASSPATH:       /Library/Tomcat/bin/bootstrap.jar

我没有尝试部署自己的应用程序(* .war)这只是“干净的”Tomcat。

Hey, I'm trying to run Apache Tomcat 6.0.26 on Mac OS X - Snow Leopard, but with no luck :(

I've downloaded Tomcat core from: http://tomcat.apache.org/download-60.cgi unarchived it at /Livrary/Tomcat directory, but when I'm trying to run it using ./bin/startup.sh command from log/catalina.out logs it seem's that it can't find servlet-api:

SEVERE: Error deploying configuration descriptor host-manager.xml
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
    at org.apache.catalina.core.StandardHost$MemoryLeakTrackingListener.lifecycleEvent(StandardHost.java:561)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4462)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

During startup it logs in console CLASSPATH it's using:

Using CLASSPATH:       /Library/Tomcat/bin/bootstrap.jar

I've not tried to deploy my own application (*.war) it's just "clean" Tomcat.

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

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

发布评论

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

评论(2

誰認得朕 2024-09-13 11:14:53

可能您的系统类路径不知怎么地被 2.5 之前的 servlet API jar 污染了。

您可以通过运行 java javax.servlet.http.HttpServlet 来检查它 - 它应该抛出 NoClassDefFound 。如果抛出 NoSuchMethodError,请检查您的类路径(尤其是 CLASSPATH 环境变量和 JRE 安装的 lib/ext 子文件夹)。

编辑:尝试以下代码 - 至少它会显示有问题的 jar 的位置:

public class Test {
    public static void main(String[] args) throws Exception {   
        System.out.println(
            Test.class.getClassLoader().getResource("javax/servlet/http/HttpServlet.class"));
    }
}

Probably your system classpath somehow get polluted with pre-2.5 servlet API jar.

You may check it by running java javax.servlet.http.HttpServlet - it should throw NoClassDefFound. If it throws NoSuchMethodError, check your classpath (especially CLASSPATH environment variable and lib/ext subfolder of JRE installation).

EDIT: Try the following code - at least it will show the location of the offending jar:

public class Test {
    public static void main(String[] args) throws Exception {   
        System.out.println(
            Test.class.getClassLoader().getResource("javax/servlet/http/HttpServlet.class"));
    }
}
会发光的星星闪亮亮i 2024-09-13 11:14:53

您的 CATALINA_BASE 和 CATALINA_HOME 变量是否正确?

(它们应该在启动时与 CLASSPATH 一起打印)。

我只是尝试了你所做的(在 OS X 10.6.3 上下载了一个新的 tomcat 6.0.26),解压缩它(我下载了 core/zip),然后将所有 .sh 文件设置为可执行文件:
(在 bin 文件夹中):

chmod a+x *.sh

之后,运行startup.sh 就可以顺利运行了。

我只能认为之前的 CATALINA 变量是冲突的?

Are your CATALINA_BASE and CATALINA_HOME variables correct?

(they should be printed along with the CLASSPATH on startup).

I just tried exactly what you did (downloaded a fresh tomcat 6.0.26 on OS X 10.6.3), unzipped it (I downloaded the core/zip), then set all the .sh files to executable:
(in the bin folder):

chmod a+x *.sh

After that, running startup.sh worked without a hitch.

I can only think that prior CATALINA variables are conflicting?

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