Encryption Bouncy castle没有这种方法错误
我正在尝试使用Bouncy Castle v1.53 PGP和PGPUtil类解密一个文件。 该程序在我的Eclipse中运行良好,但在集成到war文件并部署到weblogic服务器时出现以下错误。我使用以下依赖项: 1) bcpg-jdk15on 2) bcprov-jdk15on 错误Encryption Bouncy castle没有这种方法错误,encryption,bouncycastle,Encryption,Bouncycastle,我正在尝试使用Bouncy Castle v1.53 PGP和PGPUtil类解密一个文件。 该程序在我的Eclipse中运行良好,但在集成到war文件并部署到weblogic服务器时出现以下错误。我使用以下依赖项: 1) bcpg-jdk15on 2) bcprov-jdk15on 错误 java.lang.NoSuchMethodError: org.bouncycastle.util.Strings.newList()Lorg/bouncycastle/util/StringLis
java.lang.NoSuchMethodError:
org.bouncycastle.util.Strings.newList()Lorg/bouncycastle/util/StringList;
at org.bouncycastle.bcpg.ArmoredInputStream.<init>(Unknown Source)
at org.bouncycastle.bcpg.ArmoredInputStream.<init>(Unknown Source)
at org.bouncycastle.openpgp.PGPUtil.getDecoderStream(Unknown Source)`
通过改变他们的类名
但是,我想要一个更好的解决方案,因为我觉得这是一些Jar冲突
请告诉我,如果有人发现一个,可能会发生错误,因为您在运行Eclipse时使用的是一个版本的bouncycastle.jars,但在运行应用程序时Weblogic使用的类路径上有一个不同版本的.jars
您需要研究Weblogic如何准确地设置类路径,并确保所需的.jar版本在先前存在的版本之前就在类路径上(除非先前存在的版本错误地存在,在这种情况下,您可以从类路径中删除先前存在的版本).请提供一些代码…
布尔hasHeaders=true;字符串头=null;布尔newLineFound=false;布尔明文=假;布尔重启=假;StringList headerList=Strings.newList()//错误int lastC=0;布尔等内流;私有布尔parseHeaders()抛出IOException{header=null;int c;int last=0;boolean headerFound=false;headerList=Strings.newList();//如果(重新启动){headerFound=true;}否则{while((c=in.read())>=0){if(c='-'&&(last==0 | last='\n'| last='\r'){headerFound true;break;}last=c;}
此代码位于ArmoreInputStream类中。Strings和StringList这两个类都是Bouncy Castle的依赖项的一部分。请您提问,以包含具有适当格式的代码。此外,为什么要复制类?您应该在类路径中包含bouncycastle jar,并导入缺少的类。
org.bouncycastle.util.Strings
org.bouncycastle.util.StringList
org.bouncycastle.bcpg.ArmoredInputStream
org.bouncycastle.openpgp.PGPUtil`