camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mabels <meno.ab...@adviser.com>
Subject OSGI camel-avro:2.12.1 AvroDataFormat:loadDefaultSchema
Date Fri, 22 Nov 2013 15:15:30 GMT
Hey,

we use camel-avro on osgi-karaf. We use the OsgiDefaultContext and in a
marshal(routentry) we get during runtime the exception:

Can't set the shcema of AvroDataFormat with "+ className + ", as the class
is not a subClass of SpecificData"

so we try to figure out whats going on there and discovered this code in:

 protected Schema loadDefaultSchema(String className, CamelContext context)
throws CamelException, ClassNotFoundException {
       Class<?> instanceClass =
context.getClassResolver().resolveMandatoryClass(className);
       if (GenericContainer.class.isAssignableFrom(instanceClass)) {

and the isAssignableFrom methode returns falsce in our case. This is happen
due to the fact that the 
instanceClass is returned from the classloader which is related to the
OsgiDefaultContext. And the
classloader GenericContainer.class make us is the classloader of the
camel-avro bundle. So both 
class instances are not from the same classloader and  isAssignableFrom
returns false. 

I currently not understand how to solve this in loadDefaultSchema it should
be something like

if
(context.getClassResolver().resolveMandatoryClass("GenericContainer").isAssignableFrom(instanceClass))

thx in advance

meno




--
View this message in context: http://camel.465427.n5.nabble.com/OSGI-camel-avro-2-12-1-AvroDataFormat-loadDefaultSchema-tp5743694.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message