[
https://issues.apache.org/activemq/browse/CAMEL-2205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-2205:
-------------------------------
Description:
I have static routes configured using the java DSL, but use bean properties on
my route builder to provide custom endpoints for different environments, like
so...
{code}
from(sourceUriProperty)
.to("bean:fileParser")
.beanRef("conanCore", "updateOperationFailure")
;
{code}
If you forget to set the from URI property, the exception you get at
application startup just says: "java.lang.IllegalArgumentException: Either
'uri' or 'ref' must be specified on:
org.apache.camel.impl.defaultroutecont...@d6a3d1" (Full stack trace below.....
but probably not really important... note that it never once mentions any of my
own classes)
It would be nice if throw could be somewhere like in:
{code:title=RouteDefinition.java}
public List<RouteContext> addRoutes(CamelContext context, Collection<Route>
routes) throws Exception {
// other parts snipped...
for (FromDefinition fromType : inputs) {
// Throwing here would be nice, fromType.description already has
"no uri or ref!" so it already knows it's broken.
RouteContext routeContext = addRoutes(routes, fromType);
answer.add(routeContext);
}
}
{code}
The RouteDefinition at that stage already contains things like:
{{this = {org.apache.camel.model.routedefinit...@5751}"Route[[From[no uri or
ref supplied!]] -> [To[bean:fileParser], Bean[ref:conanCore method:
updateOperationFailure]]]"}}
So if we can explode there, you can clearly see what route you've screwed up.
Caused by: org.apache.camel.RuntimeCamelException:
java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be specified on:
org.apache.camel.impl.defaultroutecont...@d6a3d1
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1011)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121)
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:469)
at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)
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)
... 18 more
Caused by: java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be
specified on: org.apache.camel.impl.defaultroutecont...@d6a3d1
at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:117)
at
org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
at
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:74)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:432)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:126)
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:569)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:924)
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:901)
at
org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)
at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:816)
at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:99)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:119)
... 29 more
was:
I have static routes configured using the java DSL, but use bean properties on
my route builder to provide custom endpoints for different environments, like
so...
{code}
from(sourceUriProperty)
.to("bean:fileParser")
.beanRef("conanCore", "updateOperationFailure")
;
{code}
If you forget to set the from URI property, the exception you get at
application startup just says: "java.lang.IllegalArgumentException: Either
'uri' or 'ref' must be specified on:
org.apache.camel.impl.defaultroutecont...@d6a3d1" (Full stack trace below.....
but probably not really important... note that it never once mentions any of my
own classes)
It would be nice if throw could be somewhere like in:
{code:title=RouteDefinition.java}
public List<RouteContext> addRoutes(CamelContext context, Collection<Route>
routes) throws Exception {
// other parts snipped...
for (FromDefinition fromType : inputs) {
// Throwing here would be nice, fromType.description already has
"no uri or ref!" so it already knows it's broken.
RouteContext routeContext = addRoutes(routes, fromType);
answer.add(routeContext);
}
}
{code}
The RouteDefinition at that stage already contains things like:
{{this = {org.apache.camel.model.routedefinit...@5751}"Route[[From[no uri or
ref supplied!]] -> [To[bean:fileParser], Bean[ref:conanCore method:
updateOperationFailure]]]"}}
So if we can explode there, you can clearly see what route you've screwed up.
Caused by: org.apache.camel.RuntimeCamelException:
java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be specified on:
org.apache.camel.impl.defaultroutecont...@d6a3d1
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1011)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121)
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:469)
at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)
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)
... 18 more
Caused by: java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be
specified on: org.apache.camel.impl.defaultroutecont...@d6a3d1
at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:117)
at
org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
at
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:74)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:432)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:126)
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:569)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:924)
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:901)
at
org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)
at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:816)
at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:99)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:119)
... 29 more
Fix Version/s: 2.1.0
Good idea Karl.
Yeah lets have better error reporting.
> When the "from" endpoint is improperly set, it can be very hard to work out
> why/where
> -------------------------------------------------------------------------------------
>
> Key: CAMEL-2205
> URL: https://issues.apache.org/activemq/browse/CAMEL-2205
> Project: Apache Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 2.0.0
> Reporter: Karl Palsson
> Assignee: Claus Ibsen
> Fix For: 2.1.0
>
>
> I have static routes configured using the java DSL, but use bean properties
> on my route builder to provide custom endpoints for different environments,
> like so...
> {code}
> from(sourceUriProperty)
> .to("bean:fileParser")
> .beanRef("conanCore", "updateOperationFailure")
> ;
> {code}
> If you forget to set the from URI property, the exception you get at
> application startup just says: "java.lang.IllegalArgumentException: Either
> 'uri' or 'ref' must be specified on:
> org.apache.camel.impl.defaultroutecont...@d6a3d1" (Full stack trace
> below..... but probably not really important... note that it never once
> mentions any of my own classes)
> It would be nice if throw could be somewhere like in:
> {code:title=RouteDefinition.java}
>
> public List<RouteContext> addRoutes(CamelContext context,
> Collection<Route> routes) throws Exception {
> // other parts snipped...
> for (FromDefinition fromType : inputs) {
> // Throwing here would be nice, fromType.description already has
> "no uri or ref!" so it already knows it's broken.
> RouteContext routeContext = addRoutes(routes, fromType);
> answer.add(routeContext);
> }
> }
> {code}
> The RouteDefinition at that stage already contains things like:
> {{this = {org.apache.camel.model.routedefinit...@5751}"Route[[From[no uri or
> ref supplied!]] -> [To[bean:fileParser], Bean[ref:conanCore method:
> updateOperationFailure]]]"}}
> So if we can explode there, you can clearly see what route you've screwed up.
> Caused by: org.apache.camel.RuntimeCamelException:
> java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be specified
> on: org.apache.camel.impl.defaultroutecont...@d6a3d1
> at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1011)
> at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121)
> at
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:469)
> at
> org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
> at
> org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
> at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
> at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
> at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)
> 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)
> ... 18 more
> Caused by: java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be
> specified on: org.apache.camel.impl.defaultroutecont...@d6a3d1
> at
> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:117)
> at
> org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
> at
> org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:74)
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:432)
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:126)
> at
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:569)
> at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:924)
> at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:901)
> at
> org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)
> at
> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
> at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:816)
> at
> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:99)
> at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:119)
> ... 29 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.