camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (Resolved) (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-4780) ObjectHelper can not access a member of class com.db.fi.camel.scala.XmlToScalaNode$ with modifiers "private"
Date Thu, 15 Dec 2011 12:48:30 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-4780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Willem Jiang resolved CAMEL-4780.
---------------------------------

    Resolution: Not A Problem

As we are not supposed to load the XmlToScalaNode$ class, we should avoid letting camel to
use the package scanning to find the converter.
                
> ObjectHelper can not access a member of class com.db.fi.camel.scala.XmlToScalaNode$ with
modifiers "private"
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4780
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4780
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-scala
>    Affects Versions: 2.8.3
>         Environment: Java 1.6, Scala 2.9.1, Camel 2.8.3
>            Reporter: Craig McDaniel
>            Assignee: Willem Jiang
>            Priority: Minor
>         Attachments: XmlToScalaNode.scala
>
>
> The ObjectHelper is choking on a TypeConverter written in Scala. Two classes are compiled
by Scala for singleton objects: XmlToScalaNode and XmlToScalaNode$
> Here is the TypeConverter code:
> {quote}
> import scala.xml.XML
> import scala.xml.Elem
> import org.apache.camel.Converter
> import org.apache.camel.converter.jaxp.XmlConverter
> import org.w3c.dom.Node
> import org.w3c.dom.Element
> @Converter object XmlToScalaNode {
>     
>     //val converter = new XmlConverter()
>     
>     @Converter
>     def convert(xml: String) = XML.loadString(xml)
>     
>     @Converter
>     def convert(elem: Node): Elem = convert(new XmlConverter().toString(elem, null))
>     
>     @Converter
>     def convert(elem: Element): Elem = convert(new XmlConverter().toString(elem, null))
> }
> {quote}
> The root cause appears to be:
> {quote}Caused by: java.lang.IllegalAccessException: Class org.apache.camel.util.ObjectHelper
can not access a member of class com.db.fi.camel.scala.XmlToScalaNode$ with modifiers "private"{quote}
> This was working just fine with camel 2.7.3. As a workaround, I had to use the full class
name for XmlToScalaNode in my TypeConverter file in META-INF. Using just the package name
caused the error. My guess is that the annotation is existing on both classes and some change
in ObjectHelper is now more strict with the XmlToScalaNode$ class.
> Here is the full stack trace:
> {quote}Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.704 sec <<<
FAILURE!
> testSplitConversion(com.db.fi.camel.XpathSplitterTest)  Time elapsed: 0.691 sec  <<<
ERROR!
> org.apache.camel.CamelExecutionException: Exception occurred during execution on the
exchange: Exchange[Message: <b>bar</b>]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1180)
> 	at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:814)
> 	at org.apache.camel.impl.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
> 	at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:371)
> 	at org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:204)
> 	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:204)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:151)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> 	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> 	at org.apache.camel.processor.interceptor.Debug$1.process(Debug.java:50)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
> 	at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:572)
> 	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:505)
> 	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:218)
> 	at org.apache.camel.processor.Splitter.process(Splitter.java:96)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> 	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> 	at org.apache.camel.processor.interceptor.Debug$1.process(Debug.java:50)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
> 	at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> 	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> 	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
> 	at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
> 	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:351)
> 	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:323)
> 	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:222)
> 	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:323)
> 	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:168)
> 	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:110)
> 	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:123)
> 	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:130)
> 	at com.db.fi.camel.XpathSplitterTest.testSplitConversion(XpathSplitterTest.scala:30)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> 	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> Caused by: org.apache.camel.InvalidPayloadException: No body available of type: scala.xml.Elem
but has value: [b: null] of type: com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl
on: Message: <b>bar</b>. Caused by: No type converter available to convert from
type: com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl to the required type: scala.xml.Elem
with value [b: null]. Exchange[Message: <b>bar</b>]. Caused by: [org.apache.camel.NoTypeConversionAvailableException
- No type converter available to convert from type: com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl
to the required type: scala.xml.Elem with value [b: null]]
> 	at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:102)
> 	at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:812)
> 	... 94 more
> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available
to convert from type: com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl to the
required type: scala.xml.Elem with value [b: null]
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:140)
> 	at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)
> 	... 95 more
> Caused by: org.apache.camel.RuntimeCamelException: java.lang.IllegalAccessException:
Class org.apache.camel.util.ObjectHelper can not access a member of class com.db.fi.camel.scala.XmlToScalaNode$
with modifiers "private"
> 	at org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1066)
> 	at org.apache.camel.util.ReflectionInjector.newInstance(ReflectionInjector.java:32)
> 	at org.apache.camel.impl.converter.CachingInjector.createInstance(CachingInjector.java:44)
> 	at org.apache.camel.impl.converter.CachingInjector.newInstance(CachingInjector.java:38)
> 	at org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:58)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:182)
> 	at org.apache.camel.impl.converter.LazyLoadingTypeConverter.doConvertTo(LazyLoadingTypeConverter.java:47)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:138)
> 	... 96 more
> Caused by: java.lang.IllegalAccessException: Class org.apache.camel.util.ObjectHelper
can not access a member of class com.db.fi.camel.scala.XmlToScalaNode$ with modifiers "private"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.Class.newInstance0(Class.java:349)
> 	at java.lang.Class.newInstance(Class.java:308)
> 	at org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1062)
> 	... 103 more{quote}

--
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

        

Mime
View raw message