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

fambad do-not-reply at jboss.com
Thu Jun 21 09:24:38 EDT 2007


I tried to create an own JAXBElement as you described. But I am getting errors when I deploy it. First I create an ObjectFactory for "someElement":


  | @XmlRegistry
  | class ObjectFactory {
  |   
  |   @XmlElementDecl(scope=getClassBResponse.class, name="someElement", namespace="http://some.namespace.com")
  |   JAXBElement<String> createSomeElement(String s) { 
  |     return new JAXBElement<String>(new QName("someElement"), String.class, s);
  |   }
  | }
  | 

Then I defined the JAXBElement in my response class

  | @XmlAccessorType(XmlAccessType.FIELD)
  | @XmlType(name = "getClassBResponse", namespace="http://mstrauch.examples.ws/", propOrder = { "data", "someElement" })
  | public class getClassBResponse {
  |   
  |   @XmlElementRef(name = "someElement", namespace = "http://some.namespace.com", type = JAXBElement.class)
  |   protected JAXBElement<String> someElement;
  |   
  |   @XmlElement(required = true, nillable = true)
  |   protected ClassB data; 
  |   
  |   public getClassBResponse() {
  |   }
  | 
  |   public ClassB getData() {
  |     return data;
  |   }
  | 
  |   public void setData(ClassB data) {
  |     this.data = data;
  |   }
  |   
  | }
  | 

During deployment I am getting a ClassCastException:



org.jboss.deployment.DeploymentException: Cannot start service endpoint; - nested throwable: (java.lang.ClassCastException: mstrauch.examples.ws.jaxws.GetClassCAsClassBResponse$JaxbAccessorM_getReturn
_setReturn_mstrauch_examples_ws_types_ClassB)
        at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
        at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:101)
        at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
        at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy46.start(Unknown Source)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
        at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy9.deploy(Unknown Source)
        at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
        at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
Caused by: java.lang.ClassCastException: mstrauch.examples.ws.jaxws.GetClassCAsClassBResponse$JaxbAccessorM_getReturn_setReturn_mstrauch_examples_ws_types_ClassB
        at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.instanciate(OptimizedAccessorFactory.java:151)
        at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:96)
        at com.sun.xml.bind.v2.runtime.reflect.Accessor$GetterSetterReflection.optimize(Accessor.java:308)
        at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.(SingleElementNodeProperty.java:53)
        at sun.reflect.GeneratedConstructorAccessor62.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:88)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.(ClassBeanInfoImpl.java:135)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:404)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:246)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
        at org.jboss.ws.metadata.acessor.JAXBAccessor$1.create(JAXBAccessor.java:67)
        at org.jboss.ws.metadata.acessor.JAXBAccessor$1.create(JAXBAccessor.java:54)
        at org.jboss.ws.metadata.umdm.ParameterMetaData.eagerInitialize(ParameterMetaData.java:470)
        at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:469)
        at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:516)
        at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:502)
        at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitialize(EndpointMetaData.java:490)
        at org.jboss.ws.metadata.umdm.ServiceMetaData.eagerInitialize(ServiceMetaData.java:429)
        at org.jboss.ws.metadata.umdm.UnifiedMetaData.eagerInitialize(UnifiedMetaData.java:192)
        at org.jboss.ws.core.server.ServiceEndpoint.start(ServiceEndpoint.java:112)
        at org.jboss.ws.core.server.ServiceEndpointManager.startServiceEndpoint(ServiceEndpointManager.java:646)
        at org.jboss.ws.core.server.ServiceEndpointDeployer.start(ServiceEndpointDeployer.java:140)
        at org.jboss.ws.integration.jboss42.DeployerInterceptor.startServiceEndpoint(DeployerInterceptor.java:144)
        at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:96)
        ... 28 more



So what can I do?

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

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



More information about the jboss-user mailing list