java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available

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,我叉,真的就没有问题了。

时间: 2024-10-11 12:37:27

java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available的相关文章

java.security.NoSuchAlgorithmException: Cannot find any provider supporting DESede/CBC/PKCS5Padding

最近在做3DES加密,在本地window下面运行ok的程序,放到linux环境上竟然报错: at javax.crypto.Cipher.getInstance(Cipher.java:524) at com.haha.encrypt.ThreeDES.encryptMode(ThreeDES.java:30) at com.haha.encrypt.ThreeDES.encryptString(ThreeDES.java:101) at com.haha.mina.MinaServerHand

java.security.NoSuchAlgorithmException: AES KeyGenerator not available

异常信息 Caused by: Java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:59) at org.apache.shiro.crypt

Java Security:Java加密框架(JCA)简要说明

加密服务总是关联到一个特定的算法或类型,它既提供了密码操作(如Digital Signature或MessageDigest),生成或供应所需的加密材料(Key或Parameters)加密操作,也会以一个安全的方式生成数据对象(KeyStore或Certificate),封装(压缩)密钥(可以用于加密操作). Java Security API中,一个engine class就是定义了一种加密服务,不同的engine class提供不同的服务.下面就来看看有哪些engine class: 1)M

andorid HTTPS 不需要证书 VolleyEror: com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not fou

1.加证书(这里不说) 2.修改代码 import java.security.KeyManagementException;import java.security.NoSuchAlgorithmException;import java.security.SecureRandom;import java.security.cert.X509Certificate;import javax.net.ssl.HostnameVerifier;import javax.net.ssl.HttpsU

Java security MD5加密算法

利用java.security对字符串进行MD5加密: 1 import java.security.MessageDigest; 2 import java.security.NoSuchAlgorithmException; 3 4 public class MD5 { 5 public static final String MD5CODE = ""; 6 7 private static MessageDigest messageDigest = null; 8 9 publi

利用Java自带的MD5加密java.security.MessageDigest;

MD5加密算法,即"Message-Digest Algorithm 5(信息-摘要算法)",它由MD2.MD3.MD4发展而来的一种单向函数算法(也就是HASH算法),它是国际著名的公钥加密算法标准RSA的第一设计者R.Rivest于上个世纪90年代初开发出来的.MD5的最大作用在于,将不同格式的大容量文件信息在用数字签名软件来签署私人密钥前"压缩"成一种保密的格式,关键之处在于——这种"压缩"是不可逆的. Java JDK已经自带了MD5的实

java.security 生成MD5

package com.tylor.util; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * @author tylor * 2017年8月23日 */ public class Md5Util { public static String getMD5(String str) { try { // 生成一个

Java加密工具类(依赖:java.security.MessageDigest或org.apache.commons.codec.digest.DigestUtils)

依赖于java.security.MessageDigest,支持MD5,SHA-1,SHA-256 1 import java.security.MessageDigest; 2 import java.security.NoSuchAlgorithmException; 3 4 /** 5 * CiphertextUtil 6 * 7 * @author ysj 8 */ 9 public class CiphertextUtil { 10 public static final Strin

jdk java.security.SecureRandom 性能问题

SecureRandom在java各种组件中使用广泛,可以可靠的产生随机数.但在大量产生随机数的场景下,性能会较低.这时可以使用"-Djava.security.egd=file:/dev/./urandom"加快随机数产生过程. 以产生uuid的时候使用nextBytes产生随机数为入口,我们看一下SecureRandom的代码逻辑. public static UUID randomUUID() { SecureRandom ng =Holder.numberGenerator;