You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2009/09/29 10:22:52 UTC

[jira] Assigned: (CAMEL-1517) Mistyped route builder spring configuration - better error description

     [ https://issues.apache.org/activemq/browse/CAMEL-1517?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-1517:
----------------------------------

    Assignee: Stan Lewis

Stan do you want to try out to wrestle camel-spring?

Somehow it could be nice if we could improve the error exception thrown when you mistype a route builder ref. It should be something like: {{Cannot find a route builder with ref: XXXX}} etc. Instead of the big hard to understand exception you get now.

> Mistyped route builder spring configuration - better error description
> ----------------------------------------------------------------------
>
>                 Key: CAMEL-1517
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1517
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.0-M1
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> If you mistype a route builder ref such as
> {code}
>     <bean id="route" class="org.apache.camel.itest.tx.JmsToHttpWithOnExceptionRoute"/>
>     <!-- Camel context -->
>     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
>         <template id="producer"/>
>         <!--use our route -->
>         <routeBuilder ref="xxxroute"/>
>     </camelContext>
> {code}
> You get a long exception stacktrace that does not hint that bean with id {{xxxroute}} could not be found
> {code}
> java.lang.IllegalStateException: Failed to load ApplicationContext
> 	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:201)
> 	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
> 	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
> 	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
> 	at org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.runBare(AbstractJUnit38SpringContextTests.java:183)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:120)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:230)
> 	at junit.framework.TestSuite.run(TestSuite.java:225)
> 	at junit.textui.TestRunner.doRun(TestRunner.java:121)
> 	at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:94)
> 	at junit.textui.TestRunner.doRun(TestRunner.java:114)
> 	at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:22)
> 	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel:beanPostProcessor': Cannot resolve reference to bean 'camel' while setting bean property 'camelContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.camel.builder.RouteBuilder': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.camel.builder.RouteBuilder]: Is it an abstract class?; nested exception is java.lang.InstantiationException
> 	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
> 	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
> 	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.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:880)
> 	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:605)
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:365)
> 	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
> 	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42)
> 	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173)
> 	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:197)
> 	... 16 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.camel.builder.RouteBuilder': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.camel.builder.RouteBuilder]: Is it an abstract class?; nested exception is java.lang.InstantiationException
> 	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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
> 	... 35 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.camel.builder.RouteBuilder': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.camel.builder.RouteBuilder]: Is it an abstract class?; nested exception is java.lang.InstantiationException
> 	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
> 	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.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:300)
> 	at org.apache.camel.spring.spi.SpringInjector.newInstance(SpringInjector.java:40)
> 	at org.apache.camel.util.CamelContextHelper.newInstance(CamelContextHelper.java:133)
> 	at org.apache.camel.model.RouteBuilderDefinition.createRouteBuilder(RouteBuilderDefinition.java:64)
> 	at org.apache.camel.spring.CamelContextFactoryBean.installRoutes(CamelContextFactoryBean.java:524)
> 	at org.apache.camel.spring.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:270)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
> 	... 45 more
> Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.camel.builder.RouteBuilder]: Is it an abstract class?; nested exception is java.lang.InstantiationException
> 	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:103)
> 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
> 	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:248)
> 	... 59 more
> Caused by: java.lang.InstantiationException
> 	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> 	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
> 	... 61 more
> {code}

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