cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Ceppelli <ceppe...@yahoo.com>
Subject Marshalling Error: class bug.Result nor any of its super class is known to this context.
Date Wed, 27 Jun 2007 12:27:20 GMT


Hi all.


 


I’m trying to develop a cxf servant with the ServerFactoryBean
but when I try to invoke an operation, which returns an custom type, I receive
the following exception:


 


27-Jun-2007 14:13:05
org.apache.cxf.phase.PhaseInterceptorChain doIntercept


INFO: Interceptor has thrown exception, unwinding now


org.apache.cxf.interceptor.Fault: Marshalling Error: class
bug.Result nor any of its super class is known to this context.


                at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:134)


                at
org.apache.cxf.jaxb.io.XMLStreamDataWriter.write(XMLStreamDataWriter.java:42)


                at
org.apache.cxf.jaxb.io.XMLStreamDataWriter.write(XMLStreamDataWriter.java:30)


                at
org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:73)


                at
org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor.handleMessage(XMLMessageOutInterceptor.java:69)


                at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:148)


                at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:70)


                at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:148)


                at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:63)


                at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:200)


                at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:161)


                at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:54)


                at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)


                at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)


                at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)


                at
org.mortbay.jetty.Server.handle(Server.java:295)


                at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)


                at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:841)


                at
org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:639)


                at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)


                at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)


                at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:361)


                at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)


Caused by: javax.xml.bind.JAXBException: class bug.Result
nor any of its super class is known to this context.


                at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:507)


                at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:449)


                at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:292)


                at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:148)


                at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:123)


                ... 22
more


 


 


Any suggestion?


 


Thanks,


Luca.






My environment is:


 


WindowsXp SP2


JDK 1.5.0_06


CXF-2.0-incubator-RC

 


Following you could find the code of my testcase:


 


package bug;


 


public interface Bug {


 


                Result
bug1();


 


}


 


package bug;


 


public class BugImpl implements Bug {


 


                public
Result bug1() {


                                return new Result(true, "Bug
1 Response!");


                }


}


 


 


public class Result {


                


                private
boolean fault;


                


                private
String message;


                


                public
Result(boolean fault, String message) {


                                this.fault = fault;


                                this.message = message;


                }


 


                public boolean
isFault() {


                                return fault;


                }


 


                public void
setFault(boolean fault) {


                                this.fault = fault;


                }


 


                public
String getMessage() {


                                return message;


                }


 


                public void
setMessage(String message) {


                                this.message = message;


                }


 


}


 


package bug;


 


import org.apache.cxf.endpoint.Server;


import org.apache.cxf.frontend.ServerFactoryBean;


 


public class MainBug {




 


                public
static void main(String[] args) {


                                ServerFactoryBean svrFactory =
new ServerFactoryBean();


 


                                svrFactory.setServiceClass(Bug.class);


 


                                svrFactory.setServiceBean(new
BugImpl());


 


                                svrFactory.setBindingId("http://cxf.apache.org/bindings/xformat");


                                svrFactory.setTransportId("http://schemas.xmlsoap.org/wsdl/http/");


 


                                svrFactory.setAddress("http://localhost:8080/bug");


 


                                Server server =
svrFactory.create();


 


                }


 


}








	
		
___________________________________ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

Mime
View raw message