我无法在tomcat上部署war文件。
我在我的Windows机器上用netbeans写了一个webapp。一切都运行良好。我想要做的是在我的Linux计算机上部署应用程序,该计算机充当我的服务器。构建应用程序后,我将war文件从项目目录中的dist文件夹复制到pendrive上。然后我将其复制到我的linux计算机的桌面上。
然后我启动tomcat并使用应用程序管理器浏览war文件进行部署,然后单击deploy。我在浏览器顶部收到一条消息,说“OK”。但是,如果我在终端窗口中查看我的tomcat输出,则会出现以下错误:4/01/2011 5:09:07 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive Kingdoms.war
4/01/2011 5:09:07 PM org.apache.catalina.startup.ContextConfig init
SEVERE: Exception fixing docBase for context [/Kingdoms]
java.util.zip.ZipException: invalid CEN header (bad signature)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:72)
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:72)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:48)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:70)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:71)
at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:111)
at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:706)
at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:829)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:334)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:328)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:308)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:131)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:570)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:891)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1322)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1467)
at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:332)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:209)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:561)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:237)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
4/01/2011 5:09:07 PM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Invalid or unreadable WAR file : invalid CEN header (bad signature)
at org.apache.naming.resources.WARDirContext.setDocBase(WARDirContext.java:142)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4657)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4815)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:570)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:891)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1322)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1467)
at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:332)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:209)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:561)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:237)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
4/01/2011 5:09:07 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error in resourceStart()
4/01/2011 5:09:07 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
4/01/2011 5:09:07 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Kingdoms] startup failed due to previous errors
我现在可以在应用程序列表中查看我的应用程序。我在应用程序的命令中单击开始,但在屏幕顶部显示“FAIL - 上下文路径中的应用程序/王国无法启动”的消息
我在做错了什么?如何解决这个问题?答案 0 :(得分:14)
战争档案已损坏或无效。
检查战争生成过程是否失败,并且在复制到您的笔式驱动器之前,war文件是有效的zip文件。
如果你在Windows上,可以通过将文件扩展名更改为.zip并使用zip程序(如winzip或winrar)打开来实现此目的。
如果您使用的是其他操作系统,则可能无需更改扩展名。
如果战争是一个有效的拉链,它可能因你的转移过程而被破坏,即进入或离开你的笔式驱动器。
答案 1 :(得分:10)
这可能是由于以下原因之一。
答案 2 :(得分:10)
这可能是文件保护问题,您可以通过发布以下内容来修复: chmod 755 webapp.war
我发现我的sftp只会在传输的文件上打了700,导致错误。
答案 3 :(得分:2)
有相同的错误 - 战争一切正常,重启Tomcat解决问题 所以我认为这是因为Tomcat在完全上传之前开始部署战争
答案 4 :(得分:1)
我遇到了同样的问题,重建/上传战争并没有解决问题。我最终要做的就是用不同的名字上传战争,然后在战争成功部署后重命名战争。这有点奇怪,但这对我来说比重启tomcat更好。
答案 5 :(得分:1)
首先要检查的是你的磁盘上是否有可用空间。如果您的分区是100%已满,则无法提取.WAR文件。
答案 6 :(得分:0)
也可能是因为solr.xml中的条目不正确 它必须指向.war文件所在的位置。
答案 7 :(得分:0)
还要注意已部署的.war文件的文件权限。对我来说就是原因。
答案 8 :(得分:0)
就我而言,它是清单文件。
Class-Path:
后面应该有一个空格。