简体   繁体   English

Java Metro安全性:StreamMessage已被使用

[英]Java Metro Security: StreamMessage has been already consumed

I'm using metro 2.0.1 for a client application who connects to WCF Service With security. 我正在将Metro 2.0.1用于具有安全性连接到WCF服务的客户端应用程序。 Everything works fine in my unit tests but when I call the method in my Java application I get the following exception: 在单元测试中一切正常,但是当我在Java应用程序中调用方法时,出现以下异常:

Exception in thread "main" java.lang.AssertionError: StreamMessage has been already consumed. See the nested exception for where it's consumed
 at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.unconsumed(VerifiedStreamMessage.java:512)
 at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.readPayloadAsJAXB(VerifiedStreamMessage.java:251)
 at com.sun.xml.ws.fault.SOAPFaultBuilder.create(SOAPFaultBuilder.java:536)
 at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:118)
 at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
 at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:140)
 at $Proxy42.getGiftvoucherBalance(Unknown Source)
 at com.rs.sw.fs.service.jaxws.account.card.JaxWsGiftVoucherService.getBalance(JaxWsGiftVoucherService.java:245)
 at com.rs.sw.fs.application.SkyllaApplication.main(SkyllaApplication.java:119)
Caused by: java.lang.Exception
 at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.unconsumed(VerifiedStreamMessage.java:516)
 at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.writePayloadTo(VerifiedStreamMessage.java:375)
 at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.writeTo(VerifiedStreamMessage.java:493)
 at com.sun.xml.ws.message.AbstractMessageImpl.readAsSOAPMessage(AbstractMessageImpl.java:193)
 at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.readAsSOAPMessage(VerifiedStreamMessage.java:474)
 at com.sun.xml.wss.jaxws.impl.PolicyResolverImpl.resolvePolicy(PolicyResolverImpl.java:151)
 at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.createMessage(SecurityRecipient.java:894)
 at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.validateMessage(SecurityRecipient.java:232)
 at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.verifyInboundMessage(SecurityTubeBase.java:486)
 at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientResponsePacket(SecurityClientTube.java:405)
 at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processResponse(SecurityClientTube.java:338)
 at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:639)
 at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
 at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
 at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
 at com.sun.xml.ws.client.Stub.process(Stub.java:319)
 at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:157)
 at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
 ... 5 more

I guess there's a difference between my classpath in junit and my Java application (running eclipse and maven) 我猜junit中的类路径和Java应用程序(运行eclipse和maven)之间存在差异

In case someone is interested here's our huge dependency tree: 如果有人感兴趣,这是我们巨大的依赖树:

[INFO] [dependency:tree]
[INFO] eres.fs:fs-std:jar:3.0.0.0-SNAPSHOT
[INFO] +- eres.fs:fs-core:jar:3.5.0-SNAPSHOT:compile
[INFO] |  +- org.beanshell:bsh-core:jar:1.2b7:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.1:compile
[INFO] |  +- commons-dbcp:commons-dbcp:jar:1.2.1:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.4:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.0.4:compile
[INFO] |  +- commons-pool:commons-pool:jar:1.2:compile
[INFO] |  +- net.sf.ehcache:ehcache-core:jar:1.7.2:compile
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] |  +- jgoodies:forms:jar:1.0.5:compile
[INFO] |  +- jdom:jdom:jar:1.0:compile
[INFO] |  +- javax.transaction:jta:jar:1.0.1B:compile
[INFO] |  +- postgresql:postgresql:jar:8.1-407.jdbc3:compile
[INFO] |  +- org.springframework:spring-aop:jar:2.0.8:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-beans:jar:2.0.8:compile
[INFO] |  +- org.springframework:spring-context:jar:2.0.8:compile
[INFO] |  +- org.springframework:spring-core:jar:2.0.8:compile
[INFO] |  +- org.springframework:spring-dao:jar:2.0.8:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:2.0.8:compile
[INFO] |  +- org.springframework:spring-remoting:jar:2.0.8:compile
[INFO] |  +- org.springframework:spring-web:jar:2.0.8:compile
[INFO] |  +- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] |  +- xerces:xercesImpl:jar:2.7.1:compile
[INFO] |  +- com.thoughtworks.xstream:xstream:jar:1.2.2:compile
[INFO] |  |  \- xpp3:xpp3_min:jar:1.1.3.4.O:compile
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.11:compile
[INFO] |  +- org.mortbay.jetty:jetty-util:jar:6.1.11:compile
[INFO] |  +- org.mortbay.jetty:servlet-api-2.5:jar:6.1.11:compile
[INFO] |  +- xmlbeans:xbean:jar:2.2.0:compile
[INFO] |  +- org.apache.xbean:xbean-spring:jar:2.8:compile
[INFO] |  +- org.codehaus.xfire:xfire-aegis:jar:1.2.5:compile
[INFO] |  |  \- net.java.dev.stax-utils:stax-utils:jar:20040917:compile
[INFO] |  +- org.codehaus.xfire:xfire-java5:jar:1.2.5:compile
[INFO] |  +- org.codehaus.xfire:xfire-spring:jar:1.2.5:compile
[INFO] |  |  \- junit:junit:jar:3.8.1:test
[INFO] |  +- org.codehaus.xfire:xfire-core:jar:1.2.5:compile
[INFO] |  |  +- javax.mail:mail:jar:1.4:compile
[INFO] |  |  +- jaxen:jaxen:jar:1.1-beta-9:compile
[INFO] |  |  |  \- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] |  |  +- stax:stax-api:jar:1.0.1:compile (version managed from 1.0)
[INFO] |  |  +- commons-codec:commons-codec:jar:1.2:compile (version managed from 1.3)
[INFO] |  |  +- org.codehaus.woodstox:wstx-asl:jar:3.2.0:compile
[INFO] |  |  \- commons-httpclient:commons-httpclient:jar:3.0:compile
[INFO] |  +- org.codehaus.xfire:xfire-xmlbeans:jar:1.2.5:compile
[INFO] |  +- org.apache.ws.commons:XmlSchema:jar:1.1:compile
[INFO] |  +- javax.activation:activation:jar:1.1:compile
[INFO] |  +- eres.commons:barcode:jar:3.2.1:compile
[INFO] |  |  \- com.lowagie:itext:jar:1.3.1:compile
[INFO] |  +- eres.commons:djester:jar:3.0.1:compile
[INFO] |  +- eres.commons:I18N:jar:3.0.0:compile
[INFO] |  +- eres.commons:log:jar:3.2.0:compile
[INFO] |  +- eres.commons:util:jar:3.3.0-SNAPSHOT:compile
[INFO] |  |  \- jclark:xt:jar:20020507:compile
[INFO] |  |     \- jclark:xp:jar:19990102:compile
[INFO] |  +- eres.commons:reporting:jar:3.1.0-SNAPSHOT:compile
[INFO] |  |  \- jasperreports:jasperreports:jar:3.1.2:compile
[INFO] |  |     +- commons-digester:commons-digester:jar:1.7:compile
[INFO] |  |     +- jfree:jcommon:jar:1.0.12:compile
[INFO] |  |     +- jfree:jfreechart:jar:1.0.9:compile
[INFO] |  |     \- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] |  +- eres.commons:set-expressions:jar:1.0.0:compile
[INFO] |  +- eres.fs:fs-ebo-dao:jar:3.2.2:compile
[INFO] |  +- eres.fs:skylla-theme:jar:3.2.0:compile
[INFO] |  +- eres.fs:fashion-theme:jar:3.2.0:compile
[INFO] |  +- eres.javapos:jpos-core:jar:3.3.0-SNAPSHOT:compile
[INFO] |  |  +- com.linuxnet:jpcsc:jar:0.7.2:compile
[INFO] |  |  +- gnu.io:RXTXcomm:jar:2.1.7:compile
[INFO] |  |  +- com.serialio:Serialio:jar:6.1:compile
[INFO] |  |  +- com.javapos:jpos:jar:1.13.0:compile
[INFO] |  |  |  \- xalan:xalan:jar:2.6.0:test (scope managed from compile)
[INFO] |  |  +- com.javapos:jcl_editor:jar:2.2.0:runtime
[INFO] |  |  +- com.javapos:POSTest:jar:1.7.0:runtime
[INFO] |  |  +- com.sun.comm:comm:jar:2.0.0:compile
[INFO] |  |  +- com.serialio:JavaTerm:jar:5.4:runtime
[INFO] |  |  +- com.retail-logic:SolveLink:jar:1.3.0.0:compile
[INFO] |  |  \- jp.co.nec.jpos:tw5500jpos:jar:1.0.3:compile
[INFO] |  +- eres.messagebus:ebo-javaobject:jar:3.2.2:compile
[INFO] |  |  +- eres.messagebus:ebo-javaobjectAPIs:jar:3.2.2:compile
[INFO] |  |  +- org.jibx:jibx-run:jar:1.1.6.2:compile
[INFO] |  |  +- aspectj:aspectjrt:jar:1.5.3:compile
[INFO] |  |  \- joda-time:joda-time:jar:1.2.1:compile
[INFO] |  +- eres.messagebus:gateway:jar:4.0.2.0.2:compile
[INFO] |  |  +- sonic:sonic_Crypto:jar:6.1:runtime
[INFO] |  |  +- sonic:sonic_Selector:jar:6.1:runtime
[INFO] |  |  +- sonic:sonic_Client:jar:6.1:compile
[INFO] |  |  +- sonic:sonic_SF:jar:6.1:runtime
[INFO] |  |  +- commons-io:commons-io:jar:1.4:compile
[INFO] |  |  \- gnu:gnu-regexp:jar:1.0.6:compile
[INFO] |  +- eres.messagebus:jebo-listener:jar:3.2.2:compile
[INFO] |  |  +- eres.messagebus:ebo-marshaller:jar:3.2.2:compile
[INFO] |  |  \- eres.messagebus:ebo-jibx-marshaller:jar:3.2.2:compile
[INFO] |  +- eres.services:services-client:jar:3.2.0:compile
[INFO] |  +- eres.services:waitticket-service:jar:3.2.1-SNAPSHOT:compile
[INFO] |  +- net.sourceforge.jtds:jtds:jar:1.2:compile
[INFO] |  +- eres.fs:remote-control:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  \- com.sun.xml.ws:webservices-rt:jar:2.0.1:compile
[INFO] |  |     \- javax.xml:webservices-api:jar:2.0.1:compile
[INFO] |  +- eres.services:customer-service-client:jar:3.3.0-SNAPSHOT:compile
[INFO] |  |  \- eres.services:service-client-commons:jar:3.3.0-SNAPSHOT:compile
[INFO] |  +- eres.services:loyalty-service-client:jar:3.2.0:compile
[INFO] |  +- eres.services:notification-service-client:jar:3.3.0-SNAPSHOT:compile
[INFO] |  +- eres.fs.promopack:promopackAPIs:jar:3.2.0:compile
[INFO] |  +- com.rs.sw.commons:commons-util:jar:3.0.0-SNAPSHOT:compile
[INFO] |  +- com.rs.sw.fs.framework.domain:fs-domain-core:jar:3.0.0-SNAPSHOT:compile
[INFO] |  +- com.rs.sw.fs.framework.domain:fs-domain-article:jar:3.0.0-SNAPSHOT:compile
[INFO] |  +- com.rs.sw.fs.framework.domain:fs-domain-account:jar:3.0.0-SNAPSHOT:compile
[INFO] |  +- com.rs.sw.fs.framework.repository:fs-repository-core:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  +- com.rs.sw.fs.framework.data:fs-data-api:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  \- org.slf4j:slf4j-log4j12:jar:1.5.8:compile
[INFO] |  +- com.rs.sw.fs.framework.repository:fs-repository-skylla:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  +- com.rs.sw.fs.framework.data:fs-data-jdbc:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  +- com.rs.sw.fs.framework.data:fs-data-service:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  +- com.rs.sw.fs.framework.domain:fs-domain-service:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  +- com.rs.sw.fs.framework.service:fs-service-api:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |  \- com.rs.sw.fs.framework:fs-test:jar:3.0.0-SNAPSHOT:compile
[INFO] |  |     +- dbunit:dbunit:jar:2.1:test (scope managed from compile)
[INFO] |  |     \- com.rs.sw.commons:commons-test:jar:3.0.0-SNAPSHOT:test (scope managed from compile)
[INFO] |  +- com.rs.sw.fs.framework:fs-view:jar:3.0.0-SNAPSHOT:compile
[INFO] |  +- com.rs.sw.fs.framework.data:fs-data-gateway:jar:3.0.0-SNAPSHOT:compile
[INFO] |  \- com.rs.sw.fs.framework.service:fs-service-jaxws:jar:3.0.0-SNAPSHOT:compile
[INFO] |     +- com.rs.sw.fs.framework.service:fs-service-jaxws-giftvoucher:jar:3.0.0-SNAPSHOT:compile
[INFO] |     \- com.rs.sw.commons:commons-jaxws:jar:3.0.0-SNAPSHOT:compile
[INFO] \- eres.commons:launcher:jar:1.0.1:compile
[INFO]    +- log4j:log4j:jar:1.2.13:compile
[INFO]    \- eres.commons:system-util-native:dll:1.0.0:compile
[INFO]       \- eres.commons:system-util:jar:1.0.0:compile

After bumping into the same issue and spending about a day chasing for class loading order (metro, cxf) I did not get anywhere. 在遇到了同样的问题并花了一天的时间追逐类加载顺序(地铁,cxf)之后,我什么也没得到。

Looking into my JVM parameters and the way it was launched I noticed "-ea" (enable assertions). 在查看我的JVM参数及其启动方式时,我注意到“ -ea”(启用断言)。 Disabling assertions by removing "-ea" apparently solves this issue. 通过删除“ -ea”禁用断言显然可以解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检查是否已使用java流 - Check if java stream has been consumed 你如何断言如果一个异常已经被消耗/处理/捕获,就抛出该异常 - How do you assert that an exception is thrown if it has already been consumed/handled/caught OptionalPendingResult <GoogleSignInResult> 总是引发IllegalStateException,原因是“结果已被使用” - OptionalPendingResult<GoogleSignInResult> is always throwing IllegalStateException with cause “Result has already been consumed” 修改已经排队的数据java - modifying data that has already been queued java Spring Security Config:AlreadyBuiltException:此对象已经构建 - Spring Security Config: AlreadyBuiltException: This object has already been built Spring Security Config:AlreadyBuiltException:此对象已经构建 - Spring Security Config: AlreadyBuiltException: This object has already been built “错误已被消耗”是什么意思? - What does "The error has been consumed" mean? Android登录界面 - 已消耗内容 - Android Login Interface - Content has been consumed 如何删除消费者已经消费的数据? 卡夫卡 - How to delete data which already been consumed by consumer? Kafka 如何验证Java中的ClassLoader是否已加载.jar或类 - How to verify that a .jar or a class has been already loaded by the ClassLoader in Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM