在tomcat 7.0和tomcat 8.0之间要做些什么

时间:2016-03-04 08:54:19

标签: java tomcat

我的tomcat应用程序在openSUSE 13.2上的tomcat 7.0.55上运行良好。

我需要在openSUSE 13.2上使该应用程序在tomcat 8.0.32上运行。我可以成功安装tomcat 8.0.32。

tomcat@15f439e52c9e:~> java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/8.0.32
Server built:   Feb 22 2016 11:10:58 UTC
Server number:  8.0.32.0
OS Name:        Linux
OS Version:     3.10.0-123.el7.x86_64
Architecture:   amd64
JVM Version:    1.7.0_95-b00
JVM Vendor:     Oracle Corporation

我没有对文件夹结构或目录或应用程序进行任何更改。现在,当我运行它时,它会抛出很多错误,我无法弄清楚如何解决。我们需要在这两个版本之间进行哪些更改?

04-Mar-2016 08:48:02.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.32
04-Mar-2016 08:48:02.975 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Feb 22 2016 11:10:58 UTC
04-Mar-2016 08:48:02.975 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.32.0
04-Mar-2016 08:48:02.976 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
04-Mar-2016 08:48:02.976 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-123.el7.x86_64
04-Mar-2016 08:48:02.976 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
04-Mar-2016 08:48:02.977 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/jre
04-Mar-2016 08:48:02.977 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_95-b00
04-Mar-2016 08:48:02.977 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
04-Mar-2016 08:48:02.978 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/share/tomcat
04-Mar-2016 08:48:02.978 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/share/tomcat
04-Mar-2016 08:48:02.979 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/share/tomcat/
04-Mar-2016 08:48:02.979 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/share/tomcat/
04-Mar-2016 08:48:02.980 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=
04-Mar-2016 08:48:02.980 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/var/cache/tomcat/temp
04-Mar-2016 08:48:02.980 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/share/tomcat//conf/logging.properties
04-Mar-2016 08:48:02.981 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
04-Mar-2016 08:48:02.981 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
04-Mar-2016 08:48:03.688 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
04-Mar-2016 08:48:03.750 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
04-Mar-2016 08:48:03.757 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
04-Mar-2016 08:48:03.764 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
04-Mar-2016 08:48:03.765 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8443"]
04-Mar-2016 08:48:04.402 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
04-Mar-2016 08:48:04.403 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 3307 ms
04-Mar-2016 08:48:04.452 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
04-Mar-2016 08:48:04.452 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.32
04-Mar-2016 08:48:04.531 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /srv/tomcat/webapps/stig.war
04-Mar-2016 08:48:06.950 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/stig]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        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)
Caused by: java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
        at org.apache.catalina.core.StandardContext.findParameters(StandardContext.java:3585)
        at org.apache.catalina.core.StandardContext.mergeParameters(StandardContext.java:5409)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5238)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        ... 10 more

04-Mar-2016 08:48:06.955 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /srv/tomcat/webapps/stig.war
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/stig]]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        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)

04-Mar-2016 08:48:06.961 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /srv/tomcat/webapps/stig.war has finished in 2,428 ms
04-Mar-2016 08:48:06.963 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /srv/tomcat/webapps/ROOT
04-Mar-2016 08:48:08.233 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1830)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        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)
Caused by: java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
        at org.apache.catalina.core.StandardContext.findParameters(StandardContext.java:3585)
        at org.apache.catalina.core.StandardContext.mergeParameters(StandardContext.java:5409)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5238)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        ... 10 more

04-Mar-2016 08:48:08.234 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory /srv/tomcat/webapps/ROOT
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1830)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        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)

04-Mar-2016 08:48:08.236 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /srv/tomcat/webapps/ROOT has finished in 1,272 ms
04-Mar-2016 08:48:08.251 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
04-Mar-2016 08:48:08.270 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
04-Mar-2016 08:48:08.273 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8443"]
04-Mar-2016 08:48:08.276 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 3872 ms

4 个答案:

答案 0 :(得分:1)

您的计算机上是否安装了Java 8? 似乎tomcat 8正在寻找一种自Java 1.8

以来添加的ConcurrentHashMap方法

编辑:我现在看到你正在运行jvm 7.0,尝试使用8.0,它应该运行正常。

答案 1 :(得分:1)

这是由此异常引起的

Caused by: java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;

您应该尝试使用java 1.8而不是1.7。 ConcurrentHashMap的1.8版keyset()方法更改了返回类型http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html#keySet--

将其与1.7版本进行比较:http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html#keySet--)./ConcurrentHashMap.html#keySet%28%29

答案 2 :(得分:0)

Java 8 ConcurrentHashMap.keySet()返回KeySetView<K, V>,而在Java 7中它返回Set<K>(其中K映射一个键,V映射该值)。

只需运行Java 8,因为根本原因异常需要KeySetView

答案 3 :(得分:0)

对我来说,“tomcat 8.0.23”在JDK 1.8和1.7下运行良好。 似乎在最新版本“tomcat 8.0.32”中出现了这个问题。 正如建议尝试使用JDK 8.这应该有助于解决。

对于最新版本,这可能是Tomcat的文档错误;作为他们的在线setup page以及RUNNING.txt(可安装附带)提到它将与“1.7或更高”一起使用。在成功测试后,您可能想要指出它们。