java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter
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’.
Graceful!
Awesomeeeeee it really works!! Thanx a lot!!
Great it worked for me!
particularly the advice..
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.
So looked at the last cause by which said…
Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for person in class springapp.domain.Schooldetails
(but when the source file was checked the propery did exist!!! What’s going on here. I was using hibernate tools from jboss and thought may be there’s some sort of class caching going around and rebuilt the whole project and walla!.. it worked.)
Thanks for the solution. You saved my day.
Thanks, that’s it
[...] java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter [...]