序列化执行规范化时发生的Timestamp元素时出错

时间:2015-02-24 12:44:43

标签: java web-services soap glassfish-3 java-metro-framework

我在Metro 2.1,glassfish-server 3.1中开发了webservice。 服务器端的例外情况。

[#|2015-01-30T08:00:37.325-

0500|SEVERE|glassfish3.1.1|com.sun.xml.wss.logging.impl.opt|_ThreadID=26;_ThreadName=Thread-2;|WSS1609: Error while serializing Timestamp element|#]

[#|2015-01-30T08:00:37.330-0500|SEVERE|glassfish3.1.1|com.sun.xml.wss.logging.impl.opt.signature|_ThreadID=26;_ThreadName=Thread-2;|WSS1759: Following error com.sun.xml.wss.XWSSecurityException: WSS1609: Error while serializing Timestamp element occured while performing canonicalization com.sun.xml.wss.XWSSecurityException: WSS1609: Error while serializing Timestamp element
javax.xml.crypto.dsig.TransformException: com.sun.xml.wss.XWSSecurityException: WSS1609: Error while serializing Timestamp element
    at com.sun.xml.ws.security.opt.crypto.dsig.Exc14nCanonicalizer.transform(Exc14nCanonicalizer.java:191)
    at com.sun.xml.ws.security.opt.crypto.dsig.Transform.transform(Transform.java:183)
    at com.sun.xml.ws.security.opt.crypto.dsig.Reference.transform(Reference.java:188)
    at com.sun.xml.ws.security.opt.crypto.dsig.Reference.digest(Reference.java:129)
    at com.sun.xml.ws.security.opt.crypto.dsig.Signature.sign(Signature.java:218)
    at com.sun.xml.ws.security.opt.impl.dsig.SignatureProcessor.sign(SignatureProcessor.java:127)
    at com.sun.xml.wss.impl.filter.SignatureFilter.sign(SignatureFilter.java:649)
    at com.sun.xml.wss.impl.filter.SignatureFilter.process(SignatureFilter.java:608)
    at com.sun.xml.wss.impl.HarnessUtil.processWSSPolicy(HarnessUtil.java:99)
    at com.sun.xml.wss.impl.HarnessUtil.processDeep(HarnessUtil.java:278)
    at com.sun.xml.wss.impl.SecurityAnnotator.processMessagePolicy(SecurityAnnotator.java:194)
    at com.sun.xml.wss.impl.SecurityAnnotator.secureMessage(SecurityAnnotator.java:155)
    at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.secureOutboundMessage(SecurityTubeBase.java:386)
    at com.sun.xml.wss.jaxws.impl.SecurityServerTube.processResponse(SecurityServerTube.java:481)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:651)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:314)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:608)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:213)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
    at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.xml.wss.XWSSecurityException: WSS1609: Error while serializing Timestamp element
    at com.sun.xml.ws.security.opt.impl.crypto.JAXBDataImpl.writeTo(JAXBDataImpl.java:126)
    at com.sun.xml.ws.security.opt.crypto.dsig.Exc14nCanonicalizer.transform(Exc14nCanonicalizer.java:185)
    ... 59 more
Caused by: javax.xml.stream.XMLStreamException: javax.xml.bind.JAXBException: Error occurred while setting security marshaller properties
 - with linked exception:
[javax.xml.bind.PropertyException: property "com.sun.xml.bind.namespacePrefixMapper" must be an instance of type com.sun.xml.bind.marshaller.NamespacePrefixMapper, not com.sun.xml.ws.security.opt.impl.util.WSSNamespacePrefixMapper]
    at com.sun.xml.ws.security.opt.impl.tokens.Timestamp.writeTo(Timestamp.java:216)
    at com.sun.xml.ws.security.opt.impl.crypto.JAXBDataImpl.writeTo(JAXBDataImpl.java:123)
    ... 60 more
Caused by: javax.xml.bind.JAXBException: Error occurred while setting security marshaller properties
 - with linked exception:
[javax.xml.bind.PropertyException: property "com.sun.xml.bind.namespacePrefixMapper" must be an instance of type com.sun.xml.bind.marshaller.NamespacePrefixMapper, not com.sun.xml.ws.security.opt.impl.util.WSSNamespacePrefixMapper]
    at com.sun.xml.ws.security.opt.impl.util.JAXBUtil.createMarshaller(JAXBUtil.java:141)
    at com.sun.xml.ws.security.opt.impl.tokens.Timestamp.getMarshaller(Timestamp.java:221)
    at com.sun.xml.ws.security.opt.impl.tokens.Timestamp.writeTo(Timestamp.java:214)
    ... 61 more

客户端会给我一个例外如下

Web service failed falling back A required header representing a Message Addressing Property is not present
javax.xml.ws.soap.SOAPFaultException: A required header representing a Message Addressing Property is not present
at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:189)
at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:122)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
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 $Proxy80.getAllSecretHavingWebServiceAccess(Unknown Source)
at 

问题生成案例 我每次打电话给服务时都不会面对这个问题。但是在某些情况下,比如我重新启动了glassfish服务器10次,那么它在10次中运行良好9次,但是它会在一次失败并在服务器端和客户端出现上述错误。

问题与glassfish 3.1的jar加载有关,但我没有正确的解决方案。

Glassfish使用** / glassfish / modules / * - osgi.jar

对此有任何建议对我有很大帮助。

1 个答案:

答案 0 :(得分:0)

Jaxb-impl-2.0.1.jar的Jar与glassfish *-osgi.jar api相冲突。 我删除了Jaxb-impl-2.0.1.jar并且一直都很好。

我的应用程序正在加载jaxb-osgi.jar

而不是Jaxb-impl-2.0.1.jar