tadayosi commented on issue #589: Restful sample does not work
URL: https://github.com/apache/camel-k/issues/589#issuecomment-514856727
 
 
   Not sure if it's the same issue but now with 1.0.0-M1-SNAPSHOT I got the 
following error when trying `kamel run --name=withrest --dependency=camel-rest 
--dependency=camel-undertow examples/routes-rest.js`:
   ```
   [8] Exception in thread "main" ReferenceError: components is not defined
   [8]  at <js> :program(Unnamed:28:1022-1031)
   [8]  at org.graalvm.polyglot.Context.eval(Context.java:367)
   [8]  at 
org.apache.camel.k.loader.js.JavaScriptRoutesLoader$1.configure(JavaScriptRoutesLoader.java:58)
   [8]  at 
org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:442)
   [8]  at 
org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:409)
   [8]  at 
org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:390)
   [8]  at 
org.apache.camel.impl.engine.AbstractCamelContext.lambda$addRoutes$0(AbstractCamelContext.java:1077)
   [8]  at 
org.apache.camel.impl.engine.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:2404)
   [8]  at 
org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1077)
   [8]  at 
org.apache.camel.main.MainSupport.postProcessCamelContext(MainSupport.java:779)
   [8]  at 
org.apache.camel.main.MainSupport.initCamelContext(MainSupport.java:646)
   [8]  at org.apache.camel.main.Main.doInit(Main.java:108)
   [8]  at 
org.apache.camel.support.service.ServiceSupport.init(ServiceSupport.java:61)
   [8]  at 
org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:88)
   [8]  at org.apache.camel.main.MainSupport.run(MainSupport.java:196)
   [8]  at 
org.apache.camel.k.main.ApplicationRuntime.run(ApplicationRuntime.java:70)
   [8]  at org.apache.camel.k.main.Application.main(Application.java:44)
   ```
   
   It looks like `components` is not available in a js route.
   ```
   l = components.get('log')
   ```
   Also tried `context.getComponent('log')` but the result is the same.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to