You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Freeman Fang (JIRA)" <ji...@apache.org> on 2013/06/07 09:20:20 UTC

[jira] [Comment Edited] (CXF-5059) Refine classloader in org.apache.cxf.wsdl11.WSDLManagerImpl

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

Freeman Fang edited comment on CXF-5059 at 6/7/13 7:19 AM:
-----------------------------------------------------------

@Dan,
Thanks for the input, I will revise per your suggestion to use bus.getExtension(ClassLoader.class) for now.

@Bin,
Without fix for this issue, in your customer bundle, you can implements your own WSDLExtensionLoader and then put that bean in the bus-extensions.txt in your bundle, you can take a look at how it is implemented similarly in cxf jms transport bundle, the JMSWSDLExtensionLoader[1] which can register jms related wsdl extensions, and the bus-extensions.txt[2] which could be loaded automatically by bus. And this is the recommended way in OSGi container and would work with any future CXF releases.
[1]https://svn.apache.org/repos/asf/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
[2]https://svn.apache.org/repos/asf/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/bus-extensions.txt

Freeman
                
      was (Author: ffang):
    @Dan,
Thanks for the input, I will revise per your suggestion to use bus.getExtension(ClassLoader.class) for now.

@Bin,
Without fix for this issue, in your customer bundle, you can implements your own WSDLExtensionLoader and then put that bean in the bus-extensions.txt in your bundle, you can take a look at how it is implemented similarly in cxf jms transport bundle, the JMSWSDLExtensionLoader[1] which can register jms related wsdl extensions, and the bus-extensions.txt[2] which could be loaded automatically by bus
[1]https://svn.apache.org/repos/asf/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
[2]https://svn.apache.org/repos/asf/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/bus-extensions.txt

Freeman
                  
> Refine classloader in org.apache.cxf.wsdl11.WSDLManagerImpl
> -----------------------------------------------------------
>
>                 Key: CXF-5059
>                 URL: https://issues.apache.org/jira/browse/CXF-5059
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.6.2, 2.6.8
>            Reporter: Bin Zhu
>            Assignee: Freeman Fang
>             Fix For: 2.5.11, 2.6.9, 2.7.6, 3.0.0
>
>         Attachments: CXF-5059.patch
>
>
> I was packaging the CXF jars(e.g.cxf-rt-core-2.6.2.jar ) into a OSGi bundle then use it to create web service. In my scenario, it is found that if there are respect binding resources defined in the .war/META-INF/extensions.xml, it will not be properly loaded and will caused the "Unknown wsdl binding extension" error.
> After investigation, it's found that in the org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialXmlExtensions()method, the classloader is got by the following line:
>              initialExtensions = PropertiesLoaderUtils.loadAllProperties(resource, 
> -                  this.getClass().getClassLoader());
> And caused the classes defined in .war/META-INF/extensions.xml was not correctly loaded.
> I checked the similar scenario in org.apache.cxf.catalog.OASISCatalogManager.loadContextCatalogs and found it get classload like this:
> loadCatalogs(Thread.currentThread().getContextClassLoader(), name);
> So I tried to refine the classloader in WSDLManagerImpl like this and now it works in my test. Could someone help review this patch? Thanks in advance.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira