Hi, 
I have a bundle with custom code that I add to the deploy directory in 
ServiceMix 5.3.0.
This bundle uses camel-ftp but the classloader in ObjectHelper won't find the 
resource
META-INF/services/org/apache/camel/component/sftp that's inside the camel-ftp 
jar.
The same code works with a standalone application (outside of Karaf).
Camel ftp was not being imported by this bundle jar and I added imports for 
org.apache.camel.component.file.remote,version=2.13.2 from 
org.apache.camel.camel-ftp (192)
org.apache.camel.component.file.remote.strategy,version=2.13.2 from 
org.apache.camel.camel-ftp (192)
However, it does not matter if you add the imports or not, the resource 
META-INF/services/org/apache/camel/component/sftp is not found and 
as a result the upload of a file to an SFTP server does not work.
In the standalone application I get 
11:22:13.237 [main] DEBUG o.a.c.impl.DefaultComponentResolver - Found 
component: sftp in registry: null
11:22:13.239 [main] DEBUG o.a.c.impl.DefaultComponentResolver - Found 
component: sftp via type: org.apache.camel.component.file.remote.SftpComponent 
via: META-INF/services/org/apache/camel/component/sftp
whereas inside Karaf 
I get only the first line.
Ultimately it's code in ObjectHelper class that's not finding the resource:
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        if (contextClassLoader != null) {
            in = contextClassLoader.getResourceAsStream(resolvedName);
        }
        if (in == null) {
            in = 
ObjectHelper.class.getClassLoader().getResourceAsStream(resolvedName);
        }
        if (in == null) {
            in = ObjectHelper.class.getResourceAsStream(resolvedName);
        }
The variable in remains null for 
META-INF/services/org/apache/camel/component/sftp that's inside the camel-ftp 
jar.
Any idea why this is happening and how to solve it?
Thanks,

pau

Reply via email to