users@jersey.java.net

Re: Jersey + Hibernate = NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Mon, 10 Dec 2007 11:20:35 -0500

Ultimately what worked was to use the cglib-nodep:

            <!--Explicitly add -->
            <dependency>
                <groupId>cglib</groupId>
                <artifactId>cglib-nodep</artifactId>
                <version>2.1_3</version>
            </dependency>

instead of cglib:

            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate</artifactId>
                <version>3.2.5.ga</version>
                <!--
                Explicitly remove:
                See:
http://blog.interface21.com/main/2007/06/11/asm-version-incompatibilities-using-spring-autowired-with-hibernate/
                -->
                <exclusions>
                        <exclusion>
                                <groupId>asm</groupId>
                                <artifactId>asm</artifactId>
                        </exclusion>
                        <exclusion>
                                <groupId>asm</groupId>
                                <artifactId>asm-attrs</artifactId>
                        </exclusion>
                        <exclusion>
                                <groupId>cglib</groupId>
                                <artifactId>cglib</artifactId>
                        </exclusion>
                </exclusions>
               
            </dependency>


Farrukh Najmi wrote:
>
> Perhaps Option 1 in link below would work:
>
> <http://blog.interface21.com/main/2007/06/11/asm-version-incompatibilities-using-spring-autowired-with-hibernate/>
>
>
> Trying it out now.
>
> Farrukh Najmi wrote:
>>
>> I ran into a version incompatibility in asm jar between jersey and
>> hibernate. Jersey uses more recent 3.0 version while Hibernate uses
>> older version 1.5.3:
>>
>> [DEBUG] org.hibernate:hibernate:jar:3.2.5.ga:compile (selected
>> for compile)
>> [DEBUG] net.sf.ehcache:ehcache:jar:1.2.3:compile (selected for
>> compile)
>> [DEBUG] commons-logging:commons-logging:jar:1.0.4:compile
>> (selected for compile)
>> [DEBUG]
>> commons-collections:commons-collections:jar:2.1:compile (selected for
>> compile)
>> [DEBUG] javax.transaction:jta:jar:1.0.1B:compile (selected for
>> compile)
>> [DEBUG] commons-logging:commons-logging:jar:1.0.4:compile
>> (selected for compile)
>> [DEBUG] asm:asm-attrs:jar:1.5.3:compile (selected for compile)
>> [DEBUG] dom4j:dom4j:jar:1.6.1:compile (selected for compile)
>> [DEBUG] antlr:antlr:jar:2.7.6:compile (selected for compile)
>> [DEBUG] cglib:cglib:jar:2.1_3:compile (selected for compile)
>> [DEBUG] asm:asm:jar:1.5.3:compile (selected for compile)
>> [DEBUG] asm:asm:jar:1.5.3:compile (selected for compile)
>>
>>
>> The result is the following:
>>
>> java.lang.NoSuchMethodError:
>> org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
>>
>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.analyzeClassFile(ResourceClassScanner.java:136)
>>
>>
>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.indexJar(ResourceClassScanner.java:118)
>>
>>
>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.indexDir(ResourceClassScanner.java:104)
>>
>>
>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.index(ResourceClassScanner.java:89)
>>
>>
>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.scan(ResourceClassScanner.java:80)
>>
>>
>> com.sun.ws.rest.api.core.DynamicResourceConfig.init(DynamicResourceConfig.java:69)
>>
>>
>> com.sun.ws.rest.api.core.DynamicResourceConfig.<init>(DynamicResourceConfig.java:58)
>>
>>
>> com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:163)
>>
>>
>> com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:99)
>>
>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
>>
>>
>> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
>>
>>
>> Has anyone run into this and do they have a solution?
>>
>
>


-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com