You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by gnanda <gi...@phaseforward.com> on 2010/06/09 21:08:56 UTC

camel 2.2 configuring http retryhandler and soTimeout using httpClientConfigurer

Hi All,

I am trying to set http retry handler to 0 (default is 3, saw it from the
log file) and soTimeout
I created a class extending HttpClientConfigurer as below
public class DefaultHttpClientConfigurer implements HttpClientConfigurer {
	private static final org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory
	.getLog(DefaultHttpClientConfigurer.class);
	
	public void configureHttpClient(HttpClient client) {
		log.info("executing DefaultHttpClientConfigurer.configureHttpClient");
		DefaultHttpMethodRetryHandler retryhandler = new
DefaultHttpMethodRetryHandler(0, false); 
        client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
retryhandler); 
        client.getParams().setSoTimeout(1000); 
    
		
	}

}
 In the routerBuilder class 
I have below code
DefaultHttpClientConfigurer configurer = new DefaultHttpClientConfigurer();
		 HttpComponent component = this.getContext().getComponent("http",
HttpComponent.class);
		component.setHttpClientConfigurer(configurer); 
     
I am getting below exception while doing deployment
javax.jbi.JBIException: java.lang.Exception: Error deploying SU
simpleconsumer-camelrouter
	at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:101)
	at
org.apache.servicemix.jbi.deployer.impl.Deployer.onBundleStarted(Deployer.java:352)
	at
org.apache.servicemix.jbi.deployer.impl.Deployer.bundleChanged(Deployer.java:282)
	at
org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:800)
	at
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:728)
	at
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3608)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1706)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
	at
org.apache.felix.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:29)
	at
org.apache.felix.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:49)
	at
org.apache.felix.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:41)
	at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:34)
	at
org.apache.felix.gogo.runtime.shell.CommandProxy.execute(CommandProxy.java:45)
	at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:211)
	at
org.apache.felix.gogo.runtime.shell.Closure.executeStatement(Closure.java:146)
	at org.apache.felix.gogo.runtime.shell.Pipe.run(Pipe.java:91)
	at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:75)
	at
org.apache.felix.gogo.runtime.shell.CommandSessionImpl.execute(CommandSessionImpl.java:71)
	at org.apache.felix.karaf.shell.console.jline.Console.run(Console.java:174)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.Exception: Error deploying SU
simpleconsumer-camelrouter
	at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:213)
	at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:85)
	... 21 more
Caused by: javax.jbi.management.DeploymentException: <component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message">
	<component-name>servicemix-camel</component-name>
	<component-task-result-details>
		<task-result-details>
			<task-id>deploy</task-id>
			<task-result>FAILED</task-result>
			<message-type>ERROR</message-type>
			<task-status-msg><msg-loc-info><loc-token/><loc-message>Could not deploy
xbean service unit</loc-message></msg-loc-info></task-status-msg>
			<exception-info>
				<nesting-level>1</nesting-level>
				<msg-loc-info>
					<loc-token />
					<loc-message>Error creating bean with name 'camel': Invocation of init
method failed; nested exception is java.lang.IllegalArgumentException: The
component is not of type: class
org.apache.camel.component.http.HttpComponent but is:
org.apache.camel.component.http.HttpComponent@b13306</loc-message>
				
<stack-trace><![CDATA[org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'camel': Invocation of init method failed;
nested exception is java.lang.IllegalArgumentException: The component is not
of type: class org.apache.camel.component.http.HttpComponent but is:
org.apache.camel.component.http.HttpComponent@b13306
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
	at
org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:947)
	at
org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:701)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377)
	at
org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:87)
	at
org.apache.servicemix.camel.CamelSpringDeployer.deploy(CamelSpringDeployer.java:76)
	at
org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
	at
org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
	at
org.apache.servicemix.jbi.deployer.artifacts.ServiceUnitImpl.deploy(ServiceUnitImpl.java:104)
	at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:207)
	at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:85)
	at
org.apache.servicemix.jbi.deployer.impl.Deployer.onBundleStarted(Deployer.java:352)
	at
org.apache.servicemix.jbi.deployer.impl.Deployer.bundleChanged(Deployer.java:282)
	at
org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:800)
	at
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:728)
	at
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3608)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1706)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
	at
org.apache.felix.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:29)
	at
org.apache.felix.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:49)
	at
org.apache.felix.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:41)
	at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:34)
	at
org.apache.felix.gogo.runtime.shell.CommandProxy.execute(CommandProxy.java:45)
	at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:211)
	at
org.apache.felix.gogo.runtime.shell.Closure.executeStatement(Closure.java:146)
	at org.apache.felix.gogo.runtime.shell.Pipe.run(Pipe.java:91)
	at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:75)
	at
org.apache.felix.gogo.runtime.shell.CommandSessionImpl.execute(CommandSessionImpl.java:71)
	at org.apache.felix.karaf.shell.console.jline.Console.run(Console.java:174)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalArgumentException: The component is not of type:
class org.apache.camel.component.http.HttpComponent but is:
org.apache.camel.component.http.HttpComponent@b13306
	at
org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:247)
	at
com.pf.simpleconsumer.camelrouter.SCRouterBuilder.configure(SCRouterBuilder.java:80)
	at
org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:295)
	at
org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:250)
	at
org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:236)
	at
org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:549)
	at
org.apache.camel.spring.CamelContextFactoryBean.installRoutes(CamelContextFactoryBean.java:904)
	at
org.apache.camel.spring.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:359)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
	... 41 more
]]></stack-trace>
				</msg-loc-info>
			</exception-info>
		</task-result-details>
	</component-task-result-details>
</component-task-result>
	at
org.apache.servicemix.common.ManagementSupport.failure(ManagementSupport.java:46)
	at
org.apache.servicemix.common.AbstractDeployer.failure(AbstractDeployer.java:43)
	at
org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:117)
	at
org.apache.servicemix.camel.CamelSpringDeployer.deploy(CamelSpringDeployer.java:76)
	at
org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
	at
org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
	at
org.apache.servicemix.jbi.deployer.artifacts.ServiceUnitImpl.deploy(ServiceUnitImpl.java:104)
	at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:207)
	... 22 more

Any help is appreciated

-- 
View this message in context: http://old.nabble.com/camel-2.2-configuring-http-retryhandler-and-soTimeout-using-httpClientConfigurer-tp28834631p28834631.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.