You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sakchakravarthi <aj...@gmail.com> on 2014/06/18 15:45:34 UTC

Unable to get response from rest service

Hi All
I am getting veered problem. I have a route with rest client which provide
me with json. I am able to get json when I hit web service from browser. But
through application It  was not picked up.

Just as hit or trail to see debug logs I changed my log level in log4j.xml
from TRACE to DEBUG, then surprisingly getting response from web service.
Again I modified log level to TRACE then I could not get response from web
service.

Could any one help me on this. 



--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-get-response-from-rest-service-tp5752505.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unable to get response from rest service

Posted by sakchakravarthi <aj...@gmail.com>.
Hi 
I missed one more thing when I kept Trace in log4j.xml I could see exception
as below. and could not process the web request. but when I change to debug
it could process request.
Chosen method to invoke: public final javax.ws.rs.core.Response
com.sun.proxy.$Proxy38.getNextBatch(java.lang.String,java.lang.String)
throws java.lang.Exception on bean:
org.apache.cxf.jaxrs.client.ClientProxyImpl@6ac00f8a
Converting java.lang.String -> java.lang.String with value: BookName
Loading class: BookName using classloader:
sun.misc.Launcher$AppClassLoader@372bab9
Cannot load class: BookName using classloader:
sun.misc.Launcher$AppClassLoader@372bab9
java.lang.ClassNotFoundException: BookName
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at
org.apache.camel.util.ObjectHelper.doLoadClass(ObjectHelper.java:888)
       at
org.apache.camel.util.ObjectHelper.loadClass(ObjectHelper.java:797)
       at
org.apache.camel.util.ObjectHelper.loadClass(ObjectHelper.java:774)
       at
org.apache.camel.impl.DefaultClassResolver.loadClass(DefaultClassResolver.java:104)
       at
org.apache.camel.impl.DefaultClassResolver.resolveClass(DefaultClassResolver.java:33)
       at
org.apache.camel.component.bean.BeanHelper.isAssignableToExpectedType(BeanHelper.java:121)
       at
org.apache.camel.component.bean.MethodInfo$2.evaluateParameterValue(MethodInfo.java:515)
       at
org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:472)
       at
org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:239)
       at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:278)
       at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:180)
       at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:148)
       at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
       at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
       at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
       at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
       at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
       at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
       at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:139)
       at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:64)
       at java.util.TimerThread.mainLoop(Unknown Source)
       at java.util.TimerThread.run(Unknown Source)




--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-get-response-from-rest-service-tp5752505p5752560.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unable to get response from rest service

Posted by sakchakravarthi <aj...@gmail.com>.
Hi Willem Jiang
Thanks for your response bellow I mentioned my camel route.
<camel:route>
			<camel:from uri="timer://nextCallEndpoint?period={{rest_call_timeout}}"/>
			<camel:log message="Going to hit webservice to get json"
loggingLevel="INFO"/>
			<camel:bean ref="restClient" method="getNextBatch({{target}},{{next}})"/>
			<camel:onException>
		      <camel:exception>java.net.UnknownHostException</camel:exception>
		      <camel:handled><camel:constant>true</camel:constant></camel:handled>
		      <camel:transform>
		      		<camel:constant>{{service_unavailable}}</camel:constant>
		      </camel:transform>
		      <camel:bean ref="exceptionHandler"/>
		 	</camel:onException>
			<camel:log message="Method: getNextBatch({{target}},{{next}})"
loggingLevel="DEBUG"/>
			<camel:bean ref="checkRestResponse" method="process"/>
			<camel:choice>
				<camel:when>
					<simple>${body} != ''</simple>
					<camel:log message="sending msg to seda:masterJsonsQueue"
loggingLevel="DEBUG"/>
					<camel:to uri="seda:queue:masterJsonsQueue"/>
				</camel:when>
			</camel:choice>
		</camel:route>

<jaxrs:client id="restClient" address="${url}"
		serviceClass="com.common.webservices.WebServiceCaller" >
	</jaxrs:client>



--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-get-response-from-rest-service-tp5752505p5752537.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unable to get response from rest service

Posted by Willem Jiang <wi...@gmail.com>.
It may relates to camel stream caching[1].
Can I have a look at your route?

[1]http://camel.apache.org/stream-caching.html

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On June 18, 2014 at 9:51:31 PM, sakchakravarthi (ajit.kalyan.chakravarthi@gmail.com) wrote:
> Hi All
> I am getting veered problem. I have a route with rest client which provide
> me with json. I am able to get json when I hit web service from browser. But
> through application It was not picked up.
>  
> Just as hit or trail to see debug logs I changed my log level in log4j.xml
> from TRACE to DEBUG, then surprisingly getting response from web service.
> Again I modified log level to TRACE then I could not get response from web
> service.
>  
> Could any one help me on this.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unable-to-get-response-from-rest-service-tp5752505.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>