我正在使用Amazon ec2实例上的Spring TC(tomcat-7.0.55)运行Web应用程序。我可以从ec2实例手动启动服务器,服务器运行正常。但是当我从Jenkins构建启动服务器时,我得到了 “java.security.PrivilegedActionException:sun.nio.fs.UnixException:没有这样的文件或目录”,服务器没有启动。
任何人都可以帮我解决这个问题。
完整堆栈跟踪:'
org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.session.StandardManager[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5499)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)
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: java.lang.ExceptionInInitializerError
at java.nio.file.FileSystems.getDefault(FileSystems.java:176)
at java.io.File.toPath(File.java:2234)
at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:190)
at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:168)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.provider.SeedGenerator.getSystemEntropy(SeedGenerator.java:168)
at sun.security.provider.SecureRandom$SeederHolder.<clinit>(SecureRandom.java:201)
at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:221)
at java.security.SecureRandom.nextBytes(SecureRandom.java:468)
at java.security.SecureRandom.next(SecureRandom.java:491)
at java.util.Random.nextInt(Random.java:329)
at org.apache.catalina.util.SessionIdGenerator.createSecureRandom(SessionIdGenerator.java:246)
at org.apache.catalina.util.SessionIdGenerator.getRandomBytes(SessionIdGenerator.java:183)
at org.apache.catalina.util.SessionIdGenerator.generateSessionId(SessionIdGenerator.java:153)
at org.apache.catalina.session.ManagerBase.startInternal(ManagerBase.java:573)
at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 12 more
Caused by: java.security.PrivilegedActionException: sun.nio.fs.UnixException: No such file or directory
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.file.FileSystems$DefaultFileSystemHolder.defaultFileSystem(FileSystems.java:96)
at java.nio.file.FileSystems$DefaultFileSystemHolder.<clinit>(FileSystems.java:90)
... 29 more
Caused by: sun.nio.fs.UnixException: No such file or directory
at sun.nio.fs.UnixNativeDispatcher.getcwd(Native Method)
at sun.nio.fs.UnixFileSystem.<init>(UnixFileSystem.java:67)
at sun.nio.fs.LinuxFileSystem.<init>(LinuxFileSystem.java:39)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(LinuxFileSystemProvider.java:46)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(LinuxFileSystemProvider.java:39)
at sun.nio.fs.UnixFileSystemProvider.<init>(UnixFileSystemProvider.java:56)
at sun.nio.fs.LinuxFileSystemProvider.<init>(LinuxFileSystemProvider.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at sun.nio.fs.DefaultFileSystemProvider.createProvider(DefaultFileSystemProvider.java:48)
at sun.nio.fs.DefaultFileSystemProvider.create(DefaultFileSystemProvider.java:63)
at java.nio.file.FileSystems$DefaultFileSystemHolder.getDefaultProvider(FileSystems.java:108)
答案 0 :(得分:1)
刚刚解决了同样的问题。
引起:sun.nio.fs.UnixException:没有这样的文件或目录 at sun.nio.fs.UnixNativeDispatcher.getcwd(Native Method)
此异常意味着尝试获取当前工作目录,但该目录已经消失。
您可能删除了已启动tomcat的目录。