Using Jersey (the Java REST framework) in conjunction with Hibernate requires some tweaking of Maven's pom.xml file. The issue is that Hibernate uses ASM 1.5.3
which is incompatible with ASM 3.1
used by Jersey.
What you need to do is exclude some transitive dependencies from Hibernate:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</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>
Then, you need to include the correct version of ASM:
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
</dependency>
Finally, you need to include a nodep version of the CGLib which repackages classes from ASM version 1.5.3:
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
source: http://blog.idm.fr/2009/04/jersey-hibernate-conflict.html