One Star

STS CRMService On Tomcat

Hi Team,
on customer side we try to implement the CRMService on tomcat 6.0 using the sts configuration/setup of the sts osgi example.
-
In the catalina.out the following exception was logged:
org.apache.cxf.binding.soap.SoapFault: MustUnderstand headers: are not understood.
What are we doing wrong?
Thanks and regards,
Robert
Professional Services, Talend AI

p.s.: catalina.out:
May 17, 2011 3:49:43 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://services.talend.org/CRMService}CRMServiceProvider#{http://services.talend.org/CRMService}getC... has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: MustUnderstand headers: are not understood.
at org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor.checkUltimateReceiverHeaders(MustUnderstandInterceptor.java:150)
at org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor.handleMessage(MustUnderstandInterceptor.java:96)
at org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor.handleMessage(MustUnderstandInterceptor.java:49)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
May 17, 2011 3:49:43 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://services.talend.org/CRMService}CRMServiceProvider#{http://services.talend.org/CRMService}getC... has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: null
at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:258)
at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:156)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:81)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:104)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException
at javax.xml.bind.JAXBElement.(JAXBElement.java:91)
at javax.xml.bind.JAXBElement.(JAXBElement.java:105)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:244)
... 28 more

  • ESB
  • Talend Runtime
7 REPLIES
Employee

Re: STS CRMService On Tomcat

How are you consructing the war going into tomcat? Maven?
If so, are you including the cxf-rt-ws-security, cxf-rt-ws-addr, and cxf-rt-ws-policy modules? Basically, what cxf-* jars are being included in the war?
In OSGi, all of that is in the bundle jar that is deployed. Outside OSGi, you may need to pull in the functionality you need OR pull in cxf-bundle to grab everything.
One Star

Re: STS CRMService On Tomcat

Thanks Dan,
... added the missing dependencies ... but I got the same exception in catalina.out.
(all cxf jars are provided with the service war file.)
Here are my dependencies:


org.talend.esb.examples.rent-a-car
crmservice-common-lab1
${project.version}



log4j
log4j
1.2.16


org.talend.esb
locator
4.0


org.talend.esb
sam-agent
4.0



org.apache.cxf
cxf-rt-ws-security
${cxf.version}


org.apache.cxf
cxf-rt-ws-addr
${cxf.version}


org.apache.cxf
cxf-rt-ws-policy
${cxf.version}


Employee

Re: STS CRMService On Tomcat

Hmm... I'm not really sure. It looks like the service isn't finding a policy that would enable the security processing. If you scroll up the logs, does it say it's creating the service from a WSDL or from a Class? I assume the wsdl has the security policies defined that it needs picking up.
Can I also assume this is CXF 2.4.0 and not 2.3.x?

Any chance of a testcase?
Employee

Re: STS CRMService On Tomcat

There was a change with respect to processing mustunderstand headers in 2.3 which is described in "Runtime changes" here:
http://cxf.apache.org/23-migration-guide.html
To debug this, I'd recommend to deploy the DemoInterceptor of the TSF example "interceptors" which shows the whole interceptor chain. I'm wondering whether the WSS4JInInterceptor is called at all.
You could also add a typo in the CRMService-sts.wsdl to see whether this WSDL is read/parsed at all. If you don't get a different exception (parsing exception), the wsdl is ignored and therefore the defined security policy.
One Star

Re: STS CRMService On Tomcat

THANKS !!!
The WSDL hint was the right one ...
(On startup the wrong wsdl was referenced ...)
Now the service seens to run fine, but on client side I get the following exception:
Exception in thread "AWT-EventQueue-0" javax.xml.ws.WebServiceException: The signature or decryption was invalid; nested exception is:
org.apache.ws.security.WSSecurityException: Cannot find key for alias:

My example service is just a copy of the getting started crmservice ...
Also I'm using the 'getting started' crmservice client in the OSGI car application.
Any hints?
Employee

Re: STS CRMService On Tomcat

It looks like the public key of the service is not in the truststore of the client; alternatively, the client has not been configured to use the correct truststore (perhaps it's relying on the JRE default "cacerts" one as a result.) Working backwards, first confirm myservicekey is in the client's truststore, then confirm that the client is indeed pointing to that truststore. For the first part the keytool -list command is your friend, for the second part look at how you're configuring the truststore for the client, either or will work depending on the type of configuration you're doing.
http://www.jroller.com/gmazza/entry/using_openssl_to_create_certificates
http://www.jroller.com/gmazza/entry/cxf_x509_profile
http://www.jroller.com/gmazza/entry/cxf_x509_profile_secpol
HTH,
Glen
One Star

Re: STS CRMService On Tomcat

Hi,
just to explain the scenario in detail:
1. Created the 'Getting Started' Rent-a-Car Example with STS Profile.
2. Started the STS Rent-a-Car example app and run it successfully!
3. Created a crmservice webservice project to provide the crmservice by war deployment.(same buisnes code)
4. Defined the Service Locator, SAM features in the beans.xml and tested it successfully with rent-a-car (without sts)
5. Added the STS configuration in the crmservice (war)..(using the same callbackhandler)
6. Changed the crmservice endpoint to new one deployed on tomcat .
7. In karaf: switch back / redeploy rent-a-car app (with sts)
8. Test failed (wrong wsdl) and fixed wsdl location (to CRMServiceSTS.wsdl)
9. Tested the crmservice with Rent-a-Car (STS)
=> on the tomcat server erverything looks good! The request was processed successfully
=> in the Rent-a-Car karaf container the 'javax.xml.ws.WebServiceException: The signature or decryption was invalid' was thrown.
The tomcat based crmservice uses the same keystore like karaf/osgi based crmservice.
It's just a copy ...
The crmservice (war) security configuration is the same like the one of 'Getting Started'
So, if I run the crmservice on osgi => Test OK
If the tomcat crmservice (war) is in use => Client Fails.
... I will check the points you mentioned.
Regards,
Robert