问题
I have webservice developed in metro 2.1 , glassfish-server 3.1. Exception at the server side.
[#|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
And client side it will give me the exception like below
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
Issue Generation Case: I am not facing this issue every times when I call service. But in some cases like I have restarted glassfish server 10 times then it's working well for 9 times out of 10 but it will fail in once and gives above error at server and client side.
The issue is related to jar loading by glassfish 3.1 but I haven't got right solution.
Glassfish using **/glassfish/modules/*-osgi.jar
Any Suggestion regarding this is great help for me.
回答1:
The Jar of Jaxb-impl-2.0.1.jar
is conflicting with glassfish *-osgi.jar
api.
I have removed the Jaxb-impl-2.0.1.jar
and is working well for all times.
Instead of jaxb-osgi.jar
, my application is loading the Jaxb-impl-2.0.1.jar
.
来源:https://stackoverflow.com/questions/28696160/error-while-serializing-timestamp-element-occured-while-performing-canonicalizat