[ https://issues.apache.org/jira/browse/CAMEL-4171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144678#comment-13144678 ]
Claus Ibsen commented on CAMEL-4171: ------------------------------------ Any update? Did you try with a later release or created an unit test? > Groovy language - classNotFoundException in OSGi environment > ------------------------------------------------------------ > > Key: CAMEL-4171 > URL: https://issues.apache.org/jira/browse/CAMEL-4171 > Project: Camel > Issue Type: Bug > Components: camel-core, camel-groovy, osgi > Affects Versions: 2.7.2 > Reporter: Sergey Zhemzhitsky > Priority: Minor > Labels: camel-groovy > Fix For: 2.9.0 > > > The problem is in the following method of the GroovyLanguage > @SuppressWarnings("unchecked") > protected Class<Script> parseExpression(String expression) { > return new GroovyClassLoader().parseClass(expression); > } > It uses the default constructor to create GroovyClassLoader, which uses > Thread context classloader, which may not be equal to the classloader of the > bundle where the camel context is defined. > Caused by: java.lang.NoClassDefFoundError: groovy/lang/Script > at java.lang.ClassLoader.defineClass1(Native Method)[:1.6.0_24] > at > java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)[:1.6.0_24] > at java.lang.ClassLoader.defineClass(ClassLoader.java:616)[:1.6.0_24] > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)[:1.6.0_24] > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:55) > at > groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:519) > at > groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:536) > at > groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:540) > at > org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:747) > at > org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:932) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:509) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464) > at > groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:214) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:224) > at > org.apache.camel.language.groovy.GroovyLanguage.parseExpression(GroovyLanguage.java:44) > at > org.apache.camel.language.groovy.GroovyLanguage.createExpression(GroovyLanguage.java:38) > at > org.apache.camel.language.groovy.GroovyLanguage.createExpression(GroovyLanguage.java:27) > at > org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:41)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09] > at > org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09] > ... 92 more > Caused by: java.lang.ClassNotFoundException: groovy.lang.Script > at java.net.URLClassLoader$1.run(URLClassLoader.java:202)[:1.6.0_24] > at java.security.AccessController.doPrivileged(Native Method)[:1.6.0_24] > at java.net.URLClassLoader.findClass(URLClassLoader.java:190)[:1.6.0_24] > at java.lang.ClassLoader.loadClass(ClassLoader.java:307)[:1.6.0_24] > at > groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:696)[134:groovy-all:1.7.5] > at > groovy.lang.GroovyClassLoader$InnerLoader.loadClass(GroovyClassLoader.java:449) > at > groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:793)[134:groovy-all:1.7.5] > at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24] > ... 115 more -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira