views:

33

answers:

2

Hello Everybody, I am using hibernate for a while now without any (bigger) problems. Now I am trying to work out RESTful Webservices with project jersey.

It seems that hibernate wich depends on ASM framework (asm.jar, asm-attrs.jar) and jersey which depends on ASM too (asm V3.1 as of asm-3.1.jar) are having problems with the asm implementation versions.

When using asm.jar, jersey is missing a method in org.objectweb.asm.ClassVisitor. When using asm-3.1.jar as of the jersey distribution, hibernate complains about missing class net.sf.cglib.proxy.Enhancer which is provided in cglib-2.1.3.jar.

Both Libraries are using cglib.jar. Thanks and Regards Niladri

A: 

I solved this "dependency problem" by switching from cglib to javassist in hibernate

hibernate.properties:
hibernate.bytecode.provider=javassist

and let jersey use cglib.

Maciek Kreft
A: 

I use Maven as build tool and I solved the problem by excluding out ASM and instead including "CGLIB No Dependency" dependency.

  <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>${hibernate.version}</version>
    <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>
  <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-nodep</artifactId>
    <version>${cglib.version}</version>
  </dependency>
imyousuf