You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Martijn Brinkers <ma...@gmail.com> on 2008/04/29 15:49:18 UTC

Exception after upgrade to CXF 2.1

Hi,

I upgraded to version 2.1 but now exceptions are being thrown at startup
which seem related to an incompatibility between asm.jar used by
Hibernate and asm.jar used by CXF: 

Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'usersWS': Invocation of init method failed; nested
exception is java.lang.NoSuchMethodError:
org.objectweb.asm.ClassWriter.visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V


This posting mentions similar problems

http://www.nabble.com/cxf-2.0.1-incubator---dependency-incompatibility-with-hibernate-td12141625.html#a12313341

Any idea how I can resolve this? should I upgrade asm.jar (ie. not use
the version provided by the Hibernate distriubution)?

Thanks,

Martijn Brinkers


Re: Exception after upgrade to CXF 2.1

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

Please log a bug for this.  (and a testcase would be great)

You MIGHT be able to workaround this by adding the XmlJavaTypeAdapter 
annotation for your set to the SEI method that returns the Set.   Not 
really sure though.

Dan


On Tuesday 29 April 2008, Martijn Brinkers wrote:
> Thanks,
>
> That fixed it. I do however have another problem related to ASM.
>
> One of the webservice methods returns a Set. This worked with previous
> CXF release but not with the current release because I get the
> following ClassCastException:
>
>  java.lang.ClassCastException: java.util.LinkedHashSet cannot be cast
> to java.util.List
>
> If I remove the asm jar from the classpath everything is working
> again. When I change the Set to a List it works with asm added to the
> cp.
>
> Any idea? is a Set not supported as a return type?
>
> Thanks,
>
> Martijn Brinkers
>
> On Tue, 2008-04-29 at 10:11 -0400, Daniel Kulp wrote:
> > The fix for this USUALLY is to configure hibernate to use the
> > cglib-nodeps jar and remove it's version of asm.  The cglib-nodeps
> > jar contains a "custom" version of asm 1.x that it needs, but in
> > it's own namespace so it won't conflict with the newer version
> > needed by CXF and other asm using tools.
> >
> > Dan



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: Exception after upgrade to CXF 2.1

Posted by Martijn Brinkers <ma...@gmail.com>.
Thanks,

That fixed it. I do however have another problem related to ASM.

One of the webservice methods returns a Set. This worked with previous
CXF release but not with the current release because I get the following
ClassCastException:

 java.lang.ClassCastException: java.util.LinkedHashSet cannot be cast to
java.util.List 

If I remove the asm jar from the classpath everything is working again.
When I change the Set to a List it works with asm added to the cp. 

Any idea? is a Set not supported as a return type?

Thanks,

Martijn Brinkers


On Tue, 2008-04-29 at 10:11 -0400, Daniel Kulp wrote:
> The fix for this USUALLY is to configure hibernate to use the 
> cglib-nodeps jar and remove it's version of asm.  The cglib-nodeps jar 
> contains a "custom" version of asm 1.x that it needs, but in it's own 
> namespace so it won't conflict with the newer version needed by CXF and 
> other asm using tools.
> 
> Dan



Re: Exception after upgrade to CXF 2.1

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Daniel Kulp wrote:
> The fix for this USUALLY is to configure hibernate to use the 
> cglib-nodeps jar and remove it's version of asm.  The cglib-nodeps jar 
> contains a "custom" version of asm 1.x that it needs, but in it's own 
> namespace so it won't conflict with the newer version needed by CXF and 
> other asm using tools.

Indeed, the ASM authors recommend bundling the ASM classes under a 
custom package name, rather than relying on an asm.jar, as the different 
versions of ASM are not compatible with one another.  Has CXF considered 
doing this or is there some issue with the licences that would prevent it?

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Exception after upgrade to CXF 2.1

Posted by Daniel Kulp <dk...@apache.org>.
The fix for this USUALLY is to configure hibernate to use the 
cglib-nodeps jar and remove it's version of asm.  The cglib-nodeps jar 
contains a "custom" version of asm 1.x that it needs, but in it's own 
namespace so it won't conflict with the newer version needed by CXF and 
other asm using tools.

Dan


On Tuesday 29 April 2008, Martijn Brinkers wrote:
> Hi,
>
> I upgraded to version 2.1 but now exceptions are being thrown at
> startup which seem related to an incompatibility between asm.jar used
> by Hibernate and asm.jar used by CXF:
>
> Exception in thread "main"
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'usersWS': Invocation of init method failed;
> nested exception is java.lang.NoSuchMethodError:
> org.objectweb.asm.ClassWriter.visit(IILjava/lang/String;Ljava/lang/Str
>ing;Ljava/lang/String;[Ljava/lang/String;)V
>
>
> This posting mentions similar problems
>
> http://www.nabble.com/cxf-2.0.1-incubator---dependency-incompatibility
>-with-hibernate-td12141625.html#a12313341
>
> Any idea how I can resolve this? should I upgrade asm.jar (ie. not use
> the version provided by the Hibernate distriubution)?
>
> Thanks,
>
> Martijn Brinkers



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog