2016-07-26 135 views
4

技術環境: -得到錯誤而Tomcat7服務器上運行的Web服務 - 的Ubuntu 16.04 LTS

  • 的Ubuntu 16.04 LTS
  • 的Tomcat 7
  • 的Java 7
  • Eclipse的月神

我已經在我的eclipse中導入了一個webservice luna工作區,並試圖在tomcat7服務器上運行該服務。但我收到以下錯誤。

Jul 24, 2016 5:39:30 PM org.apache.tomcat.util.digester.SetPropertiesRule begin 
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:service' did not find a matching property. 

Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Server version:  Apache Tomcat/7.0.68 (Ubuntu) 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Server built:   Jun 27 2016 18:13:17 UTC 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 

INFO: Server number:   7.0.68.0 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: OS Name:    Linux 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: OS Version:   4.4.0-28-generic 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Architecture:   amd64 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Java Home:    /usr/lib/jvm/java-7-oracle/jre 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: JVM Version:   1.7.0_80-b15 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: JVM Vendor:   Oracle Corporation 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: CATALINA_BASE:   /home/shravan/Projects/Webservices/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: CATALINA_HOME:   /usr/share/tomcat7 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Command line argument: -Dcatalina.base=/home/shravan/Projects/Webservices/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Command line argument: -Dcatalina.home=/usr/share/tomcat7 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Command line argument: -Dwtp.deploy=/home/shravan/Projects/Webservices/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Command line argument: -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed 
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log 
INFO: Command line argument: -Dfile.encoding=UTF-8 
Jul 24, 2016 5:39:31 PM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["http-bio-8080"] 
Jul 24, 2016 5:39:31 PM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 781 ms 
Jul 24, 2016 5:39:31 PM org.apache.catalina.core.StandardService startInternal 
INFO: Starting service Catalina 
Jul 24, 2016 5:39:31 PM org.apache.catalina.core.StandardEngine startInternal 
INFO: Starting Servlet Engine: Apache Tomcat/7.0.68 (Ubuntu) 
Jul 24, 2016 5:39:31 PM org.apache.catalina.startup.TldConfig execute 
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 
Jul 24, 2016 5:39:33 PM org.apache.catalina.startup.TldConfig execute 
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 
Jul 24, 2016 5:39:33 PM org.apache.catalina.core.ApplicationContext log 
INFO: No Spring WebApplicationInitializer types detected on classpath 
Jul 24, 2016 5:39:33 PM org.apache.catalina.core.ApplicationContext log 
INFO: Initializing Spring root WebApplicationContext 
Jul 24, 2016 5:39:33 PM org.springframework.web.context.ContextLoader initWebApplicationContext 
INFO: Root WebApplicationContext: initialization started 
Jul 24, 2016 5:39:33 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh 
INFO: Refreshing Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy 
Jul 24, 2016 5:39:34 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] 
Jul 24, 2016 5:39:34 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dataSource.xml] 
Jul 24, 2016 5:39:34 PM org.springframework.web.context.ContextLoader initWebApplicationContext 
SEVERE: Context initialization failed 
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView; 
    at org.apache.catalina.core.ApplicationContext.getInitParameterNames(ApplicationContext.java:368) 
    at org.apache.catalina.core.ApplicationContextFacade.getInitParameterNames(ApplicationContextFacade.java:367) 
    at org.springframework.web.context.support.WebApplicationContextUtils.registerEnvironmentBeans(WebApplicationContextUtils.java:200) 
    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.postProcessBeanFactory(AbstractRefreshableWebApplicationContext.java:165) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:745) 
Jul 24, 2016 5:39:34 PM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView; 
    at org.apache.catalina.core.ApplicationContext.getInitParameterNames(ApplicationContext.java:368) 
    at org.apache.catalina.core.ApplicationContextFacade.getInitParameterNames(ApplicationContextFacade.java:367) 
    at org.springframework.web.context.support.WebApplicationContextUtils.registerEnvironmentBeans(WebApplicationContextUtils.java:200) 
    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.postProcessBeanFactory(AbstractRefreshableWebApplicationContext.java:165) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:745) 
Jul 24, 2016 5:39:34 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file 
Jul 24, 2016 5:39:34 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Context [/service] startup failed due to previous errors 
Jul 24, 2016 5:39:34 PM org.apache.catalina.core.ApplicationContext log 
INFO: Closing Spring root WebApplicationContext 
Jul 24, 2016 5:39:34 PM org.springframework.context.support.AbstractApplicationContext doClose 
INFO: Closing Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy 
Jul 24, 2016 5:39:34 PM org.springframework.context.support.AbstractApplicationContext doClose 
WARNING: Exception thrown from ApplicationListener handling ContextClosedEvent 
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy 
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346) 
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) 
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:880) 
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841) 
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:551) 
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115) 
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115) 
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5779) 
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:745) 
Jul 24, 2016 5:39:34 PM org.springframework.context.support.AbstractApplicationContext doClose 
WARNING: Exception thrown from LifecycleProcessor on context close 
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy 
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:359) 
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:888) 
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841) 
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:551) 
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115) 
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115) 
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5779) 
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:745) 
Jul 24, 2016 5:39:34 PM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["http-bio-8080"] 
Jul 24, 2016 5:39:34 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 3547 ms 

請告訴我可能的解決方案。非常感謝。

回答

4

我最近有同樣的問題。

看來,Tomcat的7類是使用Java 8圖書館在Ubuntu 16.04編譯,所以你無法使用Java 7

這是catalina.jar(7.0.68)從倉庫中運行它:

# javap -verbose org/apache/catalina/core/ApplicationContext.class 
Classfile /usr/share/tomcat7/lib/org/apache/catalina/core/ApplicationContext.class 
    Last modified 27/06/2016; size 33798 bytes 
    MD5 checksum b176f6c6f5854428fbfa67b298ed308a 
    Compiled from "ApplicationContext.java" 
public class org.apache.catalina.core.ApplicationContext implements javax.servlet.ServletContext 
    SourceFile: "ApplicationContext.java" 
    InnerClasses: 
     public statiC#479= #478 of #943; //Dynamic=class javax/servlet/FilterRegistration$Dynamic of class javax/servlet/FilterRegistration 
     public statiC#479= #511 of #945; //Dynamic=class javax/servlet/ServletRegistration$Dynamic of class javax/servlet/ServletRegistration 
     public statiC#1005= #1004 of #2; //KeySetView=class java/util/concurrent/ConcurrentHashMap$KeySetView of class java/util/concurrent/ConcurrentHashMap 
    minor version: 0 
    major version: 50 
    flags: ACC_PUBLIC, ACC_SUPER 

這是從catalina.jar(7.0.68),Apache的下載:

# javap -verbose org/apache/catalina/core/ApplicationContext.class 
Classfile /root/apache-tomcat-7.0.68/lib/org/apache/catalina/core/ApplicationContext.class 
    Last modified 08/02/2016; size 33585 bytes 
    MD5 checksum eda7f125c1ef506be98d360f6611a717 
    Compiled from "ApplicationContext.java" 
public class org.apache.catalina.core.ApplicationContext implements javax.servlet.ServletContext 
    SourceFile: "ApplicationContext.java" 
    InnerClasses: 
     public statiC#481= #480 of #946; //Dynamic=class javax/servlet/FilterRegistration$Dynamic of class javax/servlet/FilterRegistration 
     public statiC#481= #513 of #948; //Dynamic=class javax/servlet/ServletRegistration$Dynamic of class javax/servlet/ServletRegistration 
    minor version: 0 
    major version: 50 
    flags: ACC_PUBLIC, ACC_SUPER 

兩個被編譯成類格式50(Java 6中),但倉儲類有一個鏈接到Java 8排除法:

public statiC#1005= #1004 of #2; //KeySetView=class java/util/concurrent/ConcurrentHashMap$KeySetView of class java/util/concurrent/ConcurrentHashMap 

所以,如果你想使用Java 7中的Ubuntu 16.04運行Tomcat 7,你必須直接從Apache的下載並手動安裝。

+0

我試圖安裝JDK8,問題依然存在。將嘗試與Tomcat8/JDK8。 –

+0

我沒有嘗試Tomcat7/JDK8,不知道它是否有效。但Tomcat8/JDK8肯定有效。 – Vinicius

+0

現在在Ubuntu 16.04上使用Tomcat8/JDK8,完全沒有問題。 –