You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Charles Moulliard (JIRA)" <ji...@apache.org> on 2009/11/24 17:45:52 UTC

[jira] Created: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Response received is of type java.lang.String instead of javax.ws.rs.core.Response
----------------------------------------------------------------------------------

                 Key: CAMEL-2224
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-cxf
    Affects Versions: 2.1.0
            Reporter: Charles Moulliard
         Attachments: camel-cxf-rest-issue.zip

{code}
D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
11/
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=iso-8859-1
Content-Length: 256
Server: Jetty(6.1.x)

<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
{code}

See the code in attachment

Here is the config of apache karaf feature 

{code}
#
# Comma separated list of features repositories to register by default
#
featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml


#
# Comma separated list of features to install at startup
# 

featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56106#action_56106 ] 

Charles Moulliard edited comment on CAMEL-2224 at 11/25/09 8:35 AM:
--------------------------------------------------------------------

THE REQUEST SEND WAS NOT CORRECT :

If I use the following, everything works fine (-d has been added) 

{code}
curl -i  -H "Accept: application/xml" -H "Content-Type: application/xml" -d "<Incident><incidentId>555</incidentId><givenName>chm</givenName></Incident>" -X POST http://localhost:8181/cxf/camel-rest-example/reportservice/incidents

HTTP/1.1 200 OK
Content-Type: application/xml
Date: Wed, 25 Nov 2009 16:27:02 GMT
Content-Length: 130
Server: Jetty(6.1.x)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Incident><incidentId>126</incidentId><givenName>chm</givenName></Incident>
{code}

Here is the trace from camel / cxfrs / apache karaf

{code}
ID: 46
Address: /cxf/camel-rest-example/reportservice/incidents
Encoding: UTF-8
Content-Type: application/xml; charset=UTF-8
Headers: {content-type=[application/xml; charset=UTF-8], connection=[keep-alive], Host=[localhost:8181], Content-Length=[78], User-Agent=[Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3], Pragma=[no-cache], Cache-Control=[no-cache], Accept-Language=[en-us,en;q=0.5], Accept-Charset=[ISO-8859-1,utf-8;q=0.7,*;q=0.7], Keep-Alive=[300], accept-encoding=[gzip,deflate], Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8], Content-Type=[application/xml; charset=UTF-8]}
Payload: <Incident>
<incidentId>555</incidentId>
<givenName>chm</givenName>
</Incident>
--------------------------------------
17:23:37,882 | INFO  | 1979395@qtp0-3   | LoggingOutInterceptor            | ngOutInterceptor$LoggingCallback  160 | Outbound Message
---------------------------
ID: 46
Encoding: 
Content-Type: application/xhtml+xml
Headers: {Date=[Wed, 25 Nov 2009 16:23:37 GMT]}
Payload: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Incident><incidentId>125</incidentId><givenName>chm</givenName></Incident>
{code}

QUESTION : WHY DO WE HAVE TO SEND PARAMETER (<Incident><incidentId>555</incidentId><givenName>chm</givenName></Incident>) AS NORMALY A NEW OBJECT WILL BE CREATED BY THE SERVICE HEREAFTER ?

{code}
    @POST
    @Path("/incidents/")
    @Consumes("application/xml")
    public Response addIncident(Incident incident) {
        incident.setIncidentId(++currentId);

        incidents.put(incident.getIncidentId(), incident);
        
        return Response.ok(incident).build();
    }
{code}

If I compare with the test example, no parameters are send : 

{code}
    @Test
    public void testPostConsumer() throws Exception {
        PostMethod post = new PostMethod("http://localhost:9000/customerservice/customers");
        post.addRequestHeader("Accept" , "text/xml");
        RequestEntity entity = new StringRequestEntity(POST_REQUEST, "text/xml", "ISO-8859-1");
        post.setRequestEntity(entity);
        HttpClient httpclient = new HttpClient();

        try {
            assertEquals(200, httpclient.executeMethod(post));
            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                    post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }

    } 
{code}


      was (Author: cmoulliard):
    THE REQUEST SEND WAS NOT CORRECT :

If I use the following, everything works fine (-d has been added) 

curl -i  -H "Accept: application/xml" -H "Content-Type: application/xml" -d "<Incident><incidentId>555</incidentId><givenName>chm</givenName></Incident>" -X POST http://localhost:8181/cxf/camel-rest-example/reportservice/incidents

HTTP/1.1 200 OK
Content-Type: application/xml
Date: Wed, 25 Nov 2009 16:27:02 GMT
Content-Length: 130
Server: Jetty(6.1.x)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Incident><incidentId>126</incidentId><givenName>chm</givenName></Incident>

Here is the trace

ID: 46
Address: /cxf/camel-rest-example/reportservice/incidents
Encoding: UTF-8
Content-Type: application/xml; charset=UTF-8
Headers: {content-type=[application/xml; charset=UTF-8], connection=[keep-alive], Host=[localhost:8181], Content-Length=[78], User-Agent=[Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3], Pragma=[no-cache], Cache-Control=[no-cache], Accept-Language=[en-us,en;q=0.5], Accept-Charset=[ISO-8859-1,utf-8;q=0.7,*;q=0.7], Keep-Alive=[300], accept-encoding=[gzip,deflate], Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8], Content-Type=[application/xml; charset=UTF-8]}
Payload: <Incident>
<incidentId>555</incidentId>
<givenName>chm</givenName>
</Incident>
--------------------------------------
17:23:37,882 | INFO  | 1979395@qtp0-3   | LoggingOutInterceptor            | ngOutInterceptor$LoggingCallback  160 | Outbound Message
---------------------------
ID: 46
Encoding: 
Content-Type: application/xhtml+xml
Headers: {Date=[Wed, 25 Nov 2009 16:23:37 GMT]}
Payload: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Incident><incidentId>125</incidentId><givenName>chm</givenName></Incident>


QUESTION : WHY DO WE HAVE TO SEND PARAMETER (<Incident><incidentId>555</incidentId><givenName>chm</givenName></Incident>) AS NORMALY A NEW OBJECT WILL BE CREATED BY THE SERVICE HEREAFTER ?

    @POST
    @Path("/incidents/")
    @Consumes("application/xml")
    public Response addIncident(Incident incident) {
        incident.setIncidentId(++currentId);

        incidents.put(incident.getIncidentId(), incident);
        
        return Response.ok(incident).build();
    }

If I compare with the test example, no parameters are send : 

    @Test
    public void testPostConsumer() throws Exception {
        PostMethod post = new PostMethod("http://localhost:9000/customerservice/customers");
        post.addRequestHeader("Accept" , "text/xml");
        RequestEntity entity = new StringRequestEntity(POST_REQUEST, "text/xml", "ISO-8859-1");
        post.setRequestEntity(entity);
        HttpClient httpclient = new HttpClient();

        try {
            assertEquals(200, httpclient.executeMethod(post));
            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                    post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }

    } 
--------------------------------------

  
> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-context.xml, camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Moulliard updated CAMEL-2224:
-------------------------------------

    Attachment: camel-cxf-rest-issue.zip

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Moulliard updated CAMEL-2224:
-------------------------------------

    Attachment: camel-context.xml

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-context.xml, camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Moulliard updated CAMEL-2224:
-------------------------------------

    Assignee: Willem Jiang

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56072#action_56072 ] 

Sergey Beryozkin commented on CAMEL-2224:
-----------------------------------------

Hi Willem, we've identified that an object which is returned from a jaxrs service endpoint is somehow lost twice, first it is misrepresented as
Object[] and next it ends up being of  String class...

If you're overwhelmed with some other priority work then please free to reassign this issue to me

thanks, Sergey

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Moulliard closed CAMEL-2224.
------------------------------------

    Resolution: Fixed

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-context.xml, camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56085#action_56085 ] 

Sergey Beryozkin commented on CAMEL-2224:
-----------------------------------------

So it should be an easy fix ?

The exception which is reported above is originated from the custom cxf jaxrs ResponseHandler...
As was discussed in the other JIRA which you closed yesterday, the CXF JAXRSOutInterceptor was getting 
a response object being misrepresented as Object[]. So yesterday, 
Charles tried to to check what was inside that Object[] using a custom ResponseHandler. 

We thought that the object the IncidentService was returning (JAXRs Response in that specific case) was wrapped 
as the first element of Object[], so the custom ResponseHandler tried to cast the first element to Response...



> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang updated CAMEL-2224:
--------------------------------

    Description: 
{code}
D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
11/
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=iso-8859-1
Content-Length: 256
Server: Jetty(6.1.x)

<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
{code}

See the code in attachment

Here is the config of apache karaf feature 

{code}
#
# Comma separated list of features repositories to register by default
#
featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml


#
# Comma separated list of features to install at startup
# 

featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
{code}

camel + code is present in the zip. They are three bundles 
- one generating the feature file of the project
- another containing the REST service
- and the last camel route

here is the log on camel

{code}
17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

{code}

  was:
{code}
D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
11/
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=iso-8859-1
Content-Length: 256
Server: Jetty(6.1.x)

<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
{code}

See the code in attachment

Here is the config of apache karaf feature 

{code}
#
# Comma separated list of features repositories to register by default
#
featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml


#
# Comma separated list of features to install at startup
# 

featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
{code}

camel + code is present in the zip. They are three bundles 
- one generating the feature file of the project
- another containing the REST service
- and the last camel route

here is the log on camel

{code}
17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

{code}


> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56098#action_56098 ] 

Charles Moulliard commented on CAMEL-2224:
------------------------------------------

@Willem

Why the body is empty (question coming from Sergey) ?

Here is a trace :

{code}
ID: 1
Address: /cxf/camel-rest-example/reportservice/incidents
Encoding: ISO-8859-1
Content-Type: application/xml
Headers: {content-type=[application/xml], Host=[localhost:8080], User-Agent=[curl/7.19.5 (i586-pc-mingw32msvc) libcurl/7.19.5 zlib/1.2.3], Content-Type=[application/xml], Accept=[application/xml]}
Payload:
--------------------------------------
12:56:49,960 | INFO | 31816416@qtp2-6 | LoggingOutInterceptor | ngOutInterceptor$LoggingCallback 160 | Outbound Message
---------------------------
ID: 1
Encoding:
Content-Type: text/plain
Headers: {Content-Type=[text/plain], Date=[Wed, 25 Nov 2009 11:56:49 GMT]}
Payload: JAXBException occurred : Premature end of file.. Premature end of file..
I come back in 1 hour (lunch + stuff to do for my family)

{code}

using tcpTrace

{code}
<connection>
<loggedAt xsi:type='xsd:timeInstant'>2009-11-25T14:41:19+-1:00</loggedAt>
<connectionOpened xsi:type='xsd:timeInstant'>2009-11-25T14:41:19+-1:00</connectionOpened>
<connectionClosed xsi:type='xsd:timeInstant'>2009-11-25T14:41:19+-1:00</connectionClosed>
<source>127.0.0.1</source>
<destination>localhost:8080</destination>
<bytesClientToServer>216</bytesClientToServer>
<bytesServerToClient>216</bytesServerToClient>
<clientData>POST /cxf/camel-rest-example/reportservice/incidents HTTP/1.1
User-Agent: curl/7.19.5 (i586-pc-mingw32msvc) libcurl/7.19.5 zlib/1.2.3
Host: localhost:9999
Accept: application/xml
Content-Type: application/xml

</clientData>
<serverData>HTTP/1.1 500 Internal Server Error
Content-Type: text/plain
Date: Wed, 25 Nov 2009 13:41:19 GMT
Content-Length: 73
Server: Jetty(6.1.x)

JAXBException occurred : Premature end of file.. Premature end of file.. </serverData>
</connection>
{code}

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-context.xml, camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56090#action_56090 ] 

Charles Moulliard commented on CAMEL-2224:
------------------------------------------

Only the camel-context file has been changed. I put it in attachment

I have been able to generate more error in the log by adding Context-Type in the POST request :

{code}
11:45:50,382 | WARN  | 31816416@qtp2-6  | WebApplicationExceptionMapper    | pl.WebApplicationExceptionMapper   52 | WebApplicationException has been caught : cause is javax.xml.stream.XMLStreamException
11:49:11,054 | WARN  | 31816416@qtp2-6  | AbstractJAXBProvider             | rs.provider.AbstractJAXBProvider  544 | javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: Premature end of file.]
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:65)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:514)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:215)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:191)
	at org.apache.cxf.jaxrs.provider.JAXBElementProvider.unmarshalFromInputStream(JAXBElementProvider.java:200)
	at org.apache.cxf.jaxrs.provider.JAXBElementProvider.doUnmarshal(JAXBElementProvider.java:183)
	at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:154)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:954)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:560)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:525)
{code}

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-context.xml, camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Moulliard updated CAMEL-2224:
-------------------------------------

    Description: 
{code}
D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
11/
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=iso-8859-1
Content-Length: 256
Server: Jetty(6.1.x)

<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
{code}

See the code in attachment

Here is the config of apache karaf feature 

{code}
#
# Comma separated list of features repositories to register by default
#
featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml


#
# Comma separated list of features to install at startup
# 

featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
{code}

camel + code is present in the zip. They are three bundles 
- one generating the feature file of the project
- another containing the REST service
- and the last camel route

here is the log on camel

{code}
17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

{code}

  was:
{code}
D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
11/
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=iso-8859-1
Content-Length: 256
Server: Jetty(6.1.x)

<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
{code}

See the code in attachment

Here is the config of apache karaf feature 

{code}
#
# Comma separated list of features repositories to register by default
#
featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml


#
# Comma separated list of features to install at startup
# 

featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
{code}


> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56087#action_56087 ] 

Charles Moulliard commented on CAMEL-2224:
------------------------------------------

@Sergey,

The call of a GET service works fine.

Concerning the call to a POST, here is the error displayed in the console now :

{code}
10:59:44,132 | DEBUG | ervice/incidents | jetty                            | service.jetty.internal.JCLLogger   85 | REQUEST /cxf/camel-rest-example/reportservice/incidents on org.mortbay.jetty.HttpConnection@136f665
10:59:44,132 | DEBUG | ervice/incidents | ServerModel                      | eb.service.spi.model.ServerModel  268 | Matching [/cxf/camel-rest-example/reportservice/incidents]...
10:59:44,132 | DEBUG | ervice/incidents | ServerModel                      | eb.service.spi.model.ServerModel  286 | Path [/cxf/camel-rest-example/reportservice/incidents] matched to {pattern=/cxf/.*,model=ServletModel{id=org.ops4j.pax.web.service.spi.model.ServletModel-6,name=cxf-osgi-transport-servlet,urlPatterns=[/cxf/*],alias=/cxf,servlet=org.apache.cxf.transport.http_osgi.SpringOsgiServlet@23a559,initParams={org.springframework.osgi.bean.name=osgiServlet, alias=/cxf, service.id=78, objectClass=[Ljava.lang.String;@113de03, Bundle-SymbolicName=org.apache.cxf.bundle, servlet-name=cxf-osgi-transport-servlet, Bundle-Version=2.2.5},context=ContextModel{id=org.ops4j.pax.web.service.spi.model.ContextModel-4,name=,httpContext=DefaultHttpContext{bundle=org.apache.cxf.bundle [96]},contextParams={}}}}
10:59:44,132 | DEBUG | ervice/incidents | HttpServiceContext               | etty.internal.HttpServiceContext  110 | Handling request for [/cxf/camel-rest-example/reportservice/incidents] using http context [DefaultHttpContext{bundle=org.apache.cxf.bundle [96]}]
10:59:44,132 | DEBUG | ervice/incidents | jetty                            | service.jetty.internal.JCLLogger   85 | sessionManager=org.mortbay.jetty.servlet.HashSessionManager@16a72f2
10:59:44,132 | DEBUG | ervice/incidents | jetty                            | service.jetty.internal.JCLLogger   85 | session=null
10:59:44,132 | DEBUG | ervice/incidents | jetty                            | service.jetty.internal.JCLLogger   85 | servlet=cxf-osgi-transport-servlet
10:59:44,132 | DEBUG | ervice/incidents | jetty                            | service.jetty.internal.JCLLogger   85 | chain=null
10:59:44,148 | DEBUG | ervice/incidents | jetty                            | service.jetty.internal.JCLLogger   85 | servlet holder=cxf-osgi-transport-servlet
10:59:44,148 | DEBUG | ervice/incidents | OsgiServlet                      | .http_osgi.OsgiServletController  276 | Service http request on thread: Thread[31816416@qtp2-6 - /cxf/camel-rest-example/reportservice/incidents,5,main]
10:59:44,148 | DEBUG | ervice/incidents | AbstractHTTPDestination          | ort.http.AbstractHTTPDestination  166 | Request Headers: {Host=[localhost:8080], User-Agent=[curl/7.19.5 (i586-pc-mingw32msvc) libcurl/7.19.5 zlib/1.2.3], Content-Type=[null], Accept=[application/xml]}
10:59:44,148 | DEBUG | ervice/incidents | PhaseInterceptorChain            | .cxf.phase.PhaseInterceptorChain  587 | Chain org.apache.cxf.phase.PhaseInterceptorChain@1a0a5fc was created. Current flow:
  unmarshal [JAXRSInInterceptor]
  pre-logical [OneWayProcessorInterceptor]
  invoke [ServiceInvokerInterceptor]
  post-invoke [OutgoingChainInterceptor]

10:59:44,148 | DEBUG | ervice/incidents | PhaseInterceptorChain            | .cxf.phase.PhaseInterceptorChain  233 | Invoking handleMessage on interceptor org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor@1f1788a
10:59:44,148 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  223 | Trying to select a resource class /reportservice/incidents, request path : {1}
10:59:44,148 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  279 | Trying to select a resource operation on the resource class org.apache.camel.example.reportincident.restful.ReportIncidentService
10:59:44,148 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  396 | No method match, method name : getIncident, request path : /incidents, method @Path : /incidents/{id}/, HTTP Method : POST, method HTTP Method : GET, ContentType : */*, method @Consumes : */*,, Accept : application/xml,, method @Produces : application/xml,.
10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  396 | No method match, method name : updateIncident, request path : /incidents, method @Path : /incidents/, HTTP Method : POST, method HTTP Method : PUT, ContentType : */*, method @Consumes : */*,, Accept : application/xml,, method @Produces : */*,.
10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  332 | Resource operation addIncident may get selected
10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  396 | No method match, method name : addIncidentUniqueResponseCode, request path : /incidents, method @Path : /incidentsUniqueResponseCode/, HTTP Method : POST, method HTTP Method : POST, ContentType : */*, method @Consumes : */*,, Accept : application/xml,, method @Produces : */*,.
10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  396 | No method match, method name : deleteIncident, request path : /incidents, method @Path : /incidents/{id}/, HTTP Method : POST, method HTTP Method : DELETE, ContentType : */*, method @Consumes : */*,, Accept : application/xml,, method @Produces : */*,.
10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  355 | Resource operation addIncident on the resource class org.apache.camel.example.reportincident.restful.ReportIncidentService has been selected
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  195 | Request path is: /reportservice/incidents
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  196 | Request HTTP method is: POST
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  197 | Request contentType is: */*
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  198 | Accept contentType is: application/xml
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  200 | Found operation: addIncident
10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  556 | No Content-Type specified for HTTP POST
10:59:44,163 | WARN  | ervice/incidents | WebApplicationExceptionMapper    | pl.WebApplicationExceptionMapper   52 | WebApplicationException has been caught : cause is javax.xml.stream.XMLStreamException
10:59:44,163 | DEBUG | ervice/incidents | PhaseInterceptorChain            | .cxf.phase.PhaseInterceptorChain  233 | Invoking handleMessage on interceptor org.apache.cxf.interceptor.OneWayProcessorInterceptor@2332b6
10:59:44,179 | DEBUG | ervice/incidents | PhaseInterceptorChain            | .cxf.phase.PhaseInterceptorChain  233 | Invoking handleMessage on interceptor org.apache.cxf.interceptor.ServiceInvokerInterceptor@d66992
10:59:44,179 | DEBUG | ervice/incidents | PhaseInterceptorChain            | .cxf.phase.PhaseInterceptorChain  233 | Invoking handleMessage on interceptor org.apache.cxf.interceptor.OutgoingChainInterceptor@ad0636
10:59:44,179 | DEBUG | ervice/incidents | OutgoingChainInterceptor         | rceptor.OutgoingChainInterceptor  163 | Interceptors contributed by bus: []
10:59:44,179 | DEBUG | ervice/incidents | OutgoingChainInterceptor         | rceptor.OutgoingChainInterceptor  167 | Interceptors contributed by service: []
10:59:44,179 | DEBUG | ervice/incidents | OutgoingChainInterceptor         | rceptor.OutgoingChainInterceptor  171 | Interceptors contributed by endpoint: [org.apache.cxf.interceptor.MessageSenderInterceptor@172f5d6]
10:59:44,179 | DEBUG | ervice/incidents | OutgoingChainInterceptor         | rceptor.OutgoingChainInterceptor  177 | Interceptors contributed by binding: [org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor@69dc53]
10:59:44,179 | DEBUG | ervice/incidents | PhaseInterceptorChain            | .cxf.phase.PhaseInterceptorChain  587 | Chain org.apache.cxf.phase.PhaseInterceptorChain@1ffe90d was created. Current flow:
  prepare-send [MessageSenderInterceptor]
  marshal [JAXRSOutInterceptor]
{code}


> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56083#action_56083 ] 

Willem Jiang commented on CAMEL-2224:
-------------------------------------

@Sergey,

I just have a chance to talk with Charles,  the error is caused by no response sending back the camel-cxfrs endpoint.

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56106#action_56106 ] 

Charles Moulliard commented on CAMEL-2224:
------------------------------------------

THE REQUEST SEND WAS NOT CORRECT :

If I use the following, everything works fine (-d has been added) 

curl -i  -H "Accept: application/xml" -H "Content-Type: application/xml" -d "<Incident><incidentId>555</incidentId><givenName>chm</givenName></Incident>" -X POST http://localhost:8181/cxf/camel-rest-example/reportservice/incidents

HTTP/1.1 200 OK
Content-Type: application/xml
Date: Wed, 25 Nov 2009 16:27:02 GMT
Content-Length: 130
Server: Jetty(6.1.x)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Incident><incidentId>126</incidentId><givenName>chm</givenName></Incident>

Here is the trace

ID: 46
Address: /cxf/camel-rest-example/reportservice/incidents
Encoding: UTF-8
Content-Type: application/xml; charset=UTF-8
Headers: {content-type=[application/xml; charset=UTF-8], connection=[keep-alive], Host=[localhost:8181], Content-Length=[78], User-Agent=[Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3], Pragma=[no-cache], Cache-Control=[no-cache], Accept-Language=[en-us,en;q=0.5], Accept-Charset=[ISO-8859-1,utf-8;q=0.7,*;q=0.7], Keep-Alive=[300], accept-encoding=[gzip,deflate], Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8], Content-Type=[application/xml; charset=UTF-8]}
Payload: <Incident>
<incidentId>555</incidentId>
<givenName>chm</givenName>
</Incident>
--------------------------------------
17:23:37,882 | INFO  | 1979395@qtp0-3   | LoggingOutInterceptor            | ngOutInterceptor$LoggingCallback  160 | Outbound Message
---------------------------
ID: 46
Encoding: 
Content-Type: application/xhtml+xml
Headers: {Date=[Wed, 25 Nov 2009 16:23:37 GMT]}
Payload: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Incident><incidentId>125</incidentId><givenName>chm</givenName></Incident>


QUESTION : WHY DO WE HAVE TO SEND PARAMETER (<Incident><incidentId>555</incidentId><givenName>chm</givenName></Incident>) AS NORMALY A NEW OBJECT WILL BE CREATED BY THE SERVICE HEREAFTER ?

    @POST
    @Path("/incidents/")
    @Consumes("application/xml")
    public Response addIncident(Incident incident) {
        incident.setIncidentId(++currentId);

        incidents.put(incident.getIncidentId(), incident);
        
        return Response.ok(incident).build();
    }

If I compare with the test example, no parameters are send : 

    @Test
    public void testPostConsumer() throws Exception {
        PostMethod post = new PostMethod("http://localhost:9000/customerservice/customers");
        post.addRequestHeader("Accept" , "text/xml");
        RequestEntity entity = new StringRequestEntity(POST_REQUEST, "text/xml", "ISO-8859-1");
        post.setRequestEntity(entity);
        HttpClient httpclient = new HttpClient();

        try {
            assertEquals(200, httpclient.executeMethod(post));
            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                    post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }

    } 
--------------------------------------


> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-context.xml, camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56105#action_56105 ] 

Sergey Beryozkin commented on CAMEL-2224:
-----------------------------------------

Actually, it does look like it is 

User-Agent: curl/7.19.5 (i586-pc-mingw32msvc) libcurl/7.19.5 zlib/1.2.3


which sends an empty body

> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-context.xml, camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2224) Response received is of type java.lang.String instead of javax.ws.rs.core.Response

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56089#action_56089 ] 

Sergey Beryozkin commented on CAMEL-2224:
-----------------------------------------

Hi Charles, so given this log

10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  355 | Resource operation addIncident on the resource class org.apache.camel.example.reportincident.restful.ReportIncidentService has been selected
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  195 | Request path is: /reportservice/incidents
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  196 | Request HTTP method is: POST
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  197 | Request contentType is: */*
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  198 | Accept contentType is: application/xml
10:59:44,163 | DEBUG | ervice/incidents | JAXRSInInterceptor               | s.interceptor.JAXRSInInterceptor  200 | Found operation: addIncident
10:59:44,163 | DEBUG | ervice/incidents | JAXRSUtils                       | pache.cxf.jaxrs.utils.JAXRSUtils  556 | No Content-Type specified for HTTP POST

it appears that 

10:59:44,163 | WARN  | ervice/incidents | WebApplicationExceptionMapper    | pl.WebApplicationExceptionMapper   52 | WebApplicationException has been caught : cause is javax.xml.stream.XMLStreamException


JAXBElementProvider tried to read from XMLStreamReader (more logging would help).
CXF JAXRS itself does read directly from the request InputsStream but will try to read from 
 XMLStreamReader if it is available on the message. At the moment I can not tell where this (custom) 
XMLStreamReader is coming from.

I'm on my gmail now and #cxf in codehouze. Lets chat there. Alternatively please create a CXF JIRA with the copy of your latest project

thanks



> Response received is of type java.lang.String instead of javax.ws.rs.core.Response
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2224
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2224
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.1.0
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>         Attachments: camel-cxf-rest-issue.zip
>
>
> {code}
> D:\Soft\opensource\curl-7.19.5-win32-nossl>curl -i -H "Accept: application/xml" http://localhost:8080/cxf/camel-rest-example/reportservice/incidents/1
> 11/
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml; charset=iso-8859-1
> Content-Length: 256
> Server: Jetty(6.1.x)
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.ClassCa
> stException: java.lang.String cannot be cast to javax.ws.rs.core.Response</ns1:faultstring></ns1:XMLFault>
> {code}
> See the code in attachment
> Here is the config of apache karaf feature 
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.0.0/xml/features,mvn:org.apache.camel.karaf/features/2.1-SNAPSHOT/xml/features,jar:mvn:org.apache.camel.example/reportincident.restful.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
> #
> # Comma separated list of features to install at startup
> # 
> featuresBoot=spring,spring-dm,camel,http-reportingincident,spring-web,camel-cxf,reportincident
> {code}
> camel + code is present in the zip. They are three bundles 
> - one generating the feature file of the project
> - another containing the REST service
> - and the last camel route
> here is the log on camel
> {code}
> 17:34:22,155 | INFO  | xtenderThread-37 | ContextLoaderListener            | BundleApplicationContextListener   45 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.routing, config=osgibundle:/META-INF/spring/*.xml))
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> from(/camel-rest-example/) --> setHeader[CamelCxfRsUsingHttpAPI], Pattern:InOut, Headers:{CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], 
> CamelHttpMethod=GET, CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, operationName=getIncident, 
> CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, CamelAcceptContentType=application/xml, CamelHttpCharacterEncoding=ISO-8859-1}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,701 | INFO  | 14218728@qtp1-1  | Tracer                           | rg.apache.camel.processor.Logger   88 | 970d2b95-93d9-4319-a5fd-4906ec9a9a9a >>> setHeader[CamelCxfRsUsingHttpAPI] --> log://org.apache.camel.example.reportIncident?level=INFO, Pattern:InOut, Headers:{CamelHttpPath=/camel-rest-example/reportservice/incidents/111/, CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents/111/, 
> CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@82fd0f], CamelCxfRsUsingHttpAPI=True, CamelCxfRsResponseClass=class org.apache.camel.example.reportincident.restful.Incident, 
> CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=GET, operationName=getIncident, CamelAcceptContentType=application/xml}, BodyType:Object[], Body:[Ljava.lang.Object;@16237fd
> 17:34:27,717 | INFO  | 14218728@qtp1-1  | reportIncident                   | rg.apache.camel.processor.Logger   88 | Exchange[BodyType:Object[], Body:[Ljava.lang.Object;@16237fd]
> 17:34:27,717 | WARN  | 14218728@qtp1-1  | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException: java.lang.String cannot be cast to javax.ws.rs.core.Response
> 	at org.apache.camel.example.reportincident.restful.OverrideResponseHandler.handleResponse(OverrideResponseHandler.java:22)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:131)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
> 	at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:324)
> 	at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:112)
> 	at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
> 	at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> 	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.