You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alexandros Karypidis <ak...@yahoo.gr> on 2010/02/20 18:43:30 UTC

CXFServlet, extensions and classloader issues

Hi,

When CXF loads, from what I understand, it scas that classpath for 
extensions. Is there a way to control extension loading?

The reason I want to do this is because I want to use CXF 2.2.6 in the 
Geronimo 2.2 app server. Geronimo already includes CXF 2.1.4. Therefore, 
in a geronimo-specific deployment descriptor (geronimo-web.xml) I "hide" 
the geronimo-bundled CXF so that the one from WEB-INF/lib is used. This 
is done by specifying the following in geronimo-web.xml:

<sys:hidden-classes>
<sys:filter>org.springframework</sys:filter>
<sys:filter>org.apache.cxf</sys:filter>
</sys:hidden-classes>

Unfortunalely, there's a geronimo extension to CXF (see 
http://repo2.maven.org/maven2/org/apache/geronimo/modules/geronimo-cxf/2.2/geronimo-cxf-2.2.pom) 
that gets detected (via the META-INF/cxf/cxf-extension-geronimo.xml) and 
CXF tries to load it. Ultimately this ends up in invoking code loaded 
from Geronimo's class loader that is linked against Geronimo's CXF 
(2.1.4) and causes class definition mismatches (see stacck trace at end 
of this e-mail).

So, is there a way to tell CXF to ignore a specific extension while 
scanning its classpath?

Here's the stack trace I get:

--------------------------------------------------------------------------------- 

2010-02-20 19:08:05,050 WARN  [SpringBusFactory] Initial attempt to 
crate application context was unsuccessful.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'org.apache.cxf.resource.ResourceManager' 
defined in class path resource 
[META-INF/cxf/cxf-extension-geronimo.xml]: Unsatisfied dependency 
expressed through constructor argument with index 0 of type 
[java.util.List]: Could not convert constructor argument value of type 
[java.util.ArrayList] to required type [java.util.List]: Failed to 
convert value of type [java.util.ArrayList] to required type 
[java.util.List]; nested exception is 
java.lang.IllegalArgumentException: Cannot convert value of type 
[org.apache.cxf.resource.ClasspathResolver] to required type 
[org.apache.cxf.resource.ResourceResolver]: no matching editors or 
conversion strategy found
...
Caused by: 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'org.apache.cxf.resource.ResourceManager' 
defined in class path resource 
[META-INF/cxf/cxf-extension-geronimo.xml]: Unsatisfied dependency 
expressed through constructor argument with index 0 of type 
[java.util.List]: Could not convert constructor argument value of type 
[java.util.ArrayList] to required type [java.util.List]: Failed to 
convert value of type [java.util.ArrayList] to required type 
[java.util.List]; nested exception is 
java.lang.IllegalArgumentException: Cannot convert value of type 
[org.apache.cxf.resource.ClasspathResolver] to required type 
[org.apache.cxf.resource.ResourceResolver]: no matching editors or 
conversion strategy found
     at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:565) 

....
--------------------------------------------------------------------------------- 



Re: CXFServlet, extensions and classloader issues

Posted by Daniel Kulp <dk...@apache.org>.

You may be able to try adding a filter of META-INF.cxf or something to filter 
out that stuff as well.   I'm really not sure if that works or not.

In general, the best option in this case would be to create your own Sprint 
context definition that imports the things from CXF that you need directly 
which would avoid the scan entirely.

Dan



On Sat February 20 2010 12:43:30 pm Alexandros Karypidis wrote:
> Hi,
> 
> When CXF loads, from what I understand, it scas that classpath for
> extensions. Is there a way to control extension loading?
> 
> The reason I want to do this is because I want to use CXF 2.2.6 in the
> Geronimo 2.2 app server. Geronimo already includes CXF 2.1.4. Therefore,
> in a geronimo-specific deployment descriptor (geronimo-web.xml) I "hide"
> the geronimo-bundled CXF so that the one from WEB-INF/lib is used. This
> is done by specifying the following in geronimo-web.xml:
> 
> <sys:hidden-classes>
> <sys:filter>org.springframework</sys:filter>
> <sys:filter>org.apache.cxf</sys:filter>
> </sys:hidden-classes>
> 
> Unfortunalely, there's a geronimo extension to CXF (see
> http://repo2.maven.org/maven2/org/apache/geronimo/modules/geronimo-cxf/2.2/
> geronimo-cxf-2.2.pom) that gets detected (via the
> META-INF/cxf/cxf-extension-geronimo.xml) and CXF tries to load it.
> Ultimately this ends up in invoking code loaded from Geronimo's class
> loader that is linked against Geronimo's CXF (2.1.4) and causes class
> definition mismatches (see stacck trace at end of this e-mail).
> 
> So, is there a way to tell CXF to ignore a specific extension while
> scanning its classpath?
> 
> Here's the stack trace I get:
> 
> ---------------------------------------------------------------------------
> ------
> 
> 2010-02-20 19:08:05,050 WARN  [SpringBusFactory] Initial attempt to
> crate application context was unsuccessful.
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
> creating bean with name 'org.apache.cxf.resource.ResourceManager'
> defined in class path resource
> [META-INF/cxf/cxf-extension-geronimo.xml]: Unsatisfied dependency
> expressed through constructor argument with index 0 of type
> [java.util.List]: Could not convert constructor argument value of type
> [java.util.ArrayList] to required type [java.util.List]: Failed to
> convert value of type [java.util.ArrayList] to required type
> [java.util.List]; nested exception is
> java.lang.IllegalArgumentException: Cannot convert value of type
> [org.apache.cxf.resource.ClasspathResolver] to required type
> [org.apache.cxf.resource.ResourceResolver]: no matching editors or
> conversion strategy found
> ...
> Caused by:
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
> creating bean with name 'org.apache.cxf.resource.ResourceManager'
> defined in class path resource
> [META-INF/cxf/cxf-extension-geronimo.xml]: Unsatisfied dependency
> expressed through constructor argument with index 0 of type
> [java.util.List]: Could not convert constructor argument value of type
> [java.util.ArrayList] to required type [java.util.List]: Failed to
> convert value of type [java.util.ArrayList] to required type
> [java.util.List]; nested exception is
> java.lang.IllegalArgumentException: Cannot convert value of type
> [org.apache.cxf.resource.ClasspathResolver] to required type
> [org.apache.cxf.resource.ResourceResolver]: no matching editors or
> conversion strategy found
>      at
> org.springframework.beans.factory.support.ConstructorResolver.createArgumen
> tArray(ConstructorResolver.java:565)
> 
> ....
> ---------------------------------------------------------------------------
> ------

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog