我在Mac上使用Eclipse Luna(4.4)以及Java 1.8和Tomcat 7。 在配置或未配置应用程序的情况下使用Eclipse设置Tomcat时,我无法启动它。
我在Eclipse控制台中看到了以下堆栈跟踪
Jul 13, 2015 2:02:42 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/apadmanabhan/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:RESTfulPhoneBook' did not find a matching property. Jul 13, 2015 2:02:42 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Jul 13, 2015 2:02:42 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Jul 13, 2015 2:02:42 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 593 ms Jul 13, 2015 2:02:42 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Jul 13, 2015 2:02:42 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.55 Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.descriptor.DigesterFactory locationFor WARNING: The XML schema [javaee_web_services_1_2.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.descriptor.DigesterFactory locationFor WARNING: The XML schema [web-app_3_0.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.descriptor.DigesterFactory locationFor WARNING: The XML schema [web-fragment_3_0.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.descriptor.DigesterFactory locationFor WARNING: The XML schema [web-common_3_0.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.descriptor.DigesterFactory locationFor WARNING: The XML schema [javaee_6.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.descriptor.DigesterFactory locationFor WARNING: The XML schema [javaee_web_services_1_3.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. Jul 13, 2015 2:02:42 PM org.apache.tomcat.util.descriptor.DigesterFactory locationFor WARNING: The XML schema [javaee_web_services_client_1_3.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. Jul 13, 2015 2:02:42 PM org.apache.catalina.core.ContainerBase startInternal SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader; at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:90) at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1546) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1268) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:374) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5378) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more
这些类似的错误还有很多。 我尝试了一些像编辑权限的东西,可以完全访问tomcat安装目录,玩不同的tomcat v.s. java安装但似乎没有帮助。
有什么想法吗?
答案 0 :(得分:2)
此方法javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader
在Servlet 3.0
中引入。并且,Tomcat 7.0应该具有该Servlet 3.0 API jar。
但是,您应该在类路径中的其他位置使用较旧的servlet-api.jar。
验证您的类路径以查看是否存在对servlet-api.jar
的任何其他引用将-verbose:class参数传递给java可执行文件。它将打印出类似这样的内容:
[Loaded javax.servlet.Servlet from file:/home:/.../lib/servlet-api.jar]