cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabo Manuel <kman...@solegysystems.com>
Subject [CXF2.2] Runtime exception with no message
Date Wed, 25 Mar 2009 05:10:50 GMT
Hi All,

I encountered this during one of my test:

Service.java:
    @GET
    @Path("/search/")
    @WebMethod
    public MyObjects getMyObjects(
            @HeaderParam("uri")
            @WebParam(name="searchObject")
            SearchObject so) {
    }

SearchObject.java:
@XmlRootElement
@XmlType(name="SearchObject")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class SearchObject {
    public SearchObject(){
    }
    //important point here is that there is no other constructor other 
than default.
}

I accessed the said method and encountered the following exception:
javax.ws.rs.WebApplicationException
 at 
org.apache.cxf.jaxrs.utils.InjectionUtils.reportServerError(InjectionUtils.java:237)
 at 
org.apache.cxf.jaxrs.utils.InjectionUtils.handleParameter(InjectionUtils.java:224)
 at 
org.apache.cxf.jaxrs.utils.InjectionUtils.createParameterObject(InjectionUtils.java:404)
 at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.processHeaderParam(JAXRSUtils.java:594)
 at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:495)
 at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:442)
 at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:397)
 at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:182)
 at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:65)
 at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
 at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
 at 
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99)
 at 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:337)
 at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:145)
 at 
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:163)
 at 
org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:145)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
 at 
org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
 at 
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
 at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)

The above print out is generated as:

//this is registered as a provider.
RuntimeExceptionMapper.java:
    private String generateMessage(RuntimeException fault, String subject){
        String appDir = new File(".").getAbsolutePath();

        //TODO: turn this to html for better viewing.
        StringBuffer sb = new StringBuffer();
        sb.append("\r\n");
        sb.append("\r\nApplication location: ").append(appDir);
        sb.append("\r\n");
        sb.append("\r\nProblem encountered: 
").append((fault.getMessage()==null || 
fault.getMessage().length()<1)?"No message":fault.getMessage());
        sb.append("\r\n");
        sb.append("\r\nStack trace: ");
       
        for(StackTraceElement ste : fault.getStackTrace()){
            sb.append("\t").append(ste.toString()).append("\r\n");
        }

        return sb.toString();
    }

The JAXRSInInterceptor in the stacktrace led me to somewhere useful in 
checking where it failed. I saw this log earlier up:

[25/Mar/2009:04:33:33] failure (24718): for host 222.127.215.98 trying 
to GET /some/domain/MyObjects/search, service-j2ee reports: Parameter 
Class some.domain.SearchObject has no constructor with single String 
parameter, static valueOf(String) or fromString(String) methods

I am going to modify my code to include all the cause exceptions when 
available. But would it be possible to echo the message up the stream? I 
mean, it seems unnecessary to include all the causes when a message from 
the root cause echoed at the latest exception could easily give an idea 
of what caused the problem.

Thanks.

Gabo

Mime
View raw message