tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <d...@iq80.com>
Subject Re: Returning complex data types in @WebResult
Date Sun, 27 Jan 2008 02:22:35 GMT
FWIU, JaxWS requires that all complex type be annotated with JaxB  
annotations (this is why the root most exception is a JAXBException).   
These annotations tell JaxWS how to convert between XML and the Java  
Object.

I think (and I'm not JaxWS expert) you only need to add @XmlType or  
@XmlRootElement to your Customer class, but you may want to check the  
Axis2 docs.

-dain

On Jan 26, 2008, at 3:57 PM, Cedric Hurst wrote:

>
> I'm working on a tutorial for EJB3 and JAX-WS generation and I'm  
> running into
> a problem returning any non-primitive result.  In this example, I  
> have an
> @Entity called Customer, and I'm exposing a @WebMethod called
> findCustomerByName which takes a String and returns a List of  
> Customers
> whose names match that String.  See implementation here:
>
> http://svn2.assembla.com/svn/d5Z24gWSer3lvHabIlDkbG/ComplexDataTypeWSExampleEJB/ejbModule/com/gmail/at/cedrichurst/complexDataTypeWSExampleEJB/ejb/CustomerSearchBean.java
>
> When I call this method, I get the following error:
>
> 17:51:44,890 INFO  [Transaction] TX Required: Started transaction
> org.apache.geronimo.transaction.manager.TransactionImpl@5c985c98
> 17:51:44,906 ERROR [OpenEJB] The bean instances business method  
> encountered
> a system exception: javax.xml.bind.MarshalException
> - with linked exception:
> [javax.xml.bind.JAXBException: java.util.List is not known to this  
> context]
> javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
> - with linked exception:
> [javax.xml.bind.JAXBException: java.util.List is not known to this  
> context]
> 	at
> org 
> .apache 
> .axis2 
> .jaxws 
> .ExceptionFactory.createWebServiceException(ExceptionFactory.java:174)
> 	at
> org 
> .apache 
> .axis2 
> .jaxws 
> .ExceptionFactory.makeWebServiceException(ExceptionFactory.java:69)
> 	at
> org 
> .apache 
> .axis2 
> .jaxws 
> .ExceptionFactory.makeWebServiceException(ExceptionFactory.java:127)
> 	at
> org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl 
> $2.run(JAXBBlockImpl.java:405)
> 	at
> org 
> .apache 
> .axis2 
> .java.security.AccessController.doPrivileged(AccessController.java:76)
> 	at
> org 
> .apache 
> .axis2 
> .jaxws 
> .message 
> .databinding.impl.JAXBBlockImpl.marshalByType(JAXBBlockImpl.java:321)
> 	at
> org 
> .apache 
> .axis2 
> .jaxws 
> .message 
> .databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:209)
> 	at
> org 
> .apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java: 
> 327)
> 	at
> org 
> .apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java: 
> 252)
> 	at
> org 
> .apache 
> .axiom 
> .om 
> .impl 
> .llom 
> .OMSourcedElementImpl 
> .internalSerializeAndConsume(OMSourcedElementImpl.java:599)
> 	at
> org 
> .apache 
> .axiom 
> .om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:785)
> 	at
> org 
> .apache 
> .axiom 
> .om 
> .impl 
> .llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java: 
> 814)
> 	at
> org 
> .apache 
> .axiom 
> .om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:785)
> 	at
> org 
> .apache 
> .axiom 
> .om 
> .impl 
> .llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java: 
> 814)
> 	at
> org 
> .apache 
> .axiom 
> .soap 
> .impl 
> .llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:237)
> 	at
> org 
> .apache 
> .axiom 
> .soap 
> .impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java: 
> 225)
> 	at
> org 
> .apache 
> .axiom 
> .om 
> .impl 
> .llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java: 
> 814)
> 	at
> org 
> .apache 
> .axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java: 
> 421)
> 	at
> org 
> .apache 
> .axis2 
> .transport 
> .http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:68)
> 	at
> org 
> .apache 
> .axis2 
> .transport 
> .http 
> .CommonsHTTPTransportSender 
> .sendUsingOutputStream(CommonsHTTPTransportSender.java:294)
> 	at
> org 
> .apache 
> .axis2 
> .transport 
> .http 
> .CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java: 
> 211)
> 	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
> 	at
> org 
> .apache 
> .geronimo.axis2.ejb.EJBInterceptor.intercept(EJBInterceptor.java:94)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> 	at
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:615)
> 	at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext 
> $Invocation.invoke(ReflectionInvocationContext.java:146)
> 	at
> org 
> .apache 
> .openejb 
> .core 
> .interceptor 
> .ReflectionInvocationContext 
> .proceed(ReflectionInvocationContext.java:129)
> 	at
> org 
> .apache 
> .openejb 
> .core.interceptor.InterceptorStack.invoke(InterceptorStack.java:73)
> 	at
> org 
> .apache 
> .openejb 
> .core 
> .stateless 
> .StatelessContainer.invokeWebService(StatelessContainer.java:263)
> 	at
> org 
> .apache 
> .openejb 
> .core.stateless.StatelessContainer._invoke(StatelessContainer.java: 
> 199)
> 	at
> org 
> .apache 
> .openejb 
> .core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
> 	at
> org 
> .apache 
> .geronimo 
> .axis2.ejb.EJBMessageReceiver.receive(EJBMessageReceiver.java:88)
> 	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
> 	at
> org 
> .apache 
> .axis2 
> .transport 
> .http 
> .HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java: 
> 275)
> 	at
> org 
> .apache 
> .geronimo 
> .axis2 
> .Axis2WebServiceContainer 
> .processPOSTRequest(Axis2WebServiceContainer.java:378)
> 	at
> org 
> .apache 
> .geronimo 
> .axis2 
> .Axis2WebServiceContainer.doService2(Axis2WebServiceContainer.java: 
> 248)
> 	at
> org 
> .apache 
> .geronimo 
> .axis2 
> .Axis2WebServiceContainer.doService(Axis2WebServiceContainer.java:205)
> 	at
> org 
> .apache 
> .geronimo 
> .axis2.Axis2WebServiceContainer.invoke(Axis2WebServiceContainer.java: 
> 167)
> 	at
> org.apache.geronimo.tomcat.TomcatEJBWebServiceContext 
> $EJBWebServiceValve.invoke(TomcatEJBWebServiceContext.java:180)
> 	at
> org 
> .apache 
> .catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> 	at
> org 
> .apache 
> .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> 	at
> org 
> .apache 
> .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 
> 109)
> 	at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 
> 563)
> 	at
> org 
> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 
> 261)
> 	at
> org 
> .apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
> 844)
> 	at
> org.apache.coyote.http11.Http11Protocol 
> $Http11ConnectionHandler.process(Http11Protocol.java:581)
> 	at org.apache.tomcat.util.net.JIoEndpoint 
> $Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:801)
> Caused by:
> javax.xml.bind.MarshalException
> - with linked exception:
> [javax.xml.bind.JAXBException: java.util.List is not known to this  
> context]
> 	at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java: 
> 295)
> 	at
> com 
> .sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java: 
> 148)
> 	at
> org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl 
> $2.run(JAXBBlockImpl.java:402)
> 	... 46 more
>
> Of course, I can see why Axis2 would have a problem returning a
> java.util.List, but I need to be able to return multiple results  
> somehow.
> Any suggestions?
> -- 
> View this message in context: http://www.nabble.com/Returning-complex-data-types-in-%40WebResult-tp15114306p15114306.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Mime
View raw message