在tomcat 7 web服务器中部署web应用程序时遇到问题。我尝试通过ant部署我的战争文件,但我得到了以下错误:
java.lang.NoClassDefFoundError: Could not initialize class java.nio.file.TempFileHelper
[java] at java.nio.file.Files.createTempFile(Unknown Source)
[java] at sun.net.www.protocol.jar.URLJarFile$1.run(Unknown Source)
[java] at sun.net.www.protocol.jar.URLJarFile$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
[java] at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
[java] at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
[java] at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
[java] at sun.net.www.protocol.jar.JarURLConnection.getJarFile(Unknown Source)
[java] at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:507)
[java] at org.apache.catalina.startup.TldConfig.access$100(TldConfig.java:59)
[java] at org.apache.catalina.startup.TldConfig$TldJarScannerCallback.scan(TldConfig.java:332)
[java] at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:234)
[java] at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:159)
[java] at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:306)
[java] at org.apache.catalina.startup.TldConfig.lifecycleEvent(TldConfig.java:585)
[java] at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
[java] at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
[java] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4974)
[java] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
[java] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
[java] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
[java] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
[java] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:925)
[java] at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:723)
[java] at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
[java] at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1343)
[java] at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:294)
[java] at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
[java] at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
[java] at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1235)
[java] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1393)
[java] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1403)
[java] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1382)
[java] at java.lang.Thread.run(Unknown Source)
web应用程序的文件夹是在我的tomcat webapps文件夹中创建的,但当尝试通过访问应用程序时
http://localhost:8080/Natura_WEB
我收到一个404错误,告诉我该应用程序不存在。
我还尝试通过tomcat管理器部署我的应用程序,它说应用程序部署正确,但它不在tomcat应用程序列表中,但文件夹也在webapps目录中创建,当我尝试在浏览器中访问时,我会遇到与以前相同的错误。
我知道这绝对是一个tomcat失败,因为我试图在另一台计算机上部署完全相同的war文件,它运行得很好。
关于如何解决这个问题,有什么建议吗?
它没有得到正确部署,因为它无法定位依赖关系jar。
它找不到这个类"java.nio.file.TempFileHelper"
试着找到那个类,找出哪个jar包含那个文件。
并将该jar放在WEB-INF/lib中,然后再次尝试部署。它应该起作用。