You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dunnlow <du...@yahoo.com> on 2011/08/25 18:10:10 UTC

TypeConverter not being loaded?

I suppose I'm confused about how to load my TypeConverter.  I have a Spring
web-app running in tomcat (tried glassfish too), have an annotated class,
and have placed a TypeConverter in several locations, including
/META-INF/services/org/apache/camel, /WEB-INF, and /WEB-INF/classes. 
However, when Camel loads debug shows only the standard TypeConverters being
loaded.  Any thoughts on what I could be doing wrong?  I would think I
should at least see my class being loaded/referenced?

Thanks for any insight!
-J

-----------------------------------------
1) The TypeConverter file has just one line which is the package of my
class, com.me.converters

2) My converter declaration:
@Converter
public final class MyBeanConverter
.
.
@Converter
public static MyEventBean
toMyEventBean(org.apache.camel.component.file.GenericFile genericFile,
Exchange exchange) throws IllegalArgumentExceptions,
invocationTargetException, IllegalAccessException

the debug when I run my app:
.
.
SpringCamelContext - Set the application context classloader to:
WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
DefaultTypeConverter - Loading type converters ...
AnnotationTypeConverterLoader - Loading file
META-ING/services/org/apache/camel/TypeConverter to retrieve list of
packages, from url:
jar:file:/c:/...../activemq-camel-5.5.0.jar!/META-INF/services/org.../camel/TypeConverter
AnnotationTypeConverterLoader - Loading file
META-ING/services/org/apache/camel/TypeConverter to retrieve list of
packages, from url:
jar:file:/c:/...../camel-context-2.7.2.jar!/META-INF/services/org.../camel/TypeConverter
AnnotationTypeConverterLoader - Loading file
META-ING/services/org/apache/camel/TypeConverter to retrieve list of
packages, from url:
jar:file:/c:/...../camel-core-2.7.2.jar!/META-INF/services/org.../camel/TypeConverter
AnnotationTypeConverterLoader - Loading file
META-ING/services/org/apache/camel/TypeConverter to retrieve list of
packages, from url:
jar:file:/c:/...../drools-camel-5.2.0.Final.jar!/META-INF/services/org.../camel/TypeConverter
DefaultPackageScanClassResolver - Searching for annotations of
org.apache.camel.Converter in packages:[...my package is not listed here..]
DefaultPackageScanClassResolver - Found: [class ....my class not listed
here]
AnnotationTypeConverterLoader - Found 6 packages with 16 @Converter classes
to load
DefaultTypeConverter - Loading type convetrers done
DefaultTypeConverter - Loaded 152 type converters in .719 seconds
.
.
Exception Caused by: No type convetrer available to convert type
org.apache.camel.component.file.GenericFile to the required type:
com.me.MyEventBean with value GenericFile

--
View this message in context: http://camel.465427.n5.nabble.com/TypeConverter-not-being-loaded-tp4735055p4735055.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: TypeConverter not being loaded?

Posted by camal-kat <pa...@yahoo.com>.
Stack is tomcat/spring/camel with a maven generated war.

I placed the TypeConverter file in
$PROJECT_HOME/WEB-INF/classes/META-INF/services/org/apache/camel.

That was picked up from the deployed war.

--
View this message in context: http://camel.465427.n5.nabble.com/TypeConverter-not-being-loaded-tp4735055p4809281.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: TypeConverter not being loaded?

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

Which version of Camel are you using?
Did you deploy the camel application into the web container or OSGi 
platform ?

It will be complicated when you are doing this :)

Willem


On Fri Sep 16 05:06:31 2011, camal-kat wrote:
> Has anyone found what the issue us? I placed my TypeConverter with a FQN
> entry into all the places I could think it would be picked up including
> META-INF/services/org/apache/camel and it doesn't get loaded.
>
> As a test, I opened up the camel-core jar and placed my entry in the
> TypeConverter file in the jar. It was picked up fine that way.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConverter-not-being-loaded-tp4735055p4808313.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>





Re: TypeConverter not being loaded?

Posted by camal-kat <pa...@yahoo.com>.
Has anyone found what the issue us? I placed my TypeConverter with a FQN
entry into all the places I could think it would be picked up including
META-INF/services/org/apache/camel and it doesn't get loaded.

As a test, I opened up the camel-core jar and placed my entry in the
TypeConverter file in the jar. It was picked up fine that way.

--
View this message in context: http://camel.465427.n5.nabble.com/TypeConverter-not-being-loaded-tp4735055p4808313.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: TypeConverter not being loaded?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You got any further with this issue?

Have you considered using Camel 2.8.0? It allows you to use the FQN
class name of your custom type converters in the TypeConverter file,
which allows Camel to do pure classpath loading of the converter,
which is faster and more easier than JAR scanning.

See details at
http://camel.apache.org/type-converter.html

On Thu, Aug 25, 2011 at 6:41 PM, dunnlow <du...@yahoo.com> wrote:
> I should add that I tried loading the converter class as a bean in my
> app-context.xml but that didn't do the trick either.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConverter-not-being-loaded-tp4735055p4735153.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: TypeConverter not being loaded?

Posted by dunnlow <du...@yahoo.com>.
I should add that I tried loading the converter class as a bean in my
app-context.xml but that didn't do the trick either.

--
View this message in context: http://camel.465427.n5.nabble.com/TypeConverter-not-being-loaded-tp4735055p4735153.html
Sent from the Camel - Users mailing list archive at Nabble.com.