You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Sergey Zhemzhitsky (JIRA)" <ji...@apache.org> on 2012/08/09 00:45:20 UTC
[jira] [Created] (CAMEL-5493) GroovyLanguage should use
applicationContextClassLoader of the corresponding CamelContext instead of
current thread's contextClassLoader
Sergey Zhemzhitsky created CAMEL-5493:
-----------------------------------------
Summary: GroovyLanguage should use applicationContextClassLoader of the corresponding CamelContext instead of current thread's contextClassLoader
Key: CAMEL-5493
URL: https://issues.apache.org/jira/browse/CAMEL-5493
Project: Camel
Issue Type: Bug
Components: camel-groovy
Affects Versions: 2.10.0
Reporter: Sergey Zhemzhitsky
Attachments: camel-groovy-failure.zip
Stacktrace:
{code}
Caused by: java.lang.ClassCastException: script13444652627211505912543 cannot be cast to groovy.lang.Script
at org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:52)
at org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:80)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverte
rHelper.java:61)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)
at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
{code}
--
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
[jira] [Updated] (CAMEL-5493) GroovyLanguage should use
applicationContextClassLoader of the corresponding CamelContext instead of
current thread's contextClassLoader
Posted by "Sergey Zhemzhitsky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-5493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Zhemzhitsky updated CAMEL-5493:
--------------------------------------
Attachment: camel-groovy-failure.zip
Integration tests to reproduce the issue have been attached
> GroovyLanguage should use applicationContextClassLoader of the corresponding CamelContext instead of current thread's contextClassLoader
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5493
> URL: https://issues.apache.org/jira/browse/CAMEL-5493
> Project: Camel
> Issue Type: Bug
> Components: camel-groovy
> Affects Versions: 2.10.0
> Reporter: Sergey Zhemzhitsky
> Attachments: camel-groovy-failure.zip
>
>
> Stacktrace:
> {code}
> Caused by: java.lang.ClassCastException: script13444652627211505912543 cannot be cast to groovy.lang.Script
> at org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:52)
> at org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:80)
> at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverte
> rHelper.java:61)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)
> at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)
> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> {code}
--
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
[jira] [Comment Edited] (CAMEL-5493) GroovyLanguage should use
applicationContextClassLoader of the corresponding CamelContext instead of
current thread's contextClassLoader
Posted by "Sergey Zhemzhitsky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-5493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431476#comment-13431476 ]
Sergey Zhemzhitsky edited comment on CAMEL-5493 at 8/8/12 10:49 PM:
--------------------------------------------------------------------
Integration tests to reproduce the issue have been attached.
It seems that the following snippet in the GroovyLanguage causes this issue
{code}
protected Class<Script> parseExpression(String expression) {
return new GroovyClassLoader().parseClass(expression);
}
{code}
as internally the default constructor of the GroovyClassLoader uses current thread context ClassLoader
{code}
public GroovyClassLoader() {
this(Thread.currentThread().getContextClassLoader());
}
{code}
was (Author: szhemzhitsky):
Integration tests to reproduce the issue have been attached
> GroovyLanguage should use applicationContextClassLoader of the corresponding CamelContext instead of current thread's contextClassLoader
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5493
> URL: https://issues.apache.org/jira/browse/CAMEL-5493
> Project: Camel
> Issue Type: Bug
> Components: camel-groovy
> Affects Versions: 2.10.0
> Reporter: Sergey Zhemzhitsky
> Attachments: camel-groovy-failure.zip
>
>
> Stacktrace:
> {code}
> Caused by: java.lang.ClassCastException: script13444652627211505912543 cannot be cast to groovy.lang.Script
> at org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:52)
> at org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:80)
> at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverte
> rHelper.java:61)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)
> at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)
> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> {code}
--
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
[jira] [Commented] (CAMEL-5493) GroovyLanguage should use
applicationContextClassLoader of the corresponding CamelContext instead of
current thread's contextClassLoader
Posted by "Sergey Zhemzhitsky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-5493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437587#comment-13437587 ]
Sergey Zhemzhitsky commented on CAMEL-5493:
-------------------------------------------
Hi Willem,
Thanks a lot for the workaround!
Seems, that it's a bug in the felix, as the following snippet in the GroovyExpression#evaluate(Exchange, Class)
{code}
System.out.printf("Script type: %s@%s%n", scriptType.getName(), System.identityHashCode(scriptType));
Object o = scriptType.newInstance();
System.out.printf("Script instance: %s@%s%n", o.getClass().getName(), System.identityHashCode(o));
System.out.printf("Script instance superclass: %s@%s%n",
o.getClass().getSuperclass().getName(), System.identityHashCode(o.getClass().getSuperclass()));
System.out.printf("Script.class: %s@%s%n", Script.class.getName(), System.identityHashCode(Script.class));
System.out.printf("Script.type classloader: %s@%s%n",
scriptType.getClassLoader().getClass().getName(), System.identityHashCode(scriptType.getClassLoader()));
System.out.printf("Script.instance classloader: %s@%s%n",
o.getClass().getClassLoader().getClass().getName(), System.identityHashCode(o.getClass().getClassLoader()));
System.out.printf("Script.class classloader: %s@%s%n",
Script.class.getClassLoader().getClass().getName(), System.identityHashCode(Script.class.getClassLoader()));
{code}
outputs the following for the passed test
{code}
Script type: script13454122538541505912543@999191884
Script instance: script13454122538541505912543@681806680
Script instance superclass: groovy.lang.Script@765505133
Script.class: groovy.lang.Script@765505133
Script.type classloader: groovy.lang.GroovyClassLoader$InnerLoader@1915502523
Script.instance classloader: groovy.lang.GroovyClassLoader$InnerLoader@1915502523
{code}
and outputs the following for the failed test
{code}
Script type: script13454122770291505912543@1670892698
Script instance: script13454122770291505912543@1556003292
Script instance superclass: groovy.lang.Script@798159189
Script.class: groovy.lang.Script@1292687619
Script.type classloader: groovy.lang.GroovyClassLoader$InnerLoader@1694302424
Script.instance classloader: groovy.lang.GroovyClassLoader$InnerLoader@1694302424
{code}
Script.class and Script instance superclass must be the same classes, but in the case of lazy bundle activation and felix framework they are different.
> GroovyLanguage should use applicationContextClassLoader of the corresponding CamelContext instead of current thread's contextClassLoader
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5493
> URL: https://issues.apache.org/jira/browse/CAMEL-5493
> Project: Camel
> Issue Type: Bug
> Components: camel-groovy
> Affects Versions: 2.10.0
> Reporter: Sergey Zhemzhitsky
> Assignee: Willem Jiang
> Attachments: camel-groovy-failure.zip
>
>
> Stacktrace:
> {code}
> Caused by: java.lang.ClassCastException: script13444652627211505912543 cannot be cast to groovy.lang.Script
> at org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:52)
> at org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:80)
> at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverte
> rHelper.java:61)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)
> at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)
> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> {code}
--
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
[jira] [Assigned] (CAMEL-5493) GroovyLanguage should use
applicationContextClassLoader of the corresponding CamelContext instead of
current thread's contextClassLoader
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-5493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Willem Jiang reassigned CAMEL-5493:
-----------------------------------
Assignee: Willem Jiang
> GroovyLanguage should use applicationContextClassLoader of the corresponding CamelContext instead of current thread's contextClassLoader
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5493
> URL: https://issues.apache.org/jira/browse/CAMEL-5493
> Project: Camel
> Issue Type: Bug
> Components: camel-groovy
> Affects Versions: 2.10.0
> Reporter: Sergey Zhemzhitsky
> Assignee: Willem Jiang
> Attachments: camel-groovy-failure.zip
>
>
> Stacktrace:
> {code}
> Caused by: java.lang.ClassCastException: script13444652627211505912543 cannot be cast to groovy.lang.Script
> at org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:52)
> at org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:80)
> at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverte
> rHelper.java:61)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)
> at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)
> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> {code}
--
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
[jira] [Resolved] (CAMEL-5493) GroovyLanguage should use
applicationContextClassLoader of the corresponding CamelContext instead of
current thread's contextClassLoader
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-5493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Willem Jiang resolved CAMEL-5493.
---------------------------------
Resolution: Won't Fix
It's a Felix issue not the issue of camel.
> GroovyLanguage should use applicationContextClassLoader of the corresponding CamelContext instead of current thread's contextClassLoader
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5493
> URL: https://issues.apache.org/jira/browse/CAMEL-5493
> Project: Camel
> Issue Type: Bug
> Components: camel-groovy
> Affects Versions: 2.10.0
> Reporter: Sergey Zhemzhitsky
> Assignee: Willem Jiang
> Attachments: camel-groovy-failure.zip
>
>
> Stacktrace:
> {code}
> Caused by: java.lang.ClassCastException: script13444652627211505912543 cannot be cast to groovy.lang.Script
> at org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:52)
> at org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:80)
> at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverte
> rHelper.java:61)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)
> at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)
> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CAMEL-5493) GroovyLanguage should use
applicationContextClassLoader of the corresponding CamelContext instead of
current thread's contextClassLoader
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-5493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431710#comment-13431710 ]
Willem Jiang commented on CAMEL-5493:
-------------------------------------
I just went through the test cases, found the error is thrown when the consumer bundle is set to be ACTIVATION_LAZY (it is introduced by eclipse).
After digging the error more I found we get workaround it by switching the OSGi platform to equinox. You can do it by adding the below code into Option array.
{code}
editConfigurationFilePut(CustomProperties.KARAF_FRAMEWORK, "equinox"),
{code}
Willem
> GroovyLanguage should use applicationContextClassLoader of the corresponding CamelContext instead of current thread's contextClassLoader
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5493
> URL: https://issues.apache.org/jira/browse/CAMEL-5493
> Project: Camel
> Issue Type: Bug
> Components: camel-groovy
> Affects Versions: 2.10.0
> Reporter: Sergey Zhemzhitsky
> Attachments: camel-groovy-failure.zip
>
>
> Stacktrace:
> {code}
> Caused by: java.lang.ClassCastException: script13444652627211505912543 cannot be cast to groovy.lang.Script
> at org.apache.camel.language.groovy.GroovyExpression.evaluate(GroovyExpression.java:52)
> at org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:80)
> at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverte
> rHelper.java:61)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)
> at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)
> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)
> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> {code}
--
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