为什么我在调用CryptoFactory.getInstance()方法时收到错误'java.lang.NoSuchMethodError:org.apache.xml.security.utils.I18n.init'?

时间:2015-08-06 19:12:51

标签: java wss4j

我正在使用wss4j 2.1.2版进行xml数字签名并附加到soap标头。

我有以下代码,我得到一个方法不存在的错误......但确实存在。在IntelliJ中,我可以导航到该位置,方法就在那里,但由于某种原因它找不到它: java.lang.NoSuchMethodError:org.apache.xml.security.utils.I18n.init

public void initSettings() {   
    try {
        crypto =  CryptoFactory.getInstance();
    } catch (WSSecurityException e) {
        e.printStackTrace();
    }
}

根据要求,这是完整的错误堆栈跟踪:

    at com.pilotfish.eip.modules.http.ws2.WSSecurityProcessor2.processData(WSSecurityProcessor2.java:182)
    at com.pilotfish.eip.transact.stages.ProcessorStage.process(ProcessorStage.java:44)
    at com.pilotfish.eip.transact.StageHandler.process(StageHandler.java:99)
    at com.pilotfish.eip.transact.Transaction.runStage(Transaction.java:117)
    at com.pilotfish.eip.transact.Transaction.flushQueue(Transaction.java:89)
    at com.pilotfish.eip.transact.Transaction.run(Transaction.java:78)
    at com.pilotfish.eip.gui.console.testing.TestingManager$TestingTransactionFramework$1.run(TestingManager.java:663)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.xml.security.utils.I18n.init(Ljava/util/ResourceBundle;)V
    at org.apache.wss4j.common.crypto.WSProviderConfig.initializeResourceBundles(WSProviderConfig.java:199)
    at org.apache.wss4j.common.crypto.WSProviderConfig.init(WSProviderConfig.java:65)
    at org.apache.wss4j.common.crypto.CryptoFactory.<clinit>(CryptoFactory.java:39)
    at com.pilotfish.eip.modules.http.ws2.WSSecurityProcessor2.initSettings(WSSecurityProcessor2.java:140)
    at com.pilotfish.eip.modules.http.ws2.WSSecurityProcessor2.processData(WSSecurityProcessor2.java:155)
    ... 7 more

我正在看到这一点,这可能会解决问题所在:

文件:WSProviderConfig.java

private static void initializeResourceBundles() {
    I18n.init(new WSS4JResourceBundle());
}

但它期待String,String而不是WSS4JResourceBundle()。

0 个答案:

没有答案