Hibernate "PreInsertEvent.getSource ()" NoSuchMethodError

I get the following error when trying to make inserts:

java.lang.NoSuchMethodError: org.hibernate.event.PreInsertEvent.getSource () Lorg / hibernate / event / EventSource;

I saw other people with the same problem due to incompatibility in sleep mode bars, but I believe that everything is fine with me (according to the compatibility matrix )

Here is the relevant section from my pom.xml:

<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>3.3.0.ga</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.1.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>3.1.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.4.0.GA</version> </dependency> 

Can anyone advise?

Hello

Marty

+2
source share
3 answers

I found a solution, but I'm not sure if this is correct - is anyone better, please advise:

Added link to cglib and excluded hibernation exception (including 3.2)

  <dependencies> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.3</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>3.3.0.ga</version> <exclusions> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.1.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>3.1.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.3</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> </dependency> </dependencies> 
+4
source

This is a known bug: https://hibernate.onjira.com/browse/HVAL-81 . This happens when you reference an older version of the hibernate validator than the kernel.

+1
source

The actual problem for me when this error occurs is

  • The Hibernate-core dependency was not in my EAR package.

  • By default, he selected jboss.4.2.3 /.../ lib hibernate3.jar.

  • Just add hibernate-core-3.3.1.GA to the list of dependencies in the EAR packaging.

  • There was already an override of the bootloaders installed in jboss-app.xml.

  • The hibernate kernel from hibernateentitymanager-3.4.0.GA is excluded (do not think that this is necessary, since the main part will be 3.3.0.SP1 and will be omitted one way or another).

It worked with some exceptions from existing xml-apis, ejb3-persistence, etc. hibernate-core dependencies.

Finally, the main dependency looked like this.

  <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.1.GA</version> <exclusions> <exclusion> <artifactId>ejb3-persistence</artifactId> <groupId>org.hibernate</groupId> </exclusion> <exclusion> <artifactId>jta</artifactId> <groupId>javax.transaction</groupId> </exclusion> <exclusion> <artifactId>persistence-api</artifactId> <groupId>javax.persistence</groupId> </exclusion> <exclusion> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> </exclusion> </exclusions> </dependency> 

Note. I do not think cglib is required, this does not apply to this context.

Hope this is helpful to someone.

0
source

All Articles