前几天安装都是在官网下下载的最新的版本,jdk1.8+tomcat7.0.70,结果运行tomcat没有问题,但是打开IP:8080始终不能成功,查看tomcat的catalina日志发现开启tomcat服务的时候全是关于SHA-1
的错误,类似如下
java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
at java.security.SecureRandom.getInstance(SecureRandom.java:288)
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:147)
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:147)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5624)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
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(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)
google了一下SHA-1本来就是jdk1.8的库,讲道理jdk应该是向下兼容的。。可能是必须要匹配的版本,所以又去tomcat的网站上下载了8.5版本的tomcat,但是问题依然没有解决额。。
之前看到有人在tomcat的论坛上聊这个话题,当时是重新换了一个版本的jdk,本来还是想坚持最新版本的jdk的,结果今天我试了一下1.7版本的jdk就好了。。
但是我在windows下面是1.8.101版本的jdk和tomcat7.0/tomcat8.5都尝试了一下,没有任何问题。