cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Guys, help, can't manage to use CXF faults
Date Thu, 18 Oct 2007 16:06:42 GMT

The NotLoggedInFaultDetail object needs a default constructor.   All JAXB 
beans need to have a default constructor.  If you add that, it should 
work.

Dan


On Thursday 18 October 2007, Egor Samarkhanov wrote:
> Hi !
>
> I have a simple exception class:
>
> @WebFault(name = "faultDetail")
> public class NotLoggedInException extends Exception
> {
>     private NotLoggedInFaultDetail faultDetail;
>
>
>     public NotLoggedInException( String message )
>     {
>         super( message );
>     }
>
>     public NotLoggedInException( String message,
> NotLoggedInFaultDetail faultDetail ) {
>         super( message );
>         this.faultDetail = faultDetail;
>     }
>
>     public NotLoggedInException( String message,
> NotLoggedInFaultDetail faultDetail, Throwable cause ) {
>         super( message, cause );
>         this.faultDetail = faultDetail;
>     }
>
>     public NotLoggedInFaultDetail getFaultInfo() {
>         return this.faultDetail;
>     }
> }
>
>
> and a fault detail class
>
> @XmlRootElement(name = "faultDetail")
> public class NotLoggedInFaultDetail
> {
>     private String detail;
>
>     public NotLoggedInFaultDetail( String detail )
>     {
>         this.detail = detail;
>     }
>
>     public String getDetail()
>     {
>         return detail;
>     }
>
>     public void setDetail( String detail )
>     {
>         this.detail = detail;
>     }
> }
>
>
> And I'm constantly getting the following exception when
> I try to access the (SERVLET TRANSPORT):
>
> java.lang.NullPointerException
>         at
> org.apache.cxf.jaxb.JAXBSchemaInitializer.end(JAXBSchemaInitializer.ja
>va:213) at
> org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModel
>Visitor.java:89) at
> org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.ja
>va:48) at
> org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:25
>5) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi
>ceFromClass(ReflectionServiceFactoryBean.java:244) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize
>ServiceModel(ReflectionServiceFactoryBean.java:272) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Ref
>lectionServiceFactoryBean.java:146) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServi
>ceFactoryBean.java:89) at
> org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(Abstrac
>tEndpointFactory.java:83) at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.jav
>a:107) at
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryB
>ean.java:147) at
> org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:287) at
> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:227) at
> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:179) at
> org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(Provide
>rImpl.java:74) at javax.xml.ws.Endpoint.publish(Endpoint.java:156)
>         at
> com.actimind.actitime.dtr.ws.CXFServlet.init(CXFServlet.java:23) at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.j
>ava:1091) at
> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java
>:750) at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
>lve.java:130) at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
>lve.java:178) at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
>va:126) at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
>va:105) at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
>e.java:107) at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
>:148) at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
>856) at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proces
>sConnection(Http11Protocol.java:744) at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoi
>nt.java:527) at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFoll
>owerWorkerThread.java:80) at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPo
>ol.java:684) at java.lang.Thread.run(Unknown Source)
>
> The interesing thing is that if i remove the method
> getFaultInfo() from the NotLoggedInException the exception
> disappears, but I suppose in this case such a fault is incorectly
> declared.
>
> To publish my service I've extended your CFXServlet and
> call Endpoint.publish(...) just after the servlet initialization.
>
>
>
> Thanks,
> Egor Samarkhanov (slash@actimind.com)



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Mime
View raw message