You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Paul Mietz Egli (JIRA)" <ji...@apache.org> on 2009/12/11 01:03:52 UTC

[jira] Created: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

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
         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.


[jira] Issue Comment Edited: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Andrzej Kulakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61402#action_61402 ] 

Andrzej Kulakowski edited comment on SMXCOMP-688 at 8/25/10 6:58 AM:
---------------------------------------------------------------------

Thanks again Freeman,
 I figure I have to implement my own bean class (of type org.apache.cxf.Bus) and load it with providedBus on the client side similar to an interceptor. I am referring to this documentation here [1], are there any other nuances I should know of about at this point? I am rather fresh at this so any directions would be appreciated before I start delving into the deep waters :)

Though I am curious what will happen to busCfg attribute in the (near) future - will it be fixed or removed altogether so I can permanently forget about it?

[1] http://cxf.apache.org/docs/bus-configuration.html

      was (Author: zigfryd):
    Thanks again Freeman,
 I figure I have to implement my own bean class and load it with providedBus on the client side similar to an interceptor. I am referring to this documentation here [1], are there any other nuances I should know of about at this point? I am rather fresh at this so any directions would be appreciated before I start delving into the deep waters :)

Though I am curious what will happen to busCfg attribute in the (near) future - will it be fixed or removed altogether so I can permanently forget about it?

[1] http://cxf.apache.org/docs/bus-configuration.html
  
> 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.


[jira] Work started: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on SMXCOMP-688 started by Freeman Fang.

> 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
>         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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Andrzej Kulakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61402#action_61402 ] 

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

Thanks again Freeman,
 I figure I have to implement my own bean class and load it with providedBus on the client side similar to an interceptor. I am referring to this documentation here [1], are there any other nuances I should know of about at this point? I am rather fresh at this so any directions would be appreciated before I start delving into the deep waters :)

Though I am curious what will happen to busCfg attribute in the (near) future - will it be fixed or removed altogether so I can permanently forget about it?

[1] http://cxf.apache.org/docs/bus-configuration.html

> 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.


[jira] Updated: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Paul Mietz Egli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Mietz Egli updated SMXCOMP-688:
------------------------------------

    Attachment: smx4-provided-bus.diff

patch that adds a setBus() method to CxfBcProvider, allowing a preconfigured bus to be used.

> 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
>         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.


[jira] Issue Comment Edited: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61459#action_61459 ] 

Freeman Fang edited comment on SMXCOMP-688 at 8/26/10 11:42 PM:
----------------------------------------------------------------

Hi,

For your questions

1) & 2)
You can use providedBus. For the providedBus, you needn't write a class to extend CxfBus, you only need a spring file to configure the cxf bus and pass it to providedBus, you need take a look at the commit with this jira. With providedBus, you can put all class/resources in your own customer bundle.

3)If you still want to use busCfg as you do in smx3, you need  create a fragment bundle including the busCfg file, and attach it to cxf bundle(cxf bundle is a bundle containing all cxf related classes/resoures, especially the CxfBus init code in our case). This is the way to make busCfg file visible to cxf bundle with OSGi classloader mechanism. So we mentioned three bundles now, your own customer bundle(you create it), a fragment bundle including busCfg file(you create it), cxf bundle(cxf bundle is already in the container by default, it's not created yourself, it play the role as a host for the fragment bundle you created.)

Hope this helps.

Freeman

      was (Author: ffang):
    Hi,

For your questions

1) & 2)
You should use providedBus  as I mentioned if  you want to put all configuration files in your customer bundle. For the providedBus, you needn't write a class to extend CxfBus, you only need a spring file to configure the cxf bus and pass it to providedBus, you need take a look at the commit with this jira.

3)If you still want to use busCfg, also as I commented before, you need  create a fragment bundle including the busCfg file, and attach it to cxf bundle.

Freeman
  
> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61407#action_61407 ] 

Freeman Fang commented on SMXCOMP-688:
--------------------------------------

Hi,

busCfg would  be preferred way for SMX3. We introduce providedBus for SMX4 as SMX4 is based on OSGi container,which use quite different  classloader mechanism with the old hierarchical classloader. With providedBus, we just pass a spring bean as an object, but with busCfg, we actually pass a resource file(busCfg) from the customer bundle to cxf bundle, but the resource file(busCfg) in customer bundle isn't visible to cxf bundle in OSGi world, so you see the exception. If you still want to use busCfg with smx4, I think you need create a fragment bundle including the busCfg file, and attach it to cxf bundle.

Freeman

> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61494#action_61494 ] 

Freeman Fang commented on SMXCOMP-688:
--------------------------------------

Hi,

I don't think  you need xmlns:sm="http://servicemix.apache.org/config/1.0", 
you shouldn't use 
<sm:container id="jbi" embedded="true">
<sm:endpoints>
...
</sm:endpoints>
</sm:container>
for JBI endpoint configuration in SMX4 container.
So the servicemix-core dependency shouldn't be in the pom at all.

You need take a look at cxf-wsdl-fisrt/cxf-wsdl-firt-osig-package example shipped with kit, to get ideas how to configure jbi endpoint in smx4.

Freeman

> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61550#action_61550 ] 

Freeman Fang commented on SMXCOMP-688:
--------------------------------------

Paul,

Agree, put such discussion on mailing list is more appropriate.

Freeman

> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61397#action_61397 ] 

Freeman Fang commented on SMXCOMP-688:
--------------------------------------

Hi,

You should use providedBus instead of busCfg.
Yeah, you need take a look at my commit to get more details, especially [1]

[1]http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml?r1=896758&r2=896757&pathrev=896758

Freeman

> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Andrzej Kulakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61453#action_61453 ] 

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

Hello Mr. Freeman,
 I am still fruitlessly struggling to get bus config loaded into cxf-bc provider. Here is the list of my approaches so far:

1) I have tried to supply cxf.xml file for Cxf-bc provider in OSGi package via <import resource="classpath:cxf.xml" /> and/or simply placing cxf.xml on the classpath so CXF would load it automatically upon starting up. This approach at least was runnable, but authentication parameters supplied in cxf.xml were not taken into effect. I am curious if this approach is supported at all? here is where i found it [1] .
[1] http://cxf.apache.org/docs/configuration.html

2) I tried to create a class that implements org.apache.cxf.Bus and then pass it to the providedBus, but I have failed to achieve any plausible effect, largely due to not knowing exactly what values should I set in that class etc.. Could you be more precise on contents of this class and how to deliver it in a optimal way? Google didn't find any samples nor tutorials regarding "cxf bc providedBus" query.

3) Out of sheer curiosity I took the supplied "cxf-wsdl-first" sample from smx4 package and merely modified cxf-bc module's pom to make sure it uses servicemix-cxf-bc version 2010.01 and added "busCfg="classpath:auth.xml" to the xbean.xml file. File auth.xml resides in the same place as the person.wsdl.
Here are the contents of auth.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:sec="http://cxf.apache.org/configuration/security"
	xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xsi:schemaLocation="
    	http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

        <http:conduit name="*.http-conduit">
        	<http:client AllowChunking="false" />
		</http:conduit>
</beans>

After successfully packaging (JBI service assembly in a *.zip file) and deploying into smx4 I get the following exception after starting the component:

16:12:27,355 | ERROR | use-01-00/deploy | ServiceAssemblyInstaller         | er.impl.ServiceAssemblyInstaller  100 | Error deploying SU wsdl-first-cxfbc-su
16:12:27,355 | ERROR | use-01-00/deploy | Deployer                         | cemix.jbi.deployer.impl.Deployer  360 | Error handling bundle start event
javax.jbi.JBIException: java.lang.Exception: Error deploying SU wsdl-first-cxfbc-su
        at org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:101)
        at org.apache.servicemix.jbi.deployer.impl.Deployer.onBundleStarted(Deployer.java:352)
        at org.apache.servicemix.jbi.deployer.impl.Deployer.bundleChanged(Deployer.java:282)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:919)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1350)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1301)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:362)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1090)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1076)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:405)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:212)
Caused by: java.lang.Exception: Error deploying SU wsdl-first-cxfbc-su
        at org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:213)
        at org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:85)
        ... 14 more
Caused by: javax.jbi.management.DeploymentException: java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Failed to load configuration classpath:aut
h.xml
        at org.apache.servicemix.cxfbc.CxfBcConsumer.validate(CxfBcConsumer.java:535)
        at org.apache.servicemix.common.AbstractDeployer.validate(AbstractDeployer.java:58)
        at org.apache.servicemix.common.xbean.BaseXBeanDeployer.validate(BaseXBeanDeployer.java:55)
        at org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:97)
        at org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
        at org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
        at org.apache.servicemix.jbi.deployer.artifacts.ServiceUnitImpl.deploy(ServiceUnitImpl.java:104)
        at org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:207)
        ... 15 more
Caused by: java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Failed to load configuration classpath:auth.xml
        at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:96)
        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.CxfBcConsumer.getBus(CxfBcConsumer.java:623)
        at org.apache.servicemix.cxfbc.CxfBcConsumer.retrieveWSDL(CxfBcConsumer.java:605)
        at org.apache.servicemix.cxfbc.CxfBcConsumer.validate(CxfBcConsumer.java:406)
        ... 22 more
Caused by: org.springframework.context.ApplicationContextException: Failed to load configuration classpath:auth.xml
        at org.apache.cxf.bus.spring.BusApplicationContext.getConfigResources(BusApplicationContext.java:152)
        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:110)
        at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
        ... 27 more

The reason here seems to be the inability to load the config file, which can be noticed in the middle of the exception stack. What's wrong with this piece of code? As it is am totally lost of what I am doing wrong here, I have already spent 3 days researching this matter.


Thanks in advance for Your help,
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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Andrzej Kulakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61396#action_61396 ] 

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

Hello Freeman, 
 thanks for Your swift reply and here are the details I am testing with:
1) apache-servicemix-4.2.0-fuse-01-00
2) servicemix-cxf-bc (2010.01.0.fuse-01-00)
3) spring config:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
       xmlns:test="http://vf.balticamadeus.lt/employee/1.0/"
       xsi:schemaLocation="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                http://servicemix.apache.org/cxfbc/1.0 http://servicemix.apache.org/schema/servicemix-cxf-bc-2009.01.xsd">

  	<cxfbc:provider wsdl="classpath:META-INF/EmployeeData.wsdl"
  					locationURI="http://localhost:8084/root"
					service="test:EmployeeDataServiceImplService"
					endpoint="EmployeeDataServiceImplPort"
					interfaceName="test:EmpProvider"
					busCfg="classpath:META-INF/spring/auth.xml">
	</cxfbc:provider>

	<cxfbc:consumer	wsdl="classpath:META-INF/EmployeeData.wsdl"
					endpoint="test:EmployeeDataServiceImplPort2"
					service="test:EmployeeDataServiceImplService"
					targetService="test:EmployeeDataServiceImplService"
					targetEndpoint="EmployeeDataServiceImplPort"
					targetInterface="test:EmpProvider"
					mtomEnabled="true" />

  <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
</beans>

4) my auth.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:sec="http://cxf.apache.org/configuration/security"
	xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xsi:schemaLocation="
    	http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

        <http:conduit name="{http://my_namespace_here/employee/1.0/}EmployeeDataServiceImplPort.http-conduit">
			<http:authorization>
				<sec:UserName>my_username_here</sec:UserName>
				<sec:Password>my_password_here</sec:Password>
			</http:authorization>
		</http:conduit>
</beans>

5) exception:

javax.jbi.management.DeploymentException: java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Failed to load configuration classpath:META-INF/sprin
g/auth.xml
        at org.apache.servicemix.cxfbc.CxfBcProvider.validate(CxfBcProvider.java:521)
        at org.apache.servicemix.common.osgi.EndpointTracker$OsgiServiceUnit.<init>(EndpointTracker.java:77)
        at org.apache.servicemix.common.osgi.EndpointTracker.register(EndpointTracker.java:58)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.osgi.util.internal.ReflectionUtils.invokeMethod(ReflectionUtils.java:108)
        at org.springframework.osgi.config.internal.adapter.CustomListenerAdapterUtils.invokeCustomMethods(CustomListenerAdapterUtils.java:155)
        at org.springframework.osgi.config.internal.adapter.OsgiServiceLifecycleListenerAdapter.bind(OsgiServiceLifecycleListenerAdapter.java:201)
        at org.springframework.osgi.service.importer.support.internal.util.OsgiServiceBindingUtils.callListenersBind(OsgiServiceBindingUtils.java:50)
        at org.springframework.osgi.service.importer.support.internal.collection.OsgiServiceCollection$Listener.serviceChanged(OsgiServiceCollection.java:107)
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:933)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:755)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:710)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:129)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:206)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:507)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:525)
        at org.apache.servicemix.common.osgi.EndpointExporter.deploy(EndpointExporter.java:121)
        at org.apache.servicemix.common.osgi.EndpointExporter.afterPropertiesSet(EndpointExporter.java:174)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExec
utor.java:136)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Failed to load configuration classpath:META-INF/spring/auth.xml
        at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:96)
        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:612)
        at org.apache.servicemix.cxfbc.CxfBcProvider.validate(CxfBcProvider.java:413)
        ... 42 more
Caused by: org.springframework.context.ApplicationContextException: Failed to load configuration classpath:META-INF/spring/auth.xml
        at org.apache.cxf.bus.spring.BusApplicationContext.getConfigResources(BusApplicationContext.java:152)
        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:110)
        at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
        ... 46 more

While I am awaiting at Your reply I am going to take a deeper look at this piece code changes in Your latest commit:
-                      busCfg="org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml"
                       >
+        <cxfbc:providedBus>
+           <ref bean="cxf"/>
+        </cxfbc:providedBus> 

I hope that I am missing something here and the answer is all here nearby.

> 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.


[jira] Issue Comment Edited: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61459#action_61459 ] 

Freeman Fang edited comment on SMXCOMP-688 at 8/26/10 11:58 PM:
----------------------------------------------------------------

Hi,

For your questions

1) & 2)
You can use providedBus. For the providedBus, you needn't write a class to extend CxfBus, you only need a spring file to configure the cxf bus and pass it to providedBus, you need take a look at the commit with this jira. With providedBus, you can put all class/resources in your own customer bundle.
Also for your 1), do you mean you already use providedBus but authentication parameters not take effect? In this case you need ensure the http-conduit endpoint name you specified should be same as it for cxf bc provider endpoint.


3)If you still want to use busCfg as you do in smx3, you need  create a fragment bundle including the busCfg file, and attach it to cxf bundle(cxf bundle is a bundle containing all cxf related classes/resoures, especially the CxfBus init code in our case). This is the way to make busCfg file visible to cxf bundle with OSGi classloader mechanism. So we mentioned three bundles now, your own customer bundle(you create it), a fragment bundle including busCfg file(you create it), cxf bundle(cxf bundle is already in the container by default, it's not created yourself, it play the role as a host for the fragment bundle you created.)

Hope this helps.

Freeman

      was (Author: ffang):
    Hi,

For your questions

1) & 2)
You can use providedBus. For the providedBus, you needn't write a class to extend CxfBus, you only need a spring file to configure the cxf bus and pass it to providedBus, you need take a look at the commit with this jira. With providedBus, you can put all class/resources in your own customer bundle.

3)If you still want to use busCfg as you do in smx3, you need  create a fragment bundle including the busCfg file, and attach it to cxf bundle(cxf bundle is a bundle containing all cxf related classes/resoures, especially the CxfBus init code in our case). This is the way to make busCfg file visible to cxf bundle with OSGi classloader mechanism. So we mentioned three bundles now, your own customer bundle(you create it), a fragment bundle including busCfg file(you create it), cxf bundle(cxf bundle is already in the container by default, it's not created yourself, it play the role as a host for the fragment bundle you created.)

Hope this helps.

Freeman
  
> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61389#action_61389 ] 

Freeman Fang commented on SMXCOMP-688:
--------------------------------------

Hi,

What's the version you are using?
How you use the providedBus?
You may need take a look at the commit[1] to get ideas about the correct way to use providedBus.
[1]http://svn.apache.org/viewvc?rev=896758&view=rev

Freeman


> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Andrzej Kulakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61376#action_61376 ] 

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

I've been trying to accomplish the same thing (hoping it to be fixed), but to no avail it is not working still. Results seem to be exactly the same as prior.


> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Paul Mietz Egli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61548#action_61548 ] 

Paul Mietz Egli commented on SMXCOMP-688:
-----------------------------------------

I really think this discussion belongs on the mailing list, not in the comments for a closed bug.

> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61459#action_61459 ] 

Freeman Fang commented on SMXCOMP-688:
--------------------------------------

Hi,

For your questions

1) & 2)
You should use providedBus  as I mentioned if  you want to put all configuration files in your customer bundle. For the providedBus, you needn't write a class to extend CxfBus, you only need a spring file to configure the cxf bus and pass it to providedBus, you need take a look at the commit with this jira.

3)If you still want to use busCfg, also as I commented before, you need  create a fragment bundle including the busCfg file, and attach it to cxf bundle.

Freeman

> 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.


[jira] Updated: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Paul Mietz Egli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Mietz Egli updated SMXCOMP-688:
------------------------------------

    Attachment: smx4-bus-config.tar.gz

simple servicemix-cxf-bc bundle project that illustrates the issue.

> 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
>         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.


[jira] Assigned: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang reassigned SMXCOMP-688:
------------------------------------

    Assignee: Freeman Fang

> 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
>         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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Andrzej Kulakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61540#action_61540 ] 

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

Hello Freeman,
 I am relieved to inform you, that providedBus finally works :)
I have removed [1] from my beans.xml as instructed and also added these lines [2]. I have to admit that I didn't add [2] at first, because they struck me as unnecessary. Apparently, I was wrong. Those "magic" lines [2] are a pure sign of my lack of education about CXF yet, but also I should admit that such solution is not transparent and counter-intuitive mainly because those files do not exist on your system and therefore it's very easy to omit them to your own disadvantage :(

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

[2]   	<import resource="classpath:path_to_my_cxm.xml" />
  	<import resource="classpath:META-INF/cxf/cxf.xml" />
  	<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />


Your help on this matter is greatly 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.


[jira] Resolved: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang resolved SMXCOMP-688.
----------------------------------

       Resolution: Fixed
    Fix Version/s: servicemix-cxf-bc-2010.01

Patch applied
http://svn.apache.org/viewvc?rev=896758&view=rev

Also do the same thing for cxf bc consumer and tests working with providedBus

Thanks
Freeman

> 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.


[jira] Commented: (SMXCOMP-688) servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Posted by "Andrzej Kulakowski (JIRA)" <ji...@apache.org>.
    [ 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.