You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2009/12/08 12:03:59 UTC

Apache Felix Karaf - Equinox - TypeConverter not loaded

It seems that Apache Felxi Karaf 1.1.SNAPSHOT + Equinox
(osgi-3.5.1.v20090827.jar) does not load a TypeConverter defined in
META-INF/services/org/apache/camel directory

        from("file:src/data?noop=true")
            .convertBodyTo(PersonDocument.class)
            .to("jpa:org.apache.camel.example.etl.CustomerEntity");

        // the following will dump the database to files

from("jpa:org.apache.camel.example.etl.CustomerEntity?consumeDelete=false&delay=3000&consumeLockEntity=false")
            .setHeader(Exchange.FILE_NAME, el("${in.body.userName}.xml"))
            .to("file:target/customers");


11:39:49,934 | INFO  | 1: FileComponent | Tracer                           |
rg.apache.camel.processor.Logger   88 | 5e0daace-f84c-4b28-bfee-33347488e91a
>>> (route1)  --> jpa://org.apache.camel.example.etl.CustomerEntity <<<
Pattern:InOnly, Headers:{CamelFileNameOnly=row2.xml,
CamelFileAbsolutePath=D:\Temp\tutorial\camel-example-etl\apache-felix-karaf-1.1.0-SNAPSHOT\src\data\row2.xml,
CamelFileLastModified=Tue Jul 14 10:37:40 CEST 2009,
CamelFileAbsolute=false, CamelFileParent=src\data,
CamelFileRelativePath=row2.xml, CamelFileName=row2.xml,
CamelFilePath=src\data\row2.xml, CamelFileLength=982},
BodyType:org.apache.camel.example.etl.PersonDocument, Body:<person
user="hiram"><firstName>Hiram</firstName><lastName>Chirino</lastName><city>Tampa</city></person>
11:39:49,950 | ERROR | 1: FileComponent | GenericFileOnCompletion          |
rg.apache.camel.processor.Logger  248 | No body available of type:
org.apache.camel.example.etl.CustomerEntity but has value: Person[user:
hiram] of type: org.apache.camel.example.etl.PersonDocument on:
GenericFileMessage with body: Person[user: hiram] on the exchange:
Exchange[GenericFileMessage with body: Person[user: hiram]]
org.apache.camel.InvalidPayloadRuntimeException: No body available of type:
org.apache.camel.example.etl.CustomerEntity but has value: Person[user:
hiram] of type: org.apache.camel.example.etl.PersonDocument on:
GenericFileMessage with body: Person[user: hiram] on the exchange:
Exchange[GenericFileMessage with body: Person[user: hiram]]
    at
org.apache.camel.component.jpa.JpaEndpoint$1.evaluate(JpaEndpoint.java:268)

Any idea is welcome ?

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm

Re: Apache Felix Karaf - Equinox - TypeConverter not loaded

Posted by Charles Moulliard <cm...@gmail.com>.
In debug mode, we have this classloading issue :

12:13:50,043 | DEBUG | ExtenderThread-4 | OsgiPackageScanClassResolver     |
.DefaultPackageScanClassResolver  418 | Cannot find class
'org/apache/camel/converter/jaxb/JaxbConverter.class' in classloader:
BundleDelegatingClassLoader for [camel-core (org.apache.camel.camel-core)].
Reason: java.lang.ClassNotFoundException:
org.apache.camel.converter.jaxb.JaxbConverter not found from bundle
[org.apache.camel.camel-core]
java.lang.ClassNotFoundException:
org.apache.camel.converter.jaxb.JaxbConverter not found from bundle
[org.apache.camel.camel-core]
    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.impl.DefaultPackageScanClassResolver.addIfMatching(DefaultPackageScanClassResolver.java:405)
    at
org.apache.camel.osgi.OsgiPackageScanClassResolver.loadImplementationsInBundle(OsgiPackageScanClassResolver.java:121)
    at
org.apache.camel.osgi.OsgiPackageScanClassResolver.findInOsgiClassLoader(OsgiPackageScanClassResolver.java:81)
    at
org.apache.camel.osgi.OsgiPackageScanClassResolver.find(OsgiPackageScanClassResolver.java:60)
    at
org.apache.camel.impl.DefaultPackageScanClassResolver.findAnnotated(DefaultPackageScanClassResolver.java:100)
    at
org.apache.camel.osgi.OsgiAnnotationTypeConverterLoader.load(OsgiAnnotationTypeConverterLoader.java:42)
    at
org.apache.camel.impl.converter.DefaultTypeConverter.checkLoaded(DefaultTypeConverter.java:379)
    at
org.apache.camel.impl.converter.DefaultTypeConverter.doConvertTo(DefaultTypeConverter.java:160)
    at
org.apache.camel.impl.converter.DefaultTypeConverter.mandatoryConvertTo(DefaultTypeConverter.java:120)
    at
org.apache.camel.impl.converter.DefaultTypeConverter.mandatoryConvertTo(DefaultTypeConverter.java:113)
    at
org.apache.camel.util.IntrospectionSupport.convert(IntrospectionSupport.java:277)
    at
org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:233)
    at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:200)
    at
org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:156)
    at
org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:231)
    at
org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:65)
    at
org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:36)
    at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:80)
    at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:416)
    at
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:46)
    at
org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:154)
    at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:109)
    at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:115)
    at
org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
    at
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:84)
    at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:630)
    at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:136)
    at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:601)
    at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1156)
    at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1073)
    at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1009)
    at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:158)
    at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
    at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:884)
    at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:197)
    at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
    at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:562)
    at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
    at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
    at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
    at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
    at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
    at
org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
    at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
    at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
    at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException:
org.apache.camel.converter.jaxb.JaxbConverter
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
    at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at
org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
    at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
    at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
    at
org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
    ... 50 more

REMARKS :
- The bundle camel-jaxb is deployed on karaf/equinox
- The manifest file of the project imports the packages :
org.apache.camel.converter.jaxb and validated by checking imports of karaf
--> camel-jaxb (82): org.apache.camel.converter.jaxb;
version="2.2.0.SNAPSHOT"

It seems to only look in camel-core bundle and not camel-jaxb !!!!!!

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Tue, Dec 8, 2009 at 12:03 PM, Charles Moulliard <cm...@gmail.com>wrote:

> It seems that Apache Felxi Karaf 1.1.SNAPSHOT + Equinox
> (osgi-3.5.1.v20090827.jar) does not load a TypeConverter defined in
> META-INF/services/org/apache/camel directory
>
>         from("file:src/data?noop=true")
>             .convertBodyTo(PersonDocument.class)
>             .to("jpa:org.apache.camel.example.etl.CustomerEntity");
>
>         // the following will dump the database to files
>
> from("jpa:org.apache.camel.example.etl.CustomerEntity?consumeDelete=false&delay=3000&consumeLockEntity=false")
>             .setHeader(Exchange.FILE_NAME, el("${in.body.userName}.xml"))
>             .to("file:target/customers");
>
>
> 11:39:49,934 | INFO  | 1: FileComponent | Tracer
> | rg.apache.camel.processor.Logger   88 |
> 5e0daace-f84c-4b28-bfee-33347488e91a >>> (route1)  -->
> jpa://org.apache.camel.example.etl.CustomerEntity <<< Pattern:InOnly,
> Headers:{CamelFileNameOnly=row2.xml,
> CamelFileAbsolutePath=D:\Temp\tutorial\camel-example-etl\apache-felix-karaf-1.1.0-SNAPSHOT\src\data\row2.xml,
> CamelFileLastModified=Tue Jul 14 10:37:40 CEST 2009,
> CamelFileAbsolute=false, CamelFileParent=src\data,
> CamelFileRelativePath=row2.xml, CamelFileName=row2.xml,
> CamelFilePath=src\data\row2.xml, CamelFileLength=982},
> BodyType:org.apache.camel.example.etl.PersonDocument, Body:<person
> user="hiram"><firstName>Hiram</firstName><lastName>Chirino</lastName><city>Tampa</city></person>
> 11:39:49,950 | ERROR | 1: FileComponent | GenericFileOnCompletion
> | rg.apache.camel.processor.Logger  248 | No body available of type:
> org.apache.camel.example.etl.CustomerEntity but has value: Person[user:
> hiram] of type: org.apache.camel.example.etl.PersonDocument on:
> GenericFileMessage with body: Person[user: hiram] on the exchange:
> Exchange[GenericFileMessage with body: Person[user: hiram]]
> org.apache.camel.InvalidPayloadRuntimeException: No body available of type:
> org.apache.camel.example.etl.CustomerEntity but has value: Person[user:
> hiram] of type: org.apache.camel.example.etl.PersonDocument on:
> GenericFileMessage with body: Person[user: hiram] on the exchange:
> Exchange[GenericFileMessage with body: Person[user: hiram]]
>     at
> org.apache.camel.component.jpa.JpaEndpoint$1.evaluate(JpaEndpoint.java:268)
>
> Any idea is welcome ?
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>