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

Daniel Kulp commented on CAMEL-9168:
------------------------------------

This is not really something I'd classify as a bug.   The "classpath:" URL in 
CXF really depends on there being a definition for what the classpath is.   In 
OSGi, there isn't a clear concept for that.  In addition, the fallback to 
relying on a Thread contextClassloader is also highly discouraged and 
unreliable.   Thus, the "classpath:" url really cannot be relied on within the 
context of OSGi.    The "Dynamic-Import: *" thing works as that pretty much 
creates a pseudo classloader that loads everything available.   You MAY be able 
to limit the scope a little bit by using a Require-Bundle: cxf-core, but I'm 
not 100% positive on that.

Ideally, the sample code should be updated to construct a proper "deploy model 
independent" URL for the WSDL that is passed in.   A simple way to do that 
would be something as simple as  
"getClass().getResource("Foo.wsdl").toString()" or similar to grab the resource 
as a proper URL.   In OSGi, that would likely result in some sort of 
"bundle:///" URL.   Outside OSGi, likely a "file:/blah.jar!/..." kind of URL.   
 (In OSGi, you may need to make sure the WSDL is in a package that is exported 
from the bundle, not the root package, not really sure)

That said, digging through the stack trace, there MAY be a way to get this to 
work with some changes to both CXF's Spring handling and camel-cxf's handling.  
 Not 100% sure though.

One more note:  if deploying in OSGi:  I'd strongly strongly strongly recommend 
using Blueprint and not spring-dm.   

> CXF - Classpath resource not found when RoutesBuilder exposed as OSGi service
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-9168
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9168
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxf, osgi
>    Affects Versions: 2.15.3
>            Reporter: Alexey Markevich
>         Attachments: camel-example-cxf.zip, r2-0.2.jar, route.xml
>
>
> 17:11:03,780 | WARN  | tenderThread-145 | .apache.cxf.resource.URIResolver  
> 375 | 82 - org.apache.cxf.cxf-core - 3.1.2 | Resource classpath:DemoWsdl_0.1 
> was not found in the classloaders.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to