You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Gabo Manuel <km...@solegysystems.com> on 2009/03/25 06:10:50 UTC

[CXF2.2] Runtime exception with no message

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

Re: [CXF2.2] Runtime exception with no message

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Gabo

It apperas that the root cause of it is that a subresource method is invoked and it returns null.
Now, JAXRSInvoker does check for 'null' but I can see now that the check is faulty, as the null is wrapped in a CXF specific wrapper 
initially....I'll update the code now....Can you confirm please that your subresource method return null ?

Cheers, SErgey

> Hi Gabo
>
> NPE is always a bug - so I need to investigate.
> Can you please post the spring configuration which you use (in sample form but with the same relationships between beans, etc...) 
> ?
> And a sample MyService bean ?
> By the way is there any chance that spring 2.0.6 is still hanging around somewhere on the IPlanet's classpath, perhaps on the 
> system one ?
>
>> As additional info:
>> "/some/path/MyService/search" is meant to match an annotated method as follows:
>>    @GET
>>    @Path("/search/")
>>    public MyObjects getMyObjects(
>>            @HeaderParam("uri")
>>            SearchObject so){
>>
>> just missed the '/' after the keyword 'search'
>
> "/some/path/MyService/search" has to match this method....Or do you mean something else ?
>
> Thanks, Sergey
>
>> Hi All,
>>
>> On another occassion. The cause of the problem is obviously the path used. Not sure why a NPE was thrown instead.
>>
>> [25/Mar/2009:08:04:49] info (26158): for host 222.127.215.98 trying to GET 
>> /some/path/MyService/searchobjectid='1'+and+balance+between+1+and+2/objectid/1/10, service-j2ee reports: Interceptor has thrown 
>> exception, unwinding now
>> java.lang.NullPointerException
>>        at org.apache.cxf.common.util.SpringAopClassHelper.getRealClassInternal(SpringAopClassHelper.java:47)
>>        at org.apache.cxf.common.util.ClassHelper.getRealClass(ClassHelper.java:47)
>>        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:160)
>>        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:70)
>>        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
>>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
>>        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>>        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>>        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
>>        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
>>        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)
>>
>> As additional info:
>> "/some/path/MyService/search" is meant to match an annotated method as follows:
>>    @GET
>>    @Path("/search/")
>>    public MyObjects getMyObjects(
>>            @HeaderParam("uri")
>>            SearchObject so){
>>
>> just missed the '/' after the keyword 'search'
>>
>> Gabo
>>
>>
>> Gabo Manuel wrote:
>>> Hi All,
>>>
>>> Just to add, the exception does not have a cause. fault.getCause() returns null. :(
>>>
>>> Gabo
>>>
>>> Gabo Manuel wrote:
>>>> 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
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> No virus found in this incoming message.
>>>> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>>>>
>>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>>>
>>>
> 


Re: [CXF2.2] Runtime exception with no message

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Gabo

NPE is always a bug - so I need to investigate.
Can you please post the spring configuration which you use (in sample form but with the same relationships between beans, etc...) ?
And a sample MyService bean ?
By the way is there any chance that spring 2.0.6 is still hanging around somewhere on the IPlanet's classpath, perhaps on the system 
one ?

> As additional info:
> "/some/path/MyService/search" is meant to match an annotated method as follows:
>    @GET
>    @Path("/search/")
>    public MyObjects getMyObjects(
>            @HeaderParam("uri")
>            SearchObject so){
>
> just missed the '/' after the keyword 'search'

"/some/path/MyService/search" has to match this method....Or do you mean something else ?

Thanks, Sergey

> Hi All,
>
> On another occassion. The cause of the problem is obviously the path used. Not sure why a NPE was thrown instead.
>
> [25/Mar/2009:08:04:49] info (26158): for host 222.127.215.98 trying to GET 
> /some/path/MyService/searchobjectid='1'+and+balance+between+1+and+2/objectid/1/10, service-j2ee reports: Interceptor has thrown 
> exception, unwinding now
> java.lang.NullPointerException
>        at org.apache.cxf.common.util.SpringAopClassHelper.getRealClassInternal(SpringAopClassHelper.java:47)
>        at org.apache.cxf.common.util.ClassHelper.getRealClass(ClassHelper.java:47)
>        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:160)
>        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:70)
>        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
>        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
>        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
>        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)
>
> As additional info:
> "/some/path/MyService/search" is meant to match an annotated method as follows:
>    @GET
>    @Path("/search/")
>    public MyObjects getMyObjects(
>            @HeaderParam("uri")
>            SearchObject so){
>
> just missed the '/' after the keyword 'search'
>
> Gabo
>
>
> Gabo Manuel wrote:
>> Hi All,
>>
>> Just to add, the exception does not have a cause. fault.getCause() returns null. :(
>>
>> Gabo
>>
>> Gabo Manuel wrote:
>>> 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
>>> ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>>>
>>>
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>>
>> 


Re: [CXF2.2] Runtime exception with no message

Posted by Gabo Manuel <km...@solegysystems.com>.
Hi All,

On another occassion. The cause of the problem is obviously the path 
used. Not sure why a NPE was thrown instead.

[25/Mar/2009:08:04:49] info (26158): for host 222.127.215.98 trying to 
GET 
/some/path/MyService/searchobjectid='1'+and+balance+between+1+and+2/objectid/1/10, 
service-j2ee reports: Interceptor has thrown exception, unwinding now
java.lang.NullPointerException
        at 
org.apache.cxf.common.util.SpringAopClassHelper.getRealClassInternal(SpringAopClassHelper.java:47)
        at 
org.apache.cxf.common.util.ClassHelper.getRealClass(ClassHelper.java:47)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:160)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:70)
        at 
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at 
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at 
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
        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)

As additional info:
"/some/path/MyService/search" is meant to match an annotated method as 
follows:
    @GET
    @Path("/search/")
    public MyObjects getMyObjects(
            @HeaderParam("uri")
            SearchObject so){

just missed the '/' after the keyword 'search'

Gabo


Gabo Manuel wrote:
> Hi All,
>
> Just to add, the exception does not have a cause. fault.getCause() 
> returns null. :(
>
> Gabo
>
> Gabo Manuel wrote:
>> 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
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 
>> 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>>
>>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>
>   

Re: [CXF2.2] Runtime exception with no message

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Gabo

By the way, a WebApplicationException instance which is thrown in this case contains Response object with the message.
Perhaps you might want to provide both RuntimeException and WebApplicationException mappers or explicitly check in the 
RuntimeException mapper if it's WebApplicationException or not. There's a default WebApplicationException mapper there your 
RuntimeException one is chosen instead of it.

Cheers, Sergey

----- Original Message ----- 
From: "Sergey Beryozkin" <sb...@progress.com>
To: <us...@cxf.apache.org>
Sent: Wednesday, March 25, 2009 11:13 AM
Subject: Re: [CXF2.2] Runtime exception with no message


> Hi Gabo
>
>> Just to add, the exception does not have a cause. fault.getCause() returns null. :(
>
> I think it's because in this case (no appropriate constructor or factory nethod is available) the RuntimeException you get is the 
> original WebApplicationException and thus there's no cause is available.
>
> But I'd likr to clarify a bit what is it in the error reporting procedure that you'd like us to enhance.
>
>>> 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
>
> So the log is available which is good. By the way, you may also want to try CXF JAXRS ParameterHandler  extensions
> if neither of the above conditions can be satisfied and when the code modification is not an option...
>
>>>
>>> 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.
>
> I'm sorry - can you clarify this bit ?
>
> Thanks, Sergey
>
> ----- Original Message ----- 
> From: "Gabo Manuel" <km...@solegysystems.com>
> To: <us...@cxf.apache.org>
> Sent: Wednesday, March 25, 2009 5:35 AM
> Subject: Re: [CXF2.2] Runtime exception with no message
>
>
>> Hi All,
>>
>> Just to add, the exception does not have a cause. fault.getCause() returns null. :(
>>
>> Gabo
>>
>> Gabo Manuel wrote:
>>> 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
>>> ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>>>
>>>
> 


Re: [CXF2.2] Runtime exception with no message

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Gabo

> Just to add, the exception does not have a cause. fault.getCause() returns null. :(

I think it's because in this case (no appropriate constructor or factory nethod is available) the RuntimeException you get is the 
original WebApplicationException and thus there's no cause is available.

But I'd likr to clarify a bit what is it in the error reporting procedure that you'd like us to enhance.

>> 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

So the log is available which is good. By the way, you may also want to try CXF JAXRS ParameterHandler  extensions
if neither of the above conditions can be satisfied and when the code modification is not an option...

>>
>> 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.

I'm sorry - can you clarify this bit ?

Thanks, Sergey

----- Original Message ----- 
From: "Gabo Manuel" <km...@solegysystems.com>
To: <us...@cxf.apache.org>
Sent: Wednesday, March 25, 2009 5:35 AM
Subject: Re: [CXF2.2] Runtime exception with no message


> Hi All,
>
> Just to add, the exception does not have a cause. fault.getCause() returns null. :(
>
> Gabo
>
> Gabo Manuel wrote:
>> 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
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>>
>> 


Re: [CXF2.2] Runtime exception with no message

Posted by Gabo Manuel <km...@solegysystems.com>.
Hi All,

Just to add, the exception does not have a cause. fault.getCause() 
returns null. :(

Gabo

Gabo Manuel wrote:
> 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
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.238 / Virus Database: 270.11.25/2019 - Release Date: 03/23/09 18:51:00
>
>