aspose file tools*
The moose likes BEA/Weblogic and the fly likes CXF web service client migration from tomcat to weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "CXF web service client migration from tomcat to weblogic" Watch "CXF web service client migration from tomcat to weblogic" New topic
Author

CXF web service client migration from tomcat to weblogic

joel king
Greenhorn

Joined: May 20, 2010
Posts: 6
Hi,
I am developing a web application, its a servlet which basically acts as a front end for a web service,
I use CXF for the web service client, tested under a development tomcat instance and worked fine.
while I try to migrate to weblogic 10.3.2 follow the change as in
http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-WebLogic
Then I got the exception:
java.lang.IncompatibleClassChangeError: Class com.ibm.wsdl.DefinitionImpl does not implement the requested interface javax.wsdl.extensions.AttributeExtensible
at org.apache.cxf.wsdl11.WSDLServiceBuilder.copyExtensionAttributes(WSDLServiceBuilder.java:137)
at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:277)

I have the spring framework and the rest jars in the lib:

wsdl4j-1.6.1.jar
wss4j-1.5.8.jar
jaxb-api-2.0.jar
cxf-2.2.3.jar

I have been research on this problem for a while, found some posts from experts like Dan on Nable...
but I still didn't get it, could anyone help on this.

Thanks, Joel
Ash Kondhalkar
Ranch Hand

Joined: Jun 14, 2006
Posts: 43
Joel,

I had a look at the link which you have mentioned in the post. I fear it discusses how the web service developed using the CXF should be deployed on Weblogic. In your case where you are trying to consume a webservice, from a Servlet in application deployed in Weblogic using CXF client, this link will not be helpful. While testing the web service as a client from tomcat, you must have added few jar files in the TOMCAT classpath and then tested the client. Kindly add the same jar files in the Weblogic classpath, change the setDomainEnv.cmd to add these jar files in the classpath or add the jars in the lib folder of your application deploy it and it should work fine.

Thanks & Regards
Ashwin
joel king
Greenhorn

Joined: May 20, 2010
Posts: 6
Hi, Ashwin,

Thanks for your response.
1. I actually made the same piece of the web service client code works in Tomcat, GlassFish, OC4J. For Tomcat, I don't configure any jars to make that works, and it works fine. For GlassFish and OC4J, I follow that links and it works on both. Now I try to follow the second suggestion for weblogic, it won't work with the exactly same lib as in Tomcat.
2. in that cxf link, I just confused how to: Put the geronimo-ws-metadata_2.0_spec-1.1.1.jar in the $Weblogic_Home/jdk_../jre/lib/endorsed folder for weblogic 10.3.2 since I tried to add endorsed folder and tried, it give me the same error as I mentioned.



Thanks, Joel
Ash Kondhalkar
Ranch Hand

Joined: Jun 14, 2006
Posts: 43
Hi,

It is an issue with the combination of jar files which are used to consume the web service. If you can find out the exact jar files which are used while running the client in Tomcat and then try using the same with Weblogic?

If possible please share the client code with me and I will have a look and come back to you.

Thanks
Ashwin
joel king
Greenhorn

Joined: May 20, 2010
Posts: 6
Hi, Ashwin,
Thanks for kindly response.
I have some "progress", by putting wsdl4j-1.6.1.jar and geronimo-ws-metadata_2.0_spec-1.1.1.jar in the {weblogichome}\jdk160_14_R27.6.5-32\jre\lib\ext
I actually don't know why it will pass that exception(green), maybe you can explain to me on that....

This piece of code is a WS client to transfer PDF file with MTOM, and add security header into the request.

and now I gone through that line of code and got another exception(stop at red) for as below, and one link for solution, but I tried it it won't work so far. and I got my code attatch as well, I may need your help on this since this is another issue:


INFO: No cxf.xml configuration file detected, relying on defaults.
May 24, 2010 3:33:08 PM org.apache.cxf.service.factory.ReflectionServiceFactoryB
ean buildServiceFromWSDL
INFO: Creating Service {http://v1.service.application.grantsolutions.gov/}Applic
ationPDFImplService from WSDL: http://stage.grantsolutions.gov/applicationprint/
ApplicationPDFV1?WSDL
Invoking getApplicationPDF...
May 24, 2010 3:33:09 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
WARNING: Interceptor has thrown exception, unwinding now
java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1
at weblogic.webservice.core.soap.SOAPPartImpl.createElementNS(SOAPPartIm
pl.java:820)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMS
treamWriter.java:132)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapE
nvelopeStart(SoapOutInterceptor.java:118)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMess
age(SoapOutInterceptor.java:80)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMess
age(SoapOutInterceptor.java:61)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:472)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:302)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:12
3)
at $Proxy124.getApplicationPDF(Unknown Source)
at com.lcgnet.games.webservices.applicationPDFService.ApplicationPDFClie
nt.getApplicationPDFFile(ApplicationPDFClient.java:73)
at com.lcgnet.games.web.actions.admin.RetrieveExtWSAppFileAction.execute
(RetrieveExtWSAppFileAction.java:57)


public static byte[] getApplicationPDFFile(final String wsdlUrl, final String username, final int applicationId) throws Exception {

final ApplicationPDFImplService applicationPDFImplService = new ApplicationPDFImplService(new URL(wsdlUrl));
//final ApplicationPDF applicationPDF = applicationPDFImplService.getApplicationPDFImplPort();
ApplicationPDF applicationPDF = applicationPDFImplService.getApplicationPDFImplPort();

final Client client = ClientProxy.getClient(applicationPDF);
final Endpoint cxfEndpoint = client.getEndpoint();

//handle the security stuff
Map<String,Object> outProps = new HashMap<String,Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, username);
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, DigestCallbackHandler.class.getName());
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps); cxfEndpoint.getOutInterceptors().add(wssOut);

System.out.println("Invoking getApplicationPDF...");
byte[] bs = applicationPDF.getApplicationPDF(applicationId);

return bs;
}

I got
http://han-zw.javaeye.com/blog/652289, which tells modify the startWeblogic.sh in my case should be startWeblogic.cmd, I am still in rosolving this.

Thanks,
Joelking
joel king
Greenhorn

Joined: May 20, 2010
Posts: 6
Hi,

Acutally it stops at

byte[] bs = applicationPDF.getApplicationPDF(applicationId);

which implement like:

public byte[] getApplicationPDF(
@WebParam(name = "arg0", targetNamespace = "")
int arg0
);

Thanks,
Joelking
joel king
Greenhorn

Joined: May 20, 2010
Posts: 6
Hi, Ashwin,

Now I got this as a progress,

java.lang.NoSuchMethodError: org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.getString(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:159)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:122)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:472)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:302)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:123)
at $Proxy124.getApplicationPDF(Unknown Source)
at com.lcgnet.games.webservices.applicationPDFService.ApplicationPDFClient.getApplicationPDFFile(ApplicationPDFClient.java:73)
at com.lcgnet.games.web.actions.admin.RetrieveExtWSAppFileAction.execute(RetrieveExtWSAppFileAction.java:57)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.lcgnet.games.web.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:57)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)



Could you help?

Thanks,
joelking
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CXF web service client migration from tomcat to weblogic