You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Jim Newsham (JIRA)" <ji...@apache.org> on 2011/05/28 03:35:47 UTC

[jira] [Commented] (CAMEL-4026) DefaultCamelContext start throws exception due to failure in type converter classpath scanning

    [ https://issues.apache.org/jira/browse/CAMEL-4026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040528#comment-13040528 ] 

Jim Newsham commented on CAMEL-4026:
------------------------------------

Some further information which might be useful.

This may be the same issue as CAMEL-522 (resolved in Camel 1.5.0).  In that issue, it was stated that using the version-based protocol (something like <jar href="camel-core.jar" version="1.4.01"/>) fails, while including the version in the jar name  (something like <jar href="camel-core-1.4.01.jar"/>) succeeds.  I have only tested the version-based protocol, and this is the case which fails for me.

Andreas Kuhtz suggested on the mailing list [1] that the issue is caused by the webstart classloader not returning the correct url for the jar.  This assessment seems correct to me, as I confirmed that a resource url for package "test" was returned from the classloader as:

jar:http://localhost:8080/camel-webstart/lib/camel-webstart.jar!/test/

when the jar actually originated from:

http://localhost:8080/camel-webstart/lib/camel-webstart__V2.21-20110527-e55f306.jar

... where 2.21-20110527-e55f306 is the version.

The classloader is of type com.sun.jnlp.JNLPClassLoader.  I haven't tested this, but it seems like method "JarFile getJarFile(URL)" might be used to convert from the url to the cached jar file.  Unfortunately, making use of this method would bind you to the internal com.sun implementation. :(

[1] http://camel.465427.n5.nabble.com/addTypeConverter-does-not-clear-misses-in-BaseTypeConverterRegistry-td4288871.html

> DefaultCamelContext start throws exception due to failure in type converter classpath scanning
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4026
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4026
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.7.1
>         Environment: Windows 7
>            Reporter: Jim Newsham
>
> This is a regression.  Worked fine for us in Camel 2.5.0, fails in Camel 2.7.1.  
> Easy to reproduce.  Run the following code in a webstart-deployed application:
> CamelContext context = new DefaultCamelContext();
> context.getTypeConverterRegistry(); 
> Which produces the following exception:
> 2011-05-26 16:52:57,550 [javawsApplicationMain] ERROR test.TestCamelContext - Failed
> org.apache.camel.RuntimeCamelException: org.apache.camel.TypeConverterLoaderException: Failed to load type converters because of: Cannot find any type converter classes from the following packages: [org.apache.camel.component.file, org.apache.camel.component.bean, org.apache.camel.converter]
>     at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
>     at org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:986)
>     at org.apache.camel.impl.DefaultCamelContext.getTypeConverterRegistry(DefaultCamelContext.java:1001)
>     at test.TestCamelContext.test(TestCamelContext.java:54)
>     at test.TestCamelContext.main(TestCamelContext.java:48)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at com.sun.javaws.Launcher.executeApplication(Unknown Source)
>     at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
>     at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
>     at com.sun.javaws.Launcher.run(Unknown Source)
>     at java.lang.Thread.run(Unknown Source)
> Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load type converters because of: Cannot find any type converter classes from the following packages: [org.apache.camel.component.file, org.apache.camel.component.bean, org.apache.camel.converter]
>     at org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:79)
>     at org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:395)
>     at org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:41)
>     at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>     at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>     at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>     at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1613)
>     at org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:899)
>     at org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:984)
>     ... 12 more

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira