I am developing an application with Hibernate and I get an Exception when I connect with database. The exception is:
Unable to instantiate default tuplizer [
Check your Hibernate mapping file *.hbm.xml and check the class with which you are creating the getter and setter methods. Every property in the mapping file should exist as getters and setters in the populating class. Once you fix that the error is solved.
Also by reading the console, you can probably see the error mentioning a missing getter/setter.
Hope this helps you.
Add the following to your pom.xml
and take out the dependency from asm
jars from hibernate and add separate dependency to asm
in a separate section. I did the same and it worked in one shot.
<!-- Hibernate core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.7.ga</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
I had the same exception and I was excluding javassist
because of its issue with powermock
. Then I was adding it again as below but it was not working:
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.7.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
<scope>test</scope>
</dependency>
Finally I found out that I have to remove <scope>test</scope>
from javassist
dependency. Hope it helps someone.
In my case I had a isSomething()
boolean getter and got this error.
I resolved it by annotating the method with the JPA @Transient
annotation and find a confirmation in an answer to this SO question, so telling the provider not to persist the attribute.
For me this was resolved by adding an explicit default constructor
public MyClassName (){}
In my case has helped to exclude javax.transaction.jta dependency from hibernate:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.7.ga</version>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
</exclusions>
</dependency>