[jboss-user] [JBossWS] - Re: Problem with inheritance and JBossWS

fambad do-not-reply at jboss.com
Fri Jun 22 03:17:38 EDT 2007


I have testet a little bit more and now I have a little example that I can deploy. I also startet with the wsdl file and used wsconsume to create the java classes and annotation. Then I copied these classes in my project and so the deployment was successful. But when I access the deployed webservice I am getting a ClassCastException during the request.

Below I list my classes:

ClassA

  | @XmlAccessorType(XmlAccessType.FIELD)
  | @XmlType(name = "classA", propOrder = {
  |     "propA"
  | })
  | public class ClassA {
  |   
  |   private String propA;
  |   
  |   public ClassA() {
  |   }
  | 
  |   public String getPropA() {
  |     return propA;
  |   }
  | 
  |   public void setPropA(String propA) {
  |     this.propA = propA;
  |   }
  |   
  | }
  | 

ClassB

  | @XmlAccessorType(XmlAccessType.FIELD)
  | @XmlType(name = "classB", propOrder = {
  |     "propB"
  | })
  | public class ClassB extends ClassA {
  |   private String propB;
  |   public ClassB() {
  |   }
  | 
  |   public String getPropB() {
  |     return propB;
  |   }
  | 
  |   public void setPropB(String propB) {
  |     this.propB = propB;
  |   }
  | }
  | 

ClassC

  | @XmlAccessorType(XmlAccessType.FIELD)
  | @XmlType(name = "classC", propOrder = {
  |     "propC"
  | })
  | public class ClassC extends ClassB {
  |   
  |   private String propC;
  |   public ClassC() {
  |   }
  | 
  |   public String getPropC() {
  |     return propC;
  |   }
  | 
  |   public void setPropC(String propC) {
  |     this.propC = propC;
  |   }
  | }
  | 
GetClassBResponse

  | @XmlAccessorType(XmlAccessType.FIELD)
  | @XmlType(name = "getClassBResponse", propOrder = {
  |     "someElement",
  |     "data"
  | })
  | public class GetClassBResponse {
  | 
  |     @XmlElementRef(name = "someElement", type = JAXBElement.class)
  |     protected JAXBElement<String> someElement;
  |     @XmlElement(required = true, nillable = true)
  |     protected ClassB data;
  | 
  |     public JAXBElement<String> getSomeElement() {
  |         return someElement;
  |     }
  | 
  |     public void setSomeElement(JAXBElement<String> value) {
  |         this.someElement = ((JAXBElement<String> ) value);
  |     }
  | 
  |     public ClassB getData() {
  |         return data;
  |     }
  | 
  |     public void setData(ClassB value) {
  |         this.data = value;
  |     }
  | }
  | 
SampleWSWithDocument_Bare

  | @WebService()
  | @SOAPBinding( style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE )
  | public class SampleWSWithDocument_Bare {
  |  
  |   public SampleWSWithDocument_Bare() {
  |   }
  |   
  |   @WebMethod()
  |   public GetClassBResponse getClassCAsClassB() {
  |     System.out.print("getClassCAsClassB");
  |     ClassC classC= new ClassC();
  |     classC.setPropA("propA");
  |     classC.setPropB("propB");
  |     classC.setPropC("propC");
  |     
  |     GetClassBResponse resp = new GetClassBResponse();
  |     resp.setData(classC);
  |     
  |     ObjectFactory fact = new ObjectFactory();
  |     resp.setSomeElement(fact.createGetClassBResponseSomeElement("Test"));
  |     return resp;
  |   }
  | }
  | 

ObjectFactory

  | @XmlRegistry
  | public class ObjectFactory {
  | 
  |     private final static QName _GetClassCAsClassBResponse_QNAME = new QName("http://ws.examples.mstrauch/", "getClassCAsClassBResponse");
  |     private final static QName _GetClassBResponseSomeElement_QNAME = new QName("http://ws.examples.mstrauch/", "someElement");
  | 
  |     public ObjectFactory() {
  |     }
  | 
  |     public ClassA createClassA() {
  |         return new ClassA();
  |     }
  | 
  |     public ClassC createClassC() {
  |         return new ClassC();
  |     }
  | 
  |     public ClassB createClassB() {
  |         return new ClassB();
  |     }
  | 
  |     public GetClassBResponse createGetClassBResponse() {
  |         return new GetClassBResponse();
  |     }
  | 
  |     @XmlElementDecl(namespace = "http://ws.examples.mstrauch/", name = "getClassCAsClassBResponse")
  |     public JAXBElement<GetClassBResponse> createGetClassCAsClassBResponse(GetClassBResponse value) {
  |         return new JAXBElement<GetClassBResponse>(_GetClassCAsClassBResponse_QNAME, GetClassBResponse.class, null, value);
  |     }
  | 
  |     @XmlElementDecl(namespace = "http://ws.examples.mstrauch/", name = "someElement", scope = GetClassBResponse.class)
  |     public JAXBElement<String> createGetClassBResponseSomeElement(String value) {
  |         return new JAXBElement<String>(_GetClassBResponseSomeElement_QNAME, String.class, GetClassBResponse.class, value);
  |     }
  | }
  | 

Now I get follow error message during request.


08:59:41,554 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
javax.xml.soap.SOAPException: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
        at javax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:68)
        at org.jboss.ws.core.soap.SOAPFactoryImpl.createElement(SOAPFactoryImpl.java:120)
        at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:116)
        at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:85)
        at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:254)
        at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:179)
        at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:197)
        at org.jboss.ws.core.server.ServiceEndpointManager.processRequest(ServiceEndpointManager.java:448)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
        at javax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:64)
        ... 29 more
08:59:41,632 ERROR [SOAPFaultHelperJAXWS] Error creating SOAPFault message
javax.xml.soap.SOAPException: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
        at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:77)
        at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.toSOAPMessage(SOAPFaultHelperJAXWS.java:234)
        at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:164)
        at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
        at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:623)
        at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:229)
        at org.jboss.ws.core.server.ServiceEndpointManager.processRequest(ServiceEndpointManager.java:448)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
        at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:73)
        ... 28 more
08:59:41,632 ERROR [AbstractServiceEndpointServlet] Error processing web service request
javax.xml.ws.WebServiceException: Cannot create SOAPFault message for: javax.xml.soap.SOAPException: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
        at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:172)
        at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
        at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:623)
        at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:229)
        at org.jboss.ws.core.server.ServiceEndpointManager.processRequest(ServiceEndpointManager.java:448)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)
08:59:41,632 ERROR [[SampleWSWithDocument_Bare]] Servlet.service() for servlet SampleWSWithDocument_Bare threw exception
javax.xml.ws.WebServiceException: Cannot create SOAPFault message for: javax.xml.soap.SOAPException: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
        at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:172)
        at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
        at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:623)
        at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:229)
        at org.jboss.ws.core.server.ServiceEndpointManager.processRequest(ServiceEndpointManager.java:448)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056746#4056746

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056746



More information about the jboss-user mailing list