Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groovy.lang.MissingMethodException: No signature of method: Script1.context() #1022

Closed
aldettinger opened this issue Oct 21, 2019 · 2 comments

Comments

@aldettinger
Copy link
Contributor

While qualifying the Camel-K 1.0.0-M3/1.0.5 staging release, I've noticed that some groovy examples are not running (namely routes.groovy and camel-caffeine.groovy).

The exception thrown below:
[1] 2019-10-21 09:53:16.307 INFO [main] MainSupport - Using properties from classpath:application.properties [1] Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: Script1.context() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@6579c3d9] [1] Possible solutions: collect(), collect(groovy.lang.Closure), notify(), inject(groovy.lang.Closure), collect(java.util.Collection, groovy.lang.Closure)

And more details there:
kamel run --dev routes.groovy integration "routes" created integration "routes" in phase Initialization integration "routes" in phase Building Kit integration "routes" in phase Deploying integration "routes" in phase Running [1] Monitoring pod routes-786dbc84b8-vwgnk[1] Starting the Java application using /opt/run-java/run-java.sh ... [1] exec java -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:+ExitOnOutOfMemoryError -cp ./resources:/etc/camel/conf:/etc/camel/resources:/etc/camel/sources/i-source-000:dependencies/com.github.ben-manes.caffeine.caffeine-2.8.0.jar:dependencies/com.sun.xml.bind.jaxb-core-2.3.0.1.jar:dependencies/com.sun.xml.bind.jaxb-impl-2.3.0.jar:dependencies/commons-io.commons-io-2.6.jar:dependencies/javax.xml.bind.jaxb-api-2.3.0.jar:dependencies/org.apache.camel.camel-api-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-base-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-bean-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-browse-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-caffeine-lrucache-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-controlbus-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-core-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-core-engine-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-dataformat-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-dataset-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-direct-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-directvm-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-endpointdsl-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-file-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-groovy-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-jaxp-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-language-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-log-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-main-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-management-api-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-mock-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-properties-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-ref-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-rest-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-saga-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-scheduler-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-seda-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-stub-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-support-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-timer-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-util-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-util-json-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-validator-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-vm-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-xpath-3.0.0-RC1.jar:dependencies/org.apache.camel.camel-xslt-3.0.0-RC1.jar:dependencies/org.apache.camel.k.camel-k-loader-groovy-1.0.5.jar:dependencies/org.apache.camel.k.camel-k-runtime-core-1.0.5.jar:dependencies/org.apache.camel.k.camel-k-runtime-main-1.0.5.jar:dependencies/org.apache.camel.spi-annotations-3.0.0-RC1.jar:dependencies/org.apache.commons.commons-lang3-3.9.jar:dependencies/org.apache.logging.log4j.log4j-api-2.12.1.jar:dependencies/org.apache.logging.log4j.log4j-core-2.12.1.jar:dependencies/org.apache.logging.log4j.log4j-slf4j-impl-2.12.1.jar:dependencies/org.codehaus.groovy.groovy-2.5.8.jar:dependencies/org.slf4j.slf4j-api-1.7.28.jar org.apache.camel.k.main.Application [1] OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N [1] 2019-10-21 09:53:15.770 INFO [main] ApplicationRuntime - Add listener: org.apache.camel.k.listener.ContextConfigurer@47d90b9e [1] 2019-10-21 09:53:15.774 INFO [main] ApplicationRuntime - Add listener: org.apache.camel.k.listener.RoutesConfigurer@1d119efb [1] 2019-10-21 09:53:15.775 INFO [main] ApplicationRuntime - Add listener: org.apache.camel.k.listener.RoutesDumper@2473d930 [1] 2019-10-21 09:53:15.791 INFO [main] RuntimeSupport - Looking up loader for language: groovy [1] 2019-10-21 09:53:16.039 INFO [main] RuntimeSupport - Found loader org.apache.camel.k.loader.groovy.GroovyRoutesLoader@60db1c0e for language groovy from service definition [1] 2019-10-21 09:53:16.287 INFO [main] RoutesConfigurer - Loading routes from: file:/etc/camel/sources/i-source-000/routes.groovy?language=groovy [1] 2019-10-21 09:53:16.287 INFO [main] ApplicationRuntime - Listener org.apache.camel.k.listener.RoutesConfigurer@1d119efb executed in phase ConfigureRoutes [1] 2019-10-21 09:53:16.307 INFO [main] MainSupport - Using properties from classpath:application.properties [1] Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: Script1.context() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@6579c3d9] [1] Possible solutions: collect(), collect(groovy.lang.Closure), notify(), inject(groovy.lang.Closure), collect(java.util.Collection, groovy.lang.Closure) [1] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70) [1] at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:76) [1] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) [1] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156) [1] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168) [1] at Script1.run(Script1.groovy:27) [1] at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234) [1] at org.apache.camel.k.loader.groovy.GroovyRoutesLoader$1$_configure_closure1.doCall(GroovyRoutesLoader.groovy:57) [1] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [1] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [1] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [1] at java.lang.reflect.Method.invoke(Method.java:498) [1] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101) [1] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) [1] at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263) [1] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041) [1] at groovy.lang.Closure.call(Closure.java:405) [1] at groovy.lang.Closure.call(Closure.java:421) [1] at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1608) [1] at org.codehaus.groovy.runtime.dgm$913.doMethodInvoke(Unknown Source) [1] at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234) [1] at org.apache.camel.k.loader.groovy.GroovyRoutesLoader$1.configure(GroovyRoutesLoader.groovy:51) [1] at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:457) [1] at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:424) [1] at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:404) [1] at org.apache.camel.impl.engine.AbstractCamelContext.lambda$addRoutes$0(AbstractCamelContext.java:1113) [1] at org.apache.camel.impl.engine.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:2456) [1] at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1113) [1] at org.apache.camel.main.MainSupport.postProcessCamelContext(MainSupport.java:785) [1] at org.apache.camel.main.MainSupport.initCamelContext(MainSupport.java:652) [1] at org.apache.camel.main.Main.doInit(Main.java:108) [1] at org.apache.camel.support.service.ServiceSupport.init(ServiceSupport.java:62) [1] at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:90) [1] at org.apache.camel.main.MainSupport.run(MainSupport.java:197) [1] at org.apache.camel.k.main.ApplicationRuntime.run(ApplicationRuntime.java:70) [1] at org.apache.camel.k.main.Application.main(Application.java:44) [1] 2019-10-21 09:53:17.219 INFO [Camel Thread #0 - CamelHangupInterceptor] MainSupport$HangupInterceptor - Received hang up - stopping the main instance.

@lburgazzoli
Copy link
Contributor

Yeah, examples need to be amended and the context should be renamed to camel

@lburgazzoli
Copy link
Contributor

Fixed by #1026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants