gpt4 book ai didi

java - JVM 错误? java.lang.VerifyError : Bad type on operand stack 错误

转载 作者:行者123 更新时间:2023-11-29 04:28:08 25 4
gpt4 key购买 nike

使用 org.apache.wss4j 工件来支持在 Play Framework(Java 版本)应用程序中调用的 SOAP 服务的 ws-security 部分导致了这个困惑:

java.util.concurrent.CompletionException: java.lang.RuntimeException: java.lang.VerifyError: Bad type on operand stackException Details:  Location:    org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator.validateSignedEncryptedPolicies(Ljava/util/List;Ljava/util/List;Ljava/util/List;Lorg/apache/cxf/message/Message;)Z @28: invokespecial  Reason:    Type 'org/apache/wss4j/policy/model/EncryptedParts' (current frame, stack[1]) is not assignable to 'org/apache/wss4j/policy/model/SignedParts'  Current Frame:    bci: @28    flags: { }    locals: { 'org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator', 'java/util/List', 'java/util/List', 'java/util/List', 'org/apache/cxf/message/Message' }    stack: { 'org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator', 'org/apache/wss4j/policy/model/EncryptedParts', integer, 'java/util/List', 'java/util/List', 'org/apache/cxf/message/Message' }  Bytecode:    0x0000000: 2a2a b400 2d03 2c2b 1904 b700 2e9a 0005    0x0000010: 03ac 2a2a b400 2f04 2d2b 1904 b700 2e9a    0x0000020: 0005 03ac 2a2a b400 3003 2c2b 1904 b700    0x0000030: 319a 0005 03ac 2a2a b400 3203 2d2b 1904    0x0000040: b700 31ac                                Stackmap Table:    same_frame(@18)    same_frame(@36)    same_frame(@54)        ... suppressed 8 linesCaused by: java.lang.RuntimeException: java.lang.VerifyError: Bad type on operand stackException Details:  Location:    org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator.validateSignedEncryptedPolicies(Ljava/util/List;Ljava/util/List;Ljava/util/List;Lorg/apache/cxf/message/Message;)Z @28: invokespecial  Reason:    Type 'org/apache/wss4j/policy/model/EncryptedParts' (current frame, stack[1]) is not assignable to 'org/apache/wss4j/policy/model/SignedParts'  Current Frame:    bci: @28    flags: { }    locals: { 'org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator', 'java/util/List', 'java/util/List', 'java/util/List', 'org/apache/cxf/message/Message' }    stack: { 'org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator', 'org/apache/wss4j/policy/model/EncryptedParts', integer, 'java/util/List', 'java/util/List', 'org/apache/cxf/message/Message' }  Bytecode:    0x0000000: 2a2a b400 2d03 2c2b 1904 b700 2e9a 0005    0x0000010: 03ac 2a2a b400 2f04 2d2b 1904 b700 2e9a    0x0000020: 0005 03ac 2a2a b400 3003 2c2b 1904 b700    0x0000030: 319a 0005 03ac 2a2a b400 3203 2d2b 1904    0x0000040: b700 31ac                                Stackmap Table:    same_frame(@18)    same_frame(@36)    same_frame(@54)        at ir.iais.playCommons.utils.F$Promise$1.get(F.java:232) ~[play-commons_2.11-2017.0.2.12-SNAPSHOT.jar:2017.0.2.12-SNAPSHOT]        ...         ... 5 moreCaused by: java.lang.VerifyError: Bad type on operand stackException Details:  Location:    org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator.validateSignedEncryptedPolicies(Ljava/util/List;Ljava/util/List;Ljava/util/List;Lorg/apache/cxf/message/Message;)Z @28: invokespecial  Reason:    Type 'org/apache/wss4j/policy/model/EncryptedParts' (current frame, stack[1]) is not assignable to 'org/apache/wss4j/policy/model/SignedParts'  Current Frame:    bci: @28    flags: { }    locals: { 'org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator', 'java/util/List', 'java/util/List', 'java/util/List', 'org/apache/cxf/message/Message' }    stack: { 'org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractSupportingTokenPolicyValidator', 'org/apache/wss4j/policy/model/EncryptedParts', integer, 'java/util/List', 'java/util/List', 'org/apache/cxf/message/Message' }  Bytecode:    0x0000000: 2a2a b400 2d03 2c2b 1904 b700 2e9a 0005    0x0000010: 03ac 2a2a b400 2f04 2d2b 1904 b700 2e9a    0x0000020: 0005 03ac 2a2a b400 3003 2c2b 1904 b700    0x0000030: 319a 0005 03ac 2a2a b400 3203 2d2b 1904    0x0000040: b700 31ac                                Stackmap Table:    same_frame(@18)    same_frame(@36)    same_frame(@54)        at org.apache.cxf.ws.security.wss4j.policyvalidators.ValidatorUtils.configureSupportingTokenValidators(ValidatorUtils.java:97) ~[cxf-rt-ws-security-3.1.7.jar:3.1.7]        at org.apache.cxf.ws.security.wss4j.policyvalidators.ValidatorUtils.(ValidatorUtils.java:46) ~[cxf-rt-ws-security-3.1.7.jar:3.1.7]        at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.doResults(PolicyBasedWSS4JInInterceptor.java:576) ~[cxf-rt-ws-security-3.1.7.jar:3.1.7]        at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessageInternal(WSS4JInInterceptor.java:277) ~[cxf-rt-ws-security-3.1.7.jar:3.1.7]        at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:171) ~[cxf-rt-ws-security-3.1.7.jar:3.1.7]        at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:80) ~[cxf-rt-ws-security-3.1.7.jar:3.1.7]        at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:66) ~[cxf-rt-ws-security-3.1.7.jar:3.1.7]        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670) ~[cxf-rt-transports-http-3.1.7.jar:3.1.7]        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551) ~[cxf-rt-transports-http-3.1.7.jar:3.1.7]        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348) ~[cxf-rt-transports-http-3.1.7.jar:3.1.7]        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651) ~[cxf-rt-transports-http-3.1.7.jar:3.1.7]        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277) ~[cxf-core-3.1.7.jar:3.1.7]        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) ~[cxf-rt-frontend-simple-3.1.7.jar:3.1.7]        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139) ~[cxf-rt-frontend-jaxws-3.1.7.jar:3.1.7]        at com.sun.proxy.$Proxy124.sendMessageToConsignee(Unknown Source) ~[?:?]        at ir.iais.rasam.services.AnnouncementAboutDeclarationService$1.get(AnnouncementAboutDeclarationService.java:61) ~[classes/:?]        at ir.iais.rasam.services.AnnouncementAboutDeclarationService$1.get(AnnouncementAboutDeclarationService.java:48) ~[classes/:?]        at ir.iais.playCommons.utils.F$Promise$1.get(F.java:230) ~[play-commons_2.11-2017.0.2.12-SNAPSHOT.jar:2017.0.2.12-SNAPSHOT]        ...         ... 5 more

The used modules of org.apache.wss4j artifacts are these:

"org.apache.wss4j" % "wss4j-bindings" % wss4jversion,
"org.apache.wss4j" % "wss4j-policy" % wss4jversion,
"org.apache.wss4j" % "wss4j-ws-security-dom" % wss4jversion,
"org.apache.wss4j" % "wss4j-ws-security-stax" % wss4jversion,
"org.apache.wss4j" % "wss4j-integration" % wss4jversion,
"org.apache.wss4j" % "wss4j-ws-security-policy-stax" % wss4jversion,
"org.apache.wss4j" % "wss4j-ws-security-common" % wss4jversion,

wss4jVersion 是:

val wss4jVersion = "2.1.10"

通过搜索这部分:Type ... (current frame, stack[1]) is not assignable to ... 我找到了 this page那说问题来自JVM。然而,这个 Q/A 是针对 2013 年的,到现在这个错误必须得到解决。

此外,如果我将 org.apache.wss4j 工件中的所有上述依赖项替换为以下工件:"org.apache.ws.security"% "wss4j"% "1.6.18 "(好吧就是降级包),问题解决,服务调用成功。

现在我的问题是:错误在哪里?在 JVM 或 WSS4J 或 Play Framework 中?

Play Framework 版本:2.5.8

Java 版本“1.8.0_121”

Java(TM) SE 运行时环境(构建 1.8.0_121-b13)

最佳答案

问题是Apache CXF Runtime与WSS4J版本不兼容导致的。

cxf-rt-ws-security 3.1.7 depends on wss4j-policy 2.1.7,但您使用的是wss4j-policy 2.1.10

字节码 validator 失败,因为 wss4j-policy 中的 EncryptedParts 类不能再分配给 SignedParts(尽管在早期版本中,这些类位于相同的层次结构)。

解决问题的方法有两种:

  • 将 Apache CXF Runtime 升级到 3.1.11 或更高版本;
  • 将 Apache WSS4J 降级到 2.1.7 或更低版本。

关于java - JVM 错误? java.lang.VerifyError : Bad type on operand stack 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45196794/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com