Re: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.camel.component.file.GenericFileMessage to the required type - SMX4 !

2009-03-03 Thread cmoulliard

Hi,

Two remarks concerning what you propose :

1) If i try to use the camel context as you propose (using osgi schema),
camel cannot run localy (outside of a OSGI server)

[INFO] Classpath =
[file:/D:/Dvlpt/Java/workspace-ganymede/osgi/reportincident.interfaces/target/classes/,
file:/c:/.m2/repository/org/apache/camel/camel-core/2.0-SNAPSHOT/camel-core-2.0-SNAPSHOT.jar,
file:/c:/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar,
file:/c:/.m2/repository/org/apache/camel/camel-spring/2.0-SNAPSHOT/camel-spring-2.0-SNAPSHOT.jar,
file:/c:/.m2/repository/org/springframework/spring-core/2.5.6/spring-core-2.5.6.jar,
file:/c:/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar,
file:/c:/.m2/repository/org/springframework/spring-context/2.5.6/spring-context-2.5.6.jar,
file:/c:/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar,
file:/c:/.m2/repository/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6.jar,
file:/c:/.m2/repository/org/springframework/spring-tx/2.5.6/spring-tx-2.5.6.jar,
file:/c:/.m2/repository/org/springframework/spring-aop/2.5.6/spring-aop-2.5.6.jar,
file:/c:/.m2/repository/org/apache/camel/camel-bindy/2.0-SNAPSHOT/camel-bindy-2.0-SNAPSHOT.jar,
file:/c:/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar]
2009-03-03 12:00:09,937 INFO  MainSupport - Apache Camel 2.0-SNAPSHOT
starting 
2009-03-03 12:00:09,984 INFO  ClassPathXmlApplicationContext - Refreshing
org.springframework.context.support.classpathxmlapplicationcont...@57ea52:
display name
[org.springframework.context.support.classpathxmlapplicationcont...@57ea52];
startup date [Tue Mar 03 12:00:09 CET 2009]; root of context hierarchy 
2009-03-03 12:00:10,109 DEBUG PathMatchingResourcePatternResolver - Looking
for matching resources in directory tree
[D:\Dvlpt\Java\workspace-ganymede\osgi\reportincident.interfaces\target\classes\META-INF\spring]
 
2009-03-03 12:00:10,109 DEBUG PathMatchingResourcePatternResolver -
Searching directory
[D:\Dvlpt\Java\workspace-ganymede\osgi\reportincident.interfaces\target\classes\META-INF\spring]
for files matching pattern
[D:/Dvlpt/Java/workspace-ganymede/osgi/reportincident.interfaces/target/classes/META-INF/spring/*.xml]
 
2009-03-03 12:00:10,125 DEBUG PathMatchingResourcePatternResolver - Resolved
location pattern [META-INF/spring/*.xml] to resources [file
[D:\Dvlpt\Java\workspace-ganymede\osgi\reportincident.interfaces\target\classes\META-INF\spring\camel-context.xml]]
 
2009-03-03 12:00:10,125 INFO  XmlBeanDefinitionReader - Loading XML bean
definitions from file
[D:\Dvlpt\Java\workspace-ganymede\osgi\reportincident.interfaces\target\classes\META-INF\spring\camel-context.xml]
 
2009-03-03 12:00:10,140 DEBUG DefaultDocumentLoader - Using JAXP provider
[com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl] 
2009-03-03 12:00:10,203 DEBUG PluggableSchemaResolver - Loading schema
mappings from [META-INF/spring.schemas] 
2009-03-03 12:00:10,218 DEBUG PluggableSchemaResolver - Loaded schema
mappings:
{http://activemq.apache.org/camel/schema/spring/camel-spring-1.5.0.xsd=camel-spring.xsd,
http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd,
http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd,
http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd,
http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xsd,
http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-2.5.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.0-SNAPSHOT.xsd=camel-spring.xsd,
http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd,
http://activemq.apache.org/camel/schema/spring/camel-spring-1.2.0.xsd=camel-spring.xsd,
http://activemq.apache.org/camel/schema/spring/camel-spring-1.1.0.xsd=camel-spring.xsd,
http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd,
http://activemq.apache.org/camel/schema/spring/camel-spring-1.0.0.xsd=camel-spring.xsd,
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd,
http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd,
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd,
http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd,
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd,

Re: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.camel.component.file.GenericFileMessage to the required type - SMX4 !

2009-03-03 Thread cmoulliard

Hi Willem,

It works (I mean the file can be processed by Camel) but 

1) in DEBUG mode, the log of SMX4 server is polluted by hundreds of line
like this :

12:11:01,687 | DEBUG | ompon...@1d4f279 | ResolverUtil |
g.apache.camel.util.ResolverUtil  571 | Could not find class
'org/apache/camel/converter/stream/StreamCacheConverter$InputStreamCache.class'
in classloader: BundleDelegatingClassLoader for [Report Incident Interfaces
Bundle (reportincident.interfaces)]. Reason:
java.lang.ClassNotFoundException:
org.apache.camel.converter.stream.StreamCacheConverter$InputStreamCache not
found from bundle [reportincident.interfaces]
java.lang.ClassNotFoundException:
org.apache.camel.converter.stream.StreamCacheConverter$InputStreamCache not
found from bundle [reportincident.interfaces]
at
org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
at
org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at 
org.apache.camel.util.ResolverUtil.addIfMatching(ResolverUtil.java:561)
at
org.apache.camel.osgi.OsgiResolverUtil.loadImplementationsInBundle(OsgiResolverUtil.java:135)
at
org.apache.camel.osgi.OsgiResolverUtil.findInOsgiClassLoader(OsgiResolverUtil.java:92)
at org.apache.camel.osgi.OsgiResolverUtil.find(OsgiResolverUtil.java:73)
at 
org.apache.camel.util.ResolverUtil.findAnnotated(ResolverUtil.java:301)
at
org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:73)
at
org.apache.camel.impl.converter.DefaultTypeConverter.checkLoaded(DefaultTypeConverter.java:296)
at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:98)
at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:66)
at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:51)
at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:74)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:170)
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:103)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:66)
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException:
org.apache.camel.converter.stream.StreamCacheConverter$InputStreamCache
at
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:566)
at
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1371)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at
org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:428)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1341)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:737)
at
org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
... 26 more

2) I have a more serious problem. The classes of my model are not loaded. In
DEBUG mode, we should see this on the console 

2009-03-03 12:28:34,671 DEBUG ResolverUtil - Searching for annotations of
[interface org.apache.camel.dataformat.bindy.annotation.CsvRecord, interface
org.apache.camel.dataformat.bindy.annotation.Link, interface
org.apache.camel.dataformat.bindy.annotation.Message] in packages:
[org.apache.camel.example.reportincident.model] 
2009-03-03 12:28:34,687 DEBUG ResolverUtil - Using only regular classloaders 
2009-03-03 12:28:34,687 DEBUG ResolverUtil - Loading from directory:

Re: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.camel.component.file.GenericFileMessage to the required type - SMX4 !

2009-03-03 Thread Claus Ibsen
Hi

Yeah this resolver needs to be OSGi aware also.

I think we need to provide these resolvers on the CamelContext so
component authors like you can use them to resolve classes and
whatelse, and it would be transparent for you if it was regular or
OSGi platforms.

See ticket 1411 that is about this. Just need to add getResolverUtil
as well, and we should probably rename it as its a bad name to put out
in the open.
We need an API for it as well in the SPI package.

There is a mail on the dev forum about this as well to disucss it there.

The DEBUG logging could maybe be toned down to TRACE


On Tue, Mar 3, 2009 at 12:32 PM, cmoulliard cmoulli...@gmail.com wrote:

 Hi Willem,

 It works (I mean the file can be processed by Camel) but

 1) in DEBUG mode, the log of SMX4 server is polluted by hundreds of line
 like this :

 12:11:01,687 | DEBUG | ompon...@1d4f279 | ResolverUtil                     |
 g.apache.camel.util.ResolverUtil  571 | Could not find class
 'org/apache/camel/converter/stream/StreamCacheConverter$InputStreamCache.class'
 in classloader: BundleDelegatingClassLoader for [Report Incident Interfaces
 Bundle (reportincident.interfaces)]. Reason:
 java.lang.ClassNotFoundException:
 org.apache.camel.converter.stream.StreamCacheConverter$InputStreamCache not
 found from bundle [reportincident.interfaces]
 java.lang.ClassNotFoundException:
 org.apache.camel.converter.stream.StreamCacheConverter$InputStreamCache not
 found from bundle [reportincident.interfaces]
        at
 org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
        at
 org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at 
 org.apache.camel.util.ResolverUtil.addIfMatching(ResolverUtil.java:561)
        at
 org.apache.camel.osgi.OsgiResolverUtil.loadImplementationsInBundle(OsgiResolverUtil.java:135)
        at
 org.apache.camel.osgi.OsgiResolverUtil.findInOsgiClassLoader(OsgiResolverUtil.java:92)
        at 
 org.apache.camel.osgi.OsgiResolverUtil.find(OsgiResolverUtil.java:73)
        at 
 org.apache.camel.util.ResolverUtil.findAnnotated(ResolverUtil.java:301)
        at
 org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:73)
        at
 org.apache.camel.impl.converter.DefaultTypeConverter.checkLoaded(DefaultTypeConverter.java:296)
        at
 org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:98)
        at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:66)
        at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:51)
        at
 org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:74)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52)
        at
 org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:170)
        at
 org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:103)
        at
 org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:66)
        at 
 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at
 java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
 Caused by: java.lang.ClassNotFoundException:
 org.apache.camel.converter.stream.StreamCacheConverter$InputStreamCache
        at
 org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:566)
        at
 org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
        at
 org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1371)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at
 org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:428)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1341)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:737)
        at