博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java.io.IOException: invalid header field
阅读量:6511 次
发布时间:2019-06-24

本文共 4624 字,大约阅读时间需要 15 分钟。

Tomcat启动时出现以下错误:

24-May-2015 14:15:47.703 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:1101)    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)    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@3d7885d1]    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4845)    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4975)    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)    ... 10 moreCaused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@799fbbb4]    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 moreCaused 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 moreCaused 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.
(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 more24-May-2015 14:15:49.833 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory /opt/apache-tomcat-8.0.22/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:1101) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786) 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)24-May-2015 14:15:49.846 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/apache-tomcat-8.0.22/webapps/ROOT has finished in 169,297 ms24-May-2015 14:15:49.856 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]24-May-2015 14:15:49.892 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]24-May-2015 14:15:49.899 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 176092 ms

网上搜索发现都是在Jar打包时出现的错误,而我是Tomcat启动时出现的错误。

最终发现导致错误的原因是在对Jar包中的文件进行加密时,把”.class“扩展名之外的文件也给加密了。

如下图:

这里写图片描述

你可能感兴趣的文章