Problem

In Hibernate development, it’s common to hits the following error message.

SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'sessionFactory' defined in ServletContext resource 
[/WEB-INF/classes/config/database/spring/HibernateSessionFactory.xml]: 
Invocation of init method failed; nested exception is 
 
Caused by: org.hibernate.HibernateException: 
Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
	...
	...
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	...
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
	at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
	...

Solution

The “Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer” is a generic error message, it may caused by many reasons. So, you have to look at the last line that caused the error.

Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter

The main cause is the old asm.jar library e.g ‘asm-1.5.3.jar’, just upgrade the asm library to the most recent version will get rid of the error message. e.g, ‘asm-3.1.jar’.

Reference

  1. ASM library offcial website
Tags :
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider making a donation to the charity, thanks.

Related Posts

Popular Posts