弹性城堡没有这种方法的错误 [英] Bouncy castle no such method error

查看:913
本文介绍了弹性城堡没有这种方法的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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 / StringList;
在org.bouncycastle.bcpg.ArmoredInputStream。< init>(未知来源)
在org.bouncycastle.bcpg.ArmoredInputStream。< init>(未知来源)
在org.bouncycastle .openpgp.PGPUtil.getDecoderStream(未知来源)`

分辨率 p>

当我将以下课程复制到我的源文件夹中时,此问题已解决:

  org.bouncycastle.util.Strings 
org.bouncycastle.util.StringList
org.bouncycastle.bcpg.ArmoredInputStream
org.bouncycastle.openpgp.PGPUtil`

通过更改他们的类名称



但是,我想要一个更好的修复这个,因为我觉得这是一些Jar Conflict
请让我知道,如果有人发现一个

解决方案

p>该错误可能发生,因为您使用一个版本的bouncycastle .jars,当您运行Eclipse,但有一个不同的版本其中一个.jars是Weblogic在运行应用程序时使用的类路径。



您将需要调查Weblogic如何设置类路径,并使确保您需要的.jars的版本在预先存在的版本之前的类路径上(除非预先存在的版本是错误的,在这种情况下,您可以从类路径中删除预先存在的版本)。


I'm trying to decrypt a file using Bouncy Castle v1.53 PGP and Using PGPUtil class. The program works fine in my Eclipse, but given following error when integrated inside a war file and deployed onto a weblogic server.I'm using following dependencies: 1)bcpg-jdk15on 2)bcprov-jdk15on

Error

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)`

Resolution

This problem is resolved when I copied following classes into my source folder:

org.bouncycastle.util.Strings  
org.bouncycastle.util.StringList  
org.bouncycastle.bcpg.ArmoredInputStream  
org.bouncycastle.openpgp.PGPUtil`

by changing their Class Names

However, I want a better fix than this as I feel this is some Jar Conflict Please let me know if anyone finds one

解决方案

That error is likely happening because you are using one version of the bouncycastle .jars when you run with Eclipse, but there is a different version of one of those .jars which is on the classpath that Weblogic is using when running your application.

You will need to investigate how exactly Weblogic sets up the classpath, and make sure the version of the .jars you need are on the classpath before the preexisting version (unless that preexisting version is there by mistake, in which case you can just remove the preexisting one from the classpath).

这篇关于弹性城堡没有这种方法的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆