码迷,mamicode.com
首页 > Web开发 > 详细

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Standard

时间:2015-05-22 19:11:24      阅读:431      评论:0      收藏:0      [点我收藏+]

标签:setting   加密   component   start   启动   

在对类文件加密了之后,Tomcat启动时输出如下错误提示:

22-May-2015 18:18:07.354 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property ‘maxSpareThreads‘ to ‘1000‘ did not find a matching property.
22-May-2015 18:18:07.362 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property ‘minProcessors‘ to ‘100‘ did not find a matching property.
22-May-2015 18:18:07.363 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property ‘maxProcessors‘ to ‘1000‘ did not find a matching property.
22-May-2015 18:18:07.494 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.21
22-May-2015 18:18:07.497 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 23 2015 14:11:21 UTC
22-May-2015 18:18:07.498 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.21.0
22-May-2015 18:18:07.498 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
22-May-2015 18:18:07.499 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            2.6.32-431.el6.x86_64
22-May-2015 18:18:07.499 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
22-May-2015 18:18:07.499 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.8.0_45/jre
22-May-2015 18:18:07.500 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_45-b14
22-May-2015 18:18:07.501 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
22-May-2015 18:18:07.502 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/apache-tomcat-8.0.21
22-May-2015 18:18:07.502 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/apache-tomcat-8.0.21
22-May-2015 18:18:07.503 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/apache-tomcat-8.0.21/conf/logging.properties
22-May-2015 18:18:07.506 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
22-May-2015 18:18:07.506 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/opt/apache-tomcat-8.0.21/endorsed
22-May-2015 18:18:07.507 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/apache-tomcat-8.0.21
22-May-2015 18:18:07.507 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/apache-tomcat-8.0.21
22-May-2015 18:18:07.507 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/apache-tomcat-8.0.21/temp
22-May-2015 18:18:07.508 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
22-May-2015 18:18:07.853 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]
22-May-2015 18:18:07.908 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-May-2015 18:18:07.918 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
22-May-2015 18:18:07.920 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-May-2015 18:18:07.923 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1452 ms
22-May-2015 18:18:07.978 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
22-May-2015 18:18:07.978 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.21
22-May-2015 18:18:08.003 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/apache-tomcat-8.0.21/webapps/ROOT
22-May-2015 18:18:08.510 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:154)
    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:1096)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1756)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    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 [org.apache.catalina.webresources.StandardRoot@2ec73649]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4844)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4974)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@2b61d018]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:699)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 13 more
Caused by: java.lang.IllegalArgumentException: java.io.IOException: invalid header field
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:96)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 16 more
Caused by: java.io.IOException: invalid header field
    at java.util.jar.Attributes.read(Attributes.java:406)
    at java.util.jar.Manifest.read(Manifest.java:199)
    at java.util.jar.Manifest.<init>(Manifest.java:69)
    at java.util.jar.JarFile.getManifestFromReference(JarFile.java:194)
    at java.util.jar.JarFile.getManifest(JarFile.java:180)
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:94)
    ... 17 more

22-May-2015 18:18:08.516 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory /opt/apache-tomcat-8.0.21/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:728)
    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:1096)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1756)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    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)

22-May-2015 18:18:08.518 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/apache-tomcat-8.0.21/webapps/ROOT has finished in 514 ms
22-May-2015 18:18:08.525 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
22-May-2015 18:18:08.538 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
22-May-2015 18:18:08.540 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 616 ms

这需要修改 Tomcat/lib/catalina.jar 中的 WebappClassLoader 类:

package org.apache.catalina.loader;

import org.apache.catalina.LifecycleException;

public class WebappClassLoader extends WebappClassLoaderBase
{
  public WebappClassLoader()
  {
  }

  public WebappClassLoader(ClassLoader parent)
  {
    super(parent);
  }

  public WebappClassLoader copyWithoutTransformers()
  {
    WebappClassLoader result = new WebappClassLoader(getParent());

    super.copyStateWithoutTransformers(result);
    try
    {
      result.start();
    } catch (LifecycleException e) {
      throw new IllegalStateException(e);
    }

    return result;
  }

  protected Object getClassLoadingLock(String className)
  {
    return this;
  }
}

或者自己重写一个类来处理加密的类的加载问题。

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Standard

标签:setting   加密   component   start   启动   

原文地址:http://blog.csdn.net/testcs_dn/article/details/45920275

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!