Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
2.16.1
-
None
-
None
-
Unknown
Description
Trying to run a groovy scirpt in camel-spring-boot fails with NPE. To reacreate modify the examples-spring-boot route to this:
public void configure()
{ from("timer://trigger").setProperty("groovyProp").groovy("return 'hi'") .transform().simple("ref:myBean"). to("log:out", "mock:test"); }and add dependency to pom:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-script</artifactId>
</dependency>
Startup fails with NPE.
StackTrace:
org.apache.camel.spring.boot.CamelSpringBootInitializationException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> SetProperty[groovyProp, groovy
Unknown macro: {return 'hi'}] <<< in route: Route(route1)[[From[timer://trigger]] -> [SetProperty[groovy... because of null
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:87)
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:37)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:775)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:139)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.apache.camel.spring.boot.FatJarRouter.main(FatJarRouter.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:423)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> SetProperty[groovyProp, groovy] <<< in route: Route(route1)[[From[timer://trigger]] -> [SetProperty[groovy... because of null
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:947)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3258)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2981)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2812)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2808)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2831)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2808)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2777)
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:85)
... 17 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:197)
at org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:177)
at org.apache.camel.model.SetPropertyDefinition.createProcessor(SetPropertyDefinition.java:74)
at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534)
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495)
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069)
... 29 common frames omitted2016-01-19 12:32:24.338 INFO 41772 — [arRouter.main()] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2e629aa7: startup date [Tue Jan 19 12:32:20 EST 2016]; root of context hierarchy
2016-01-19 12:32:24.339 INFO 41772 — [arRouter.main()] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2016-01-19 12:32:24.341 INFO 41772 — [arRouter.main()] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:423)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.camel.spring.boot.CamelSpringBootInitializationException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> SetProperty[groovyProp, groovyUnknown macro: {return 'hi'}] <<< in route: Route(route1)[[From[timer://trigger]] -> [SetProperty[groovy... because of null
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:87)
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:37)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:775)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:139)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.apache.camel.spring.boot.FatJarRouter.main(FatJarRouter.java:26)
... 6 more
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> SetProperty[groovyProp, groovy] <<< in route: Route(route1)[[From[timer://trigger]] -> [SetProperty[groovy... because of null
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:947)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3258)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2981)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2812)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2808)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2831)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2808)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2777)
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:85)
... 17 more
Caused by: java.lang.NullPointerException
at org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:197)
at org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:177)
at org.apache.camel.model.SetPropertyDefinition.createProcessor(SetPropertyDefinition.java:74)
at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534)
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495)
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069)
... 29 more