[ 
https://issues.apache.org/jira/browse/CXF-7344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15999359#comment-15999359
 ] 

Karthik Prasad commented on CXF-7344:
-------------------------------------

Hi I'm still getting the error.

Here is the modified stackoverflow class

@Service
@Path("/kp")
public class KPRest {

        @Autowired
        private JmsTemplate jmsTemplate;
        
        @POST
        @Path("/hello")
        @Consumes(MediaType.TEXT_PLAIN)
        @Produces(MediaType.TEXT_PLAIN)
        @Oneway
        public String hello(String hello){
                System.out.println(hello);
                return "Hello from CXF";
        }
        
        @GET
        @Path("/send-message")
        public String sendMessage(){
                jmsTemplate.send("cxf_queue", (session)->{
                        TextMessage msg = session.createTextMessage();
                        msg.setBooleanProperty("OnewayRequest", true);
                        
msg.setBooleanProperty(org.apache.cxf.message.Message.ONE_WAY_REQUEST, true);
                        
//msg.setStringProperty(org.apache.cxf.message.Message.CONTENT_TYPE,MediaType.TEXT_PLAIN);
                        
msg.setStringProperty(JMSSpecConstants.CONTENTTYPE_FIELD,MediaType.TEXT_PLAIN);
                        
msg.setStringProperty(org.apache.cxf.message.Message.REQUEST_URI.replace(".", 
"__"), "/kp/hello");
                        
msg.setStringProperty(org.apache.cxf.message.Message.HTTP_REQUEST_METHOD.replace(".",
 "__"), "POST");
                        msg.setText("JMS message");
                        return msg;
                });
                return "Sent message";
        }
                
}


Here is stacktrace.


2017-05-06 14:24:11.727 DEBUG 14460 --- [nio-8080-exec-1] 
o.a.cxf.phase.PhaseInterceptorChain      : Invoking handleMessage on 
interceptor org.apache.cxf.interceptor.LoggingOutInterceptor@209ae4bf
2017-05-06 14:24:11.727  WARN 14460 --- [pool-7-thread-1] 
o.a.cxf.phase.PhaseInterceptorChain      : Interceptor for 
{http://rest.cxf.swasthik.kp.com/}KPRest has thrown exception, unwinding now

java.lang.NullPointerException: null
        at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:298) 
~[cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:288) 
~[cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvider.java:45)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvider.java:36)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1354)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1305) 
~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:829) 
~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:793) 
~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:77)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:309)
 ~[cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
 [cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.transport.jms.JMSDestination.onMessage(JMSDestination.java:235) 
[cxf-rt-transports-jms-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.transport.jms.util.PollingMessageListenerContainer$Poller.run(PollingMessageListenerContainer.java:65)
 [cxf-rt-transports-jms-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[na:1.8.0_102]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[na:1.8.0_102]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]

2017-05-06 14:24:11.727 DEBUG 14460 --- [nio-8080-exec-1] 
o.a.cxf.phase.PhaseInterceptorChain      : Invoking handleMessage on 
interceptor org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor@4cfb25ce
2017-05-06 14:24:11.727 DEBUG 14460 --- [nio-8080-exec-1] 
o.a.c.j.interceptor.JAXRSOutInterceptor  : Response content type is: text/html
2017-05-06 14:24:11.727 DEBUG 14460 --- [nio-8080-exec-1] 
o.apache.cxf.ws.addressing.ContextUtils  : retrieving MAPs from context 
property javax.xml.ws.addressing.context.inbound
2017-05-06 14:24:11.727 DEBUG 14460 --- [nio-8080-exec-1] 
o.apache.cxf.ws.addressing.ContextUtils  : WS-Addressing - failed to retrieve 
Message Addressing Properties from context
2017-05-06 14:24:11.727  WARN 14460 --- [pool-7-thread-1] 
.c.t.j.u.PollingMessageListenerContainer : Exception while processing jms 
message in cxf. Rolling back

java.lang.RuntimeException: java.lang.NullPointerException
        at 
org.apache.cxf.transport.jms.JMSDestination.processExceptions(JMSDestination.java:275)
 ~[cxf-rt-transports-jms-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.transport.jms.JMSDestination.onMessage(JMSDestination.java:238) 
~[cxf-rt-transports-jms-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.transport.jms.util.PollingMessageListenerContainer$Poller.run(PollingMessageListenerContainer.java:65)
 ~[cxf-rt-transports-jms-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[na:1.8.0_102]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[na:1.8.0_102]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]
Caused by: java.lang.NullPointerException: null
        at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:298) 
~[cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:288) 
~[cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvider.java:45)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvider.java:36)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1354)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1305) 
~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:829) 
~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:793) 
~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:77)
 ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:309)
 ~[cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
 ~[cxf-core-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        at 
org.apache.cxf.transport.jms.JMSDestination.onMessage(JMSDestination.java:235) 
~[cxf-rt-transports-jms-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
        ... 4 common frames omitted

2017-05-06 14:24:11.728 DEBUG 14460 --- [nio-8080-exec-1] 
o.a.cxf.phase.PhaseInterceptorChain      : Invoking handleMessage on 
interceptor 
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@6224240e
2017-05-06 14:24:11.728  INFO 14460 --- [nio-8080-exec-1] 
o.a.c.interceptor.LoggingOutInterceptor  : Outbound Message
---------------------------
ID: 8
Response-Code: 200
Content-Type: text/html
Headers: {Content-Type=[text/html], Date=[Sat, 06 May 2017 08:54:11 GMT]}
Payload: Sent message
--------------------------------------
2017-05-06 14:24:11.729 DEBUG 14460 --- [nio-8080-exec-1] 
o.a.c.t.http.AbstractHTTPDestination     : Finished servicing http request on 
thread: Thread[http-nio-8080-exec-1,5,main]
2017-05-06 14:24:11.729 DEBUG 14460 --- [nio-8080-exec-1] 
o.a.c.t.servlet.ServletController        : Finished servicing http request on 
thread: Thread[http-nio-8080-exec-1,5,main]
2017-05-06 14:24:11.755  INFO 14460 --- [nio-8080-exec-2] 
o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 
'dispatcherServlet'
2017-05-06 14:24:11.755  INFO 14460 --- [nio-8080-exec-2] 
o.s.web.servlet.DispatcherServlet        : FrameworkServlet 
'dispatcherServlet': initialization started
2017-05-06 14:24:11.757  INFO 14460 --- [nio-8080-exec-2] 
o.s.web.servlet.DispatcherServlet        : FrameworkServlet 
'dispatcherServlet': initialization completed in 2 ms


> REST on JMS Transport Fails with Invalid JMS Property
> -----------------------------------------------------
>
>                 Key: CXF-7344
>                 URL: https://issues.apache.org/jira/browse/CXF-7344
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS, JMS, Transports
>    Affects Versions: 3.1.10
>            Reporter: Karthik Prasad
>            Assignee: Christian Schneider
>             Fix For: 3.2.0
>
>
> I'm trying to create multiple channels for REST such that my endpoints can be 
> invoked from Browser using http protcol or other applications can 
> asynchronously invoke by placing message on queue. Though I'm able to 
> configure both transport types. I'm able to access the REST service and but 
> fails when sending JMS message
> Adding the below stackoverflow question I had asked. The link contains entire 
> code I'm using with embedded JMS queue. 
> http://stackoverflow.com/questions/43226697/rest-on-jms-transport-instead-of-http



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to