[ 
https://issues.apache.org/jira/browse/CAMEL-7925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14234098#comment-14234098
 ] 

Charles Moulliard commented on CAMEL-7925:
------------------------------------------

If I add "dynamic-import" package to the demo example, the classloading issue 
with "groovy.lang.script" is gone and I get a similar error :

{code}
2014-12-04 11:22:36,696 | WARN  | - timer://groovy | TimerConsumer              
      | 92 - org.apache.camel.camel-core - 2.14.0 | Error processing exchange. 
Exchange[Message: This is a message containing double quotes. Example --> 
"Hello".]. Caused by: [java.lang.ClassCastException - 
script1417688554694697720774 cannot be cast to groovy.lang.Script]
java.lang.ClassCastException: script1417688554694697720774 cannot be cast to 
groovy.lang.Script
        at 
org.apache.camel.language.groovy.GroovyExpression.instantiateScript(GroovyExpression.java:71)[123:org.apache.camel.camel-groovy:2.14.0]
        at 
org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:50)[123:org.apache.camel.camel-groovy:2.14.0]
        at 
org.apache.camel.builder.ProcessorBuilder$4.process(ProcessorBuilder.java:103)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:157)[92:org.apache.camel.camel-core:2.14.0]
        at 
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:68)[92:org.apache.camel.camel-core:2.14.0]
        at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_51]
        at java.util.TimerThread.run(Timer.java:505)[:1.7.0_51]
{code}

> groovy and osgi - Could not initialize class script1413536396719697720774
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-7925
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7925
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-groovy
>         Environment: Apache Karaf 2.2.x
>            Reporter: Charles Moulliard
>            Priority: Minor
>
> When a camel route is deployed on apache Karaf using a groovy expression to 
> be evaluated we get this error 
> https://gist.github.com/cmoulliard/7294122c47e9c18df399
> Route
> {code}
>               from("direct:launch").routeId("request-token")
>               
>               .onException(HttpOperationFailedException.class)
>                   .handled(true)
>                       .log("An error occurred")
>                   .to("direct:interface-status")
>                   .end()
>               
>               .setHeader(Exchange.HTTP_URI, constant(wayneUriGetSession))
>               .setHeader(Exchange.HTTP_QUERY, constant("User=" + UserName + 
> "&" + "Pass=" + Password))
>               .setHeader(Exchange.HTTP_METHOD, constant("GET"))
>               
>               .to("https4://token-service")
>               .convertBodyTo(String.class)
>               .setHeader("token").groovy("body.replaceAll('\"','')")
> {code}
> {code}
> Caused by: java.lang.NoClassDefFoundError: Could not initialize class 
> script1413536396719697720774
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)[:1.7.0_51]
>       at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_51]
>       at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_51]
>       at 
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_51]
>       at java.lang.Class.newInstance(Class.java:374)[:1.7.0_51]
>       at 
> org.apache.camel.language.groovy.GroovyExpression.instantiateScript(GroovyExpression.java:71)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to