1

您好,当我尝试启动新安装的 tomcat 7 时,它无法启动并在 tomcat7-stderr.log 上记录错误,但出现以下异常:

SEVERE: Exception initializing random number generator using algorithm [SHA1PRNG] 
java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
    at java.security.SecureRandom.getInstance(SecureRandom.java:276)
    at org.apache.catalina.util.SessionIdGenerator.createSecureRandom(SessionIdGenerator.java:219)
    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:574)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:466)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5199)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    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:607)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1044)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:967)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1305)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    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.setStateInternal(LifecycleBase.java:379)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)

Apr 15, 2013 2:21:47 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
SEVERE: Exception initializing random number generator using algorithm [SHA1PRNG] 
java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
    at java.security.SecureRandom.getInstance(SecureRandom.java:276)
    at org.apache.catalina.util.SessionIdGenerator.createSecureRandom(SessionIdGenerator.java:233)
    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:574)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:466)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5199)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    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:607)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1044)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:967)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1305)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    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.setStateInternal(LifecycleBase.java:379)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)

java.lang.InternalError: internal error: SHA-1 not available.
    at sun.security.provider.SecureRandom.init(SecureRandom.java:105)
    at sun.security.provider.SecureRandom.<init>(SecureRandom.java:84)
    at java.security.SecureRandom.getDefaultPRNG(SecureRandom.java:191)
    at java.security.SecureRandom.<init>(SecureRandom.java:155)
    at org.apache.catalina.util.SessionIdGenerator.createSecureRandom(SessionIdGenerator.java:242)
    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:574)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:466)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5199)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    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:607)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1044)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:967)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1305)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    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.setStateInternal(LifecycleBase.java:379)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)

我试图寻找这个异常,但我无法理解它是什么,我试图重新安装 tomcat 但它仍然给我同样的错误。那么我应该怎么做才能启动我的tomcat?

更新我在 Windows 7 32 位机器上使用 jdk 1.7

4

2 回答 2

0

如果您使用的是 OpenJDK 1.6,请尝试更改为 Oracle 的 JDK。这可能会解决您的问题。

于 2013-04-15T12:39:37.257 回答
0

java.security.NoSuchAlgorithmException:SHA1PRNG SecureRandom 不可用

可以通过在 java 的 security 文件夹下添加正确的策略和安全文件来解决此问题

于 2018-10-10T14:26:41.103 回答