java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available
阿新 • • 發佈:2017-08-05
util ots key ssi mes clip 項目 esc fire
q好久沒有使用MyEclipse10了,今天打開看了以前大學的項目,在Tomcat7中發布啟動,我嚓嘞,報錯:
SEVERE: Exception initializing random number generator using algorithm [SHA1PRNG] java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available at sun.security.jca.GetInstance.getInstance(Unknown Source) at java.security.SecureRandom.getInstance(Unknown Source) at org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom(SessionIdGeneratorBase.java:210) at org.apache.catalina.util.SessionIdGeneratorBase.getRandomBytes(SessionIdGeneratorBase.java:174) at org.apache.catalina.util.StandardSessionIdGenerator.generateSessionId(StandardSessionIdGenerator.java:34) at org.apache.catalina.util.SessionIdGeneratorBase.generateSessionId(SessionIdGeneratorBase.java:167) at org.apache.catalina.util.SessionIdGeneratorBase.startInternal(SessionIdGeneratorBase.java:256) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.session.ManagerBase.startInternal(ManagerBase.java:714) at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:461) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5643) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
看到這個錯誤,一頭霧水,從來沒有見過這個錯誤,以為是tomcat7的緣故,又換位tomcat6,發布啟動之後,我叉,有出現錯誤:
SEVERE: Cannot find message associated with key managerBase.digest java.security.NoSuchAlgorithmException: MD5 MessageDigest not available at sun.security.jca.GetInstance.getInstance(Unknown Source) at java.security.Security.getImpl(Unknown Source) at java.security.MessageDigest.getInstance(Unknown Source) at org.apache.catalina.session.ManagerBase.getDigest(ManagerBase.java:478) at org.apache.catalina.session.ManagerBase.generateSessionId(ManagerBase.java:1220) at org.apache.catalina.session.StandardManager.start(StandardManager.java:636) at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:448) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4665) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:803) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:780) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:676) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:602) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:503) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:325) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1069) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:759) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
然後,幹脆就去掉項目,單獨的啟動tomcat6 和 tomcat7,我叉,還是一樣的錯誤,這說明 原來的項目是沒有問題的,那就是 MyEclipse10 和 tomcat的原因了。
因為tomcat6和tomcat7 依賴的是 JDK7,所以報了這個錯,原因還不清楚,但是在eclipse中 tomcat6 和 tomcat7 是可以使用JDK7的。於是,把tomcat6 和 tomcat7 依賴的JDK7換為 MyEclipse10自帶的JDK6,重新啟動tomcat,我叉,真的就沒有問題了。
java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available