Announcement Announcement Module
Collapse
No announcement yet.
Setting timeout for Rest call using rest template Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting timeout for Rest call using rest template

    I want to handle time out for the rest call I make using RestTemplate.exchange().
    I got the below code fragment in one of the blogs:

    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate ">
    <constructor-arg>
    <bean class="org.springframework.http.client.HttpCompone ntsClientHttpRequestFactory">
    <property name="readTimeout" value="100" />
    <property name="connectTimeout" value="100"/>
    </bean>
    </constructor-arg>
    </bean>


    But, I got a no class definition found error :
    Caused by: java.lang.ClassNotFoundException: org.apache.http.client.HttpClient

    For one of the classes in httpclient.jar so I tried few versions of jars from version 4.0.3 to 4.2.3.
    But, got one more class Caused by: java.lang.ClassNotFoundException: org.apache.http.params.SyncBasicHttpParams
    So, I included httpcore-4.2.2.jar.

    Now, I am getting below error.

    java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
    at oracle.eclipse.tools.weblogic.server.internal.Depl oymentProgressListener.watch(DeploymentProgressLis tener.java:190)
    at oracle.eclipse.tools.weblogic.server.internal.WlsJ 2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper .java:506)
    at oracle.eclipse.tools.weblogic.server.internal.WlsJ 2EEDeploymentHelper.redeploy(WlsJ2EEDeploymentHelp er.java:860)
    at oracle.eclipse.tools.weblogic.server.internal.WlsJ 2EEDeploymentHelper.redeploy(WlsJ2EEDeploymentHelp er.java:821)
    at oracle.eclipse.tools.weblogic.server.internal.Webl ogicServerBehaviour.publishWeblogicModules(Weblogi cServerBehaviour.java:1469)
    at oracle.eclipse.tools.weblogic.server.internal.Webl ogicServerBehaviour.publishToServer(WeblogicServer Behaviour.java:898)
    at oracle.eclipse.tools.weblogic.server.internal.Webl ogicServerBehaviour.publishOnce(WeblogicServerBeha viour.java:686)
    at oracle.eclipse.tools.weblogic.server.internal.Webl ogicServerBehaviour.publish(WeblogicServerBehaviou r.java:539)
    at org.eclipse.wst.server.core.model.ServerBehaviourD elegate.publish(ServerBehaviourDelegate.java:774)
    at org.eclipse.wst.server.core.internal.Server.publis hImpl(Server.java:3108)
    at org.eclipse.wst.server.core.internal.Server$Publis hJob.run(Server.java:345)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.j ava:54)
    Caused by: weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.startContex ts(WebAppModule.java:1514)
    at weblogic.servlet.internal.WebAppModule.start(WebAp pModule.java:486)
    at weblogic.application.internal.flow.ModuleStateDriv er$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriv er.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDri ver.start(ScopedModuleDriver.java:200)
    ........
    ........
    ........
    ........

    org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:469)
    at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebApplicationContext(ContextLoader .java:383)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 111)
    at weblogic.servlet.internal.EventsManager$FireContex tListenerAction.run(EventsManager.java:481)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)
    at weblogic.servlet.internal.EventsManager.notifyCont extCreatedEvent(EventsManager.java:181)
    at weblogic.servlet.internal.WebAppServletContext.pre loadResources(WebAppServletContext.java:1863)
    at weblogic.servlet.internal.WebAppServletContext.sta rt(WebAppServletContext.java:3126)
    at weblogic.servlet.internal.WebAppModule.startContex ts(WebAppModule.java:1512)



    Is this issue of jar versions ? Do we have other option to handle the timeout?
Working...
X