close

In this blog, we will look at how to deploy CXF application on WebSphere Process Server (WPS). One of the readers had asked me on how to deploy the sample application from the Chapter 2 in WPS, since my book covers deployment on tomcat server only. It was a good exercise for me to validate if the sample CXF application run on other servers as I haven’t tried this before.

I was able to run the application successfully with a modification to the module class loading policy . Given below are the steps required to deploy the sample CXF application in WPS. The version of WPS used was 7.0.

  1. Build the war file (orderapp.war) as mentioned in Chapter 2.
  2. Logon to WPS Administration Console
  3. Go to Applications -> Application Types – > WebSphere Enterprise applications. Click Install
  4. In next screen , provide the location of orderapp.war file.Click Next
  5. On the next screen, click Fast Path and click on Next
  6. On the Install New Application screen, Click on Step 3 Map virtual hosts for Web modules and select the orderapp.war file to map it to default_host virtual host
  7. On the Install New Application screen, Click on Step 4 Map context root for Web modules and enter the context root as /orderapp. Click Next
  8. On the Summary screen, click Finish.
  9. The orderapp.war would be deployed. On the confirmation screen, click Save to save the configuration to master configuration.

Next, you need to change the class loading policy for orderapp web module, to ensure that the CXF libraries, CXF JAX-WS and JAX-RS runtime and dependent files present in web module (all jar files in WEB-INF\lib) are loaded first , instead of WPS library to avoid any conflict. If you don’t change the class loading policy , the application deployment would be successful but would receive the following exception when you run the application –

com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet CXFServlet in application orderapp_war. Exception created : java.lang.NoSuchMethodError: org/apache/ws/commons/schema/XmlSchema.getSchemaDocument()Lorg/w3c/dom/Document;
at org.apache.cxf.service.model.SchemaInfo.getElement(SchemaInfo.java:109)
at org.apache.cxf.wsdl11.ServiceWSDLBuilder.buildTypes(ServiceWSDLBuilder.java:267)
at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:188)
at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:148)

To change the class loading policy , follow these steps

  1. Go to Applications -> Application Types – > WebSphere enterprise applications and select orderapp_war
  2. Click on Manage modules
  3. Click on orderapp.war

Change the class loader order to “Classes loaded with local class loader first (parent last)”  and click Apply. Save the configuration.

  1. Start the orderapp_war enterprise application
  2. Run the web service client as mentioned in Chapter 2

Note if you plan to use CXF JAX-WS implementation with WAS/WPS , you would not be able to leverage the WS-Specifications (like WS-Security) offered by WAS/WPS container for that application and instead need to rely on CXF WS-Specification implementation.

To know, more about how to develop SOAP and Restful web services, get a copy of my Apache CXF Web Service Book.

Tags : WebSphere Process Server CXFWPS CXF DEPLOY
Navveen

The author Navveen