Hi all :)
I'm having some issues getting Hibernate Annotations to work with my Vaadin project. I have the feeling it has something to do with my use of maven, as the error I get seems to come from the bytecode inserter used by Hibernate Annotations. If I try to setup my AnnotationConfiguration like this:
Code:
sessionFactory = new AnnotationConfiguration().configure(new File("c:\\projects\\hibernate.cfg.xml")).buildSessionFactory();
It gives me the following error:
Code:
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
at nl.bware.docSys.zeroFootprint.hibernate.HibernateUtil.getSessionFactory(HibernateUtil.java:23)
at nl.bware.docSys.zeroFootprint.ZeroFootprintApplication.closeSession(ZeroFootprintApplication.java:75)
at nl.bware.docSys.zeroFootprint.ZeroFootprintApplication.transactionEnd(ZeroFootprintApplication.java:52)
....etc
My pom.xml file looks like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.bware.docSys</groupId>
<artifactId>zeroFootprint</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>Zero Footprint</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hibernate-core-version>3.5.4-Final</hibernate-core-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- A simple Jetty test server at http://localhost:8080/zeroFootprint can be launched with the Maven goal jetty:run
and stopped with jetty:stop -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.24</version>
<configuration>
<stopPort>9966</stopPort>
<stopKey>zeroFootprint</stopKey>
<!-- Redeploy every x seconds if changes are detected, 0 for no automatic redeployment -->
<scanIntervalSeconds>0</scanIntervalSeconds>
<!-- make sure Jetty also finds the widgetset -->
<webAppConfig>
<contextPath>/zeroFootprint</contextPath>
<baseResource implementation="org.mortbay.resource.ResourceCollection">
<!-- Workaround for Maven/Jetty issue http://jira.codehaus.org/browse/JETTY-680 -->
<!-- <resources>src/main/webapp,${project.build.directory}/${project.build.finalName}</resources> -->
<resourcesAsCSV>
src/main/webapp,${project.build.directory}/<!--${project.build.finalName}--></resourcesAsCSV>
</baseResource>
</webAppConfig>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>nl.bware.commons</groupId>
<artifactId>commons</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-core-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>${hibernate-core-version}</version>
</dependency>
</dependencies>
</project>
Does anybody have a clue what's going on? More details can be provided on request, of course :)