Search code examples
web-serviceswsdlwebspherejax-wsapache-axis

Web Service Error: class xxx nor any of its super class is known to this context


We have a JAX-WS service hosted on a Web Sphere 7.0.0.19 server. The service is implemented using @WebService annotations. If we hit the service to ask for the WSDL, we successfully have the XML returned to us. However, if we call a web service method, it returns the following error:

javax.xml.ws.soap.SOAPFaultException: javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: class com.penske.newreuse.vo.ApplicationConfigVO nor any of its super class is known to this context.]
    at     com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:171)
    at     com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:94)
    at     com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:240)
    at     com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
    at     com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:103)

Looking at our logging, our code is successfully called, and we return the data expected. However, it is when the data is being marshalled to be sent back to the client that the fault occurs.

The ApplicationConfigVO class was in a separate jar file, we tried and pulled it out and included the source directly with the service, no change.

I added @XmlSeeAlso(ApplicationConfigVO.class) to the ApplicationConfigVO object, but still no change.


This is the web service code:

@WebService(serviceName="WebServiceConfigService")
public class WebServiceConfig {

private static Logger log = Logger.getLogger(WebServiceConfig.class);

public ApplicationConfigVO[] loadWsControlMode(int applicationId,String appsId) throws  Exception {
    log.info("loadWsControlMode WebService Invoked  Application ID :"+ appsId);
    List returnList = null;
    ApplicationConfigVO[] resultArray = null;

    try {
        ApplicationConfigVO modelObj = new ApplicationConfigVO();
        modelObj.setApplicationId(applicationId);
        IApplicationConfigDAO daoObj = DAOFactory.getApplicationConfigDAO();
        returnList = daoObj.loadWsControlMode(modelObj);

        if(null != returnList && returnList.size()>0){
            resultArray = new ApplicationConfigVO[returnList.size()];
            //Populate the ApplicationConfigVO array from arraylist
            modelObj = new ApplicationConfigVO();
            for(int i=0;i<returnList.size();i++){
                modelObj = (ApplicationConfigVO)returnList.get(i);
                resultArray[i] = modelObj;
            }//End of for loop
        }
    } catch (Exception e) {
        log.error(DAWebServiceUtil.stackTraceToString(e));
        throw e;
    }
    return resultArray;
}

This is the ApplicationConfigVO class:

public class ApplicationConfigVO implements Serializable{

private int applicationId;
private String webServiceControlMode = null;
private int webServiceId;
private String webServiceName = null;
private int webServiceMethodId;
private int opModeId;
private String webServiceMethodDesc = null;

private int dataBaseTypeId;
private String dataBaseTypeDesc = null;

    ...  //  various getters and setters following java bean rules
}

Solution

  • Well I tried any number of things to no avail. So I punted, I modified the method to return a List instead of the ApplicationConfigVO[]. At this point I think it is a classloader issue, but I cannot be sure. In either case, the switch over to a list was ultimately easier and hopefully nothing else will bite us