标签云

微信群

扫码加入我们

WeChat QR Code

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) throwsException {log.info("loadWsControlMode WebService InvokedApplication 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 arraylistmodelObj = 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}


I think, loadWsControlMode() method is required to be annotated with WebMethod.

2019年04月18日32分28秒

Well one thing that I forgot to mention, on our windows local environment, we do not experience any issues. This only ocurrs with our full environment running on Linux.

2019年04月18日32分28秒

Well I tried any number of things to no avail.So I punted, I modified the method to return a List<ApplicationConfigVO> 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.

2019年04月18日32分28秒