Tuesday, May 1, 2012

Tips on Websphere AS 7

Thought of consolidating couple of issues I faced in making my EAR &WAR files work in WAS 7. Sure, it could save some time in analysing and finding right solution to most of the novice users.  

Application with WebServices - IBM default WS Disabling

First and foremost, application embedded with web services APIs and especially has client logic to invoke  web services, it may fail to work when deployed in WAS 7. This is because WAS 7 comes bundled with Apache Axis 2 and takes control of any web services call from the application deployed and ignores the API provided inside application. To overcome this, follow below steps:
  1. Apply latest fix pack (I have tried FP 21) 
  2. While deploying the EAR file, option "Classes loaded with local class loader first (parent last)” should be selected in both “Class loading and update detection“ and “Manage Module” sections.
  3. Disabling default IBM JAXWS engine - To disable at global (server) level, follow below steps:
    1. From admin console add a custom property to disable default engine. Go to : Servers > Server Types > WebSphere application servers > server1 > Java and Process Management > Process definition > Java Virtual Machine
    2. Add below property in “Generic JVM arguments” field:-Dcom.ibm.websphere.webservices.DisableIBMJAXWSEngine =true
  4. To disable only for particular application 

    1.   Add below entry in manifest.mf file of war files (This happens at application level)   DisableIBMJAXWSEngine: true
In case of either of the above steps not working for some reason, follow below step of modifiying the default provided axis2 jar file.
Open '<WAS_HOME>/plugins/org.apache.axis2.jar' and remove 'META-INF/services/javax.xml.ws.spi.Provider'

   5. After above changes restart the server. 

Resolving CXF problem 

CXF in WAS 7 with ClientProxy component fails with below error making one scratch head to figure out solution!

java.lang.ClassCastException: org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler incompatible with org.apache.cxf.frontend.ClientProxy

Code which fails: 

MyWebService ss = new   MyWebService (wsdlURL, SERVICE_NAME);
instance = ss.getTestHttpPort();
Client cxfClient = ClientProxy.getClient(instance); 

This issue occurs only in WAS 7 for CXF when generated class used (from WSDL2Java tool) for creating proxy. JaxWsProxyFactoryBean comes to rescue in such scenarios and to resolve this issue.

With JaxWsProxyFactoryBean for creating JAX-WS proxies, slight modification as given below need to be done the codebase:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
MyWebService port = (MyWebService) factory.create();
//and then call ClientProxy as usual but with the object created using JaxWsProxyFactoryBean
Client client = ClientProxy.getClient(port); 

Heap setting change never brings up the server
Heap size change from admin console calls for restarting the WAS but sometimes when the input crossed limit or some mess up happened, sever never comes up. Novice users like me spend hours together to fix this horrid problem. Hope this helps bothered developers like me.

When server is not starting because of your wrong input, just look at this file.

Find jvmEntries element in this xml which will have initial and maximum heap size attributes and change them back to original/proper value.


  1. thanks!! this helps for solving a few issues

  2. Hi,
    When i try to do this..

    MyWebService port = (MyWebService) factory.create();

    It gives me an error saying MyWebService is not an interface. Its a class implementation thats generated.. How do i fix this up

  3. How did you generate the WS code?