Hi How do you deploy your Camel application? Do you put all the JARs in a WAR? Or do you have some shared JARs in the Tomcat shared lib directory or something?
It does sound like a classpath issue due the latter. If all JARs are in the WAR then it ought to use same classloader and just work. On Tue, Aug 19, 2014 at 2:19 PM, jcuk <jasoncran...@hotmail.com> wrote: > Hello > > I'm currently experiencing a problem initializing the TypeConverters in > Camel in a Spring WebApp. > > As soon as the first exchange is created and the type converters are loaded > (or type converters are loaded explicitly with > camleContext.getTypeConverterRegistry() ) then I get the following > exception: > > org.apache.camel.RuntimeCamelException: java.lang.ClassCastException: Not > instanceof org.apache.camel.TypeConverter value: > org.apache.camel.converter.jaxb.FallbackTypeConverter@35f3198f: > java.lang.ClassCastException: Not instanceof org.apache.camel.TypeConverter > value: org.apache.camel.converter.jaxb.FallbackTypeConverter@35f3198f > at > org.apache.camel.impl.DefaultFactoryFinder.newInstance(DefaultFactoryFinder.java:109) > at > org.apache.camel.impl.DefaultFactoryFinder.newInstance(DefaultFactoryFinder.java:99) > at > org.apache.camel.impl.DefaultFactoryFinder.newInstances(DefaultFactoryFinder.java:65) > at > org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadFallbackTypeConverters(BaseTypeConverterRegistry.java:542) > at > org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:535) > at > org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:47) > at > org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at > org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:1888) > at > org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:979) > at > org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:940) > at > org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:1148) > at > org.apache.camel.impl.DefaultCamelContext.getTypeConverterRegistry(DefaultCamelContext.java:1165) > > However, org.apache.camel.converter.jaxb.FallbackTypeConverter implements > TypeConverter so how can this be the case? I'm not doing anything with > custom type converters. I have found this on > http://camel.apache.org/type-converter.html: > > --- > Exposed the TypeConverterRegistry from CamelContext so end users more easily > will be able to add type converters at runtime. This is also usable in > situations where the default discovering of type converters fails on > platforms with classloading issues. > > To access the registry, you get it from the CamelContext > CamelContext context = ... > context.getTypeConverterRegistry() > --- > > but there is no indication of exactly how this could be used if there are > class loading issues, and also simply calling getTypeConverterRegistry() > triggers the problem, so I can't see how this would be of any use. > > I initially thought it may be caused by multiple versions of camel being > included in the deployment, but I've checked and only one version of camel > is used in the deployment war. Also the version of camel-core and > camel-spring are matching. > > I'm currently using spring 3.2.1 and camel version 2.12.1, but I've also > tried 2.12.4 and 2.13.2 with the same result. It occurs consistently on my > local machine where I use the maven-jetty plugin (6.1.26) under cygwyn, > however when deployed to a Tomcat server (v5.5.20 running on CentOS 5.1), > the problem is only intermittent. > > Any pointers to what could be the problem would be much appreciated > > thanks in advance > > Jason > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/java-lang-ClassCastException-Not-instanceof-org-apache-camel-TypeConverter-value-org-apache-camel-cor-tp5755390.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/