[ 
https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61464#action_61464
 ] 

Andrzej Kulakowski commented on SMXCOMP-688:
--------------------------------------------

Hello,
 Your last comment helped substantially and now I am getting closer (am 
pursuing approach with providedBus in a Smx4 fashion), because I can see this 
in Smx4 log:

11:55:10,526 | INFO  | xtenderThread-61 | DefaultListableBeanFactory       | 
pport.DefaultListableBeanFactory  467 | Overriding bean definition for bean 
'{http://vf.balticamadeus.lt/employee/1.0/}EmployeeDataServiceImplPort.http-conduit':
 replacing [Generic bean: class [org.apache.cxf.transport.http.HTTPConduit]; 
scope=singleton; abstract=true; lazyInit=fals
e; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; 
factoryBeanName=null; factoryMethodName=null; initMethodName=null; 
destroyMethodName=null] with [Generic bean: class 
[org.apache.cxf.transport.http.HTTPConduit]; scope=singleton; abstract=true; 
lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; 
primary=false;
 factoryBeanName=null; factoryMethodName=null; initMethodName=null; 
destroyMethodName=null]

At least, I suspect that my component loads cxf.xml config file which is a good 
thing :) But there is another problem that prevents it from starting 
successfully up till the end, because it fails in the process.
So here is where I am now.

 I have added lines [1] to my beans.xml as shown in [2]. Also I had to add this 
entry [3] in xsi:schemaLocation in beans.xml, because otherwise beans.xml won's 
pass validation check and throws an exception once deployed into Smx4. Also I 
have added this dependency [4] to my pom accordingly and also added the same 
artifact inside <Import-Package>. Now whenever I try to deploy this bundle into 
Smx4 and try to start it manually I get this message  in the console:
The bundle could not be resolved. Reason: Missing Constraint: Import-Package: 
org.apache.servicemix.servicemix-core; version="0.0.0"
and the bundle remains as simply "Installed". When I remove servicemix-core 
artifact from <Import-Package> then I get the exception:

11:55:10,527 | ERROR | xtenderThread-61 | ContextLoaderListener            | 
BundleApplicationContextListener   50 | Application context refresh failed 
(OsgiBundleXmlApplicationContext(bundle=bc-EMP-Duo, 
config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema 
namespace [http://servicemix.apache.org/config/1.0]
Offending resource: URL 
[bundleentry://412.fwk28036099/META-INF/spring/beans.xml]

How should I behave with entry [1], because according to [2] there is no 
schemaLocation described at all for this nor any other entry?


[1]
xmlns:sm="http://servicemix.apache.org/config/1.0";
...
<sm:container id="jbi" embedded="true">
   <sm:endpoints>
      ...
   </sm:endpoints>
</sm:container>

[2] 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider.xml?revision=896758&view=markup&pathrev=896758

[3] http://servicemix.apache.org/config/1.0 
http://servicemix.apache.org/schema/servicemix-core-3.3.xsd

[4]     <dependency>
                        <groupId>org.apache.servicemix</groupId>
                        <artifactId>servicemix-core</artifactId>
                        <version>3.3.2</version>
                </dependency>

Appreciated,
Andrzej

> servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi 
> bundle
> ----------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-688
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-688
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: servicemix-cxf-bc-2009.02
>         Environment: apache-servicemix-4.1.0-SNAPSHOT build 164
> OSX
> java version "1.6.0_17"
> Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
> Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
>            Reporter: Paul Mietz Egli
>            Assignee: Freeman Fang
>             Fix For: servicemix-cxf-bc-2010.01
>
>         Attachments: smx4-bus-config.tar.gz, smx4-provided-bus.diff
>
>
> I've been attempting to set up CXF to use digest authentication by specifying 
> a value for the busCfg attribute of a cxfbc:provider endpoint.  When I use a 
> relative file path like the example code, I get a "Failed to load 
> configuration com/example/cxf/bus.xml", which I more or less would expect.  
> Using a "classpath:" prefix for the attribute value, I this 
> IllegalArgumentException:
> Caused by: java.lang.IllegalArgumentException: name
>       at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458)
>       at sun.misc.URLClassPath.findResource(URLClassPath.java:145)
>       at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
>       at java.lang.ClassLoader.getResource(ClassLoader.java:1040)
>       at 
> org.springframework.osgi.context.internal.classloader.ChainedClassLoader.doGetResource(ChainedClassLoader.java:128)
>       at 
> org.springframework.osgi.context.internal.classloader.ChainedClassLoader.getResource(ChainedClassLoader.java:110)
>       at 
> org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:160)
>       at 
> org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:175)
>       at 
> org.springframework.core.io.AbstractResource.exists(AbstractResource.java:51)
>       at 
> org.apache.cxf.bus.spring.BusApplicationContext.findResource(BusApplicationContext.java:196)
>       at 
> org.apache.cxf.bus.spring.BusApplicationContext.getConfigResources(BusApplicationContext.java:144)
>       at 
> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:107)
>       at 
> org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusApplicationContext.java:262)
>       at 
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
>       at 
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
>       at 
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
>       at 
> org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:91)
>       at 
> org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:102)
>       at 
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
>       at 
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:88)
>       at 
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)
>       at 
> org.apache.servicemix.cxfbc.CxfBcProvider.getBus(CxfBcProvider.java:601)
>       at 
> org.apache.servicemix.cxfbc.CxfBcProvider.validate(CxfBcProvider.java:422)
>       ... 41 more
> Using a debugger, I can see that the ChainedClassLoader contains the 
> following objects:
>   [BundleDelegatingClassLoader for [ServiceMix :: CXF Binding Component 
> (servicemix-cxf-bc)], 37.0, 40.0, 42.0, 69.0]
> where 37 is spring-aop, 40 is cglib, 42 is spring-osgi-core, and 69 is 
> servicemix-common.  There is no bundle classloader for my bundle, so even 
> though I've exported com/example/cxf, I wouldn't expect the 
> ChainedClassLoader to find it.
> It seems to me that we have a chicken-and-egg problem: we need the bus to 
> validate the component, yet we can't load the bus configuration from our 
> bundle when the component is being validated.  I thought about attaching a 
> fragment bundle to the CXF binding component, but I'm not sure if that would 
> work and it seems like a lot of trouble.
> One way around the issue would be to create a means of setting the bus object 
> using Spring, like Camel's CXF component.  I'm attaching a patch for 
> consideration which adds a setBus() method to CxfBcProvider and modifies 
> getBus() to return the object from setBus() if any.  With these changes, I'm 
> able to configure my CXF bus for Digest auth and provide it to the endpoint.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to