aspose file tools*
The moose likes Object Relational Mapping and the fly likes java.lang.NoSuchMethodError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "java.lang.NoSuchMethodError" Watch "java.lang.NoSuchMethodError" New topic
Author

java.lang.NoSuchMethodError

Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi
I have configured my Hibernate with the required files but wen i am trying to execute the Client program I am facing the below issue. I am using the cglib-2.2_beta1.jar file which looks like the latest jar.

Exception in thread "main" java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at org.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:308)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
at FirstHibernate.FirstExample.main(FirstExample.java:14)

My Client program is as follows :

regards
Prashanth
Abhi Vuyyuru
Greenhorn

Joined: Mar 10, 2005
Posts: 12
The class org.objectweb.asm.ClassWriter is in asm.jar file. Please check if the version it you have the correct version of the file.

Also, there was a similar problem with using cglib2.0, you may want to try switching to an older version instead of the beta.


Abhi Vuyyuru
Blog: http://java-x.blogspot.com
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi
I am using cglib-2.2_beta1.jar and asm-3.0_RC1 files which seems to be the latest jar files. But still I am facing the same issue.



regards
Prashanth
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
Hi
place asm.jar,asm-attrs.jar instead of asm-3.0.jar files.
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi
We have many versions of asm and asm-attrs I have tried placing some versions but still it does not work. Can you please let me know which version of jar needs to put.



regards
Prashanth
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
provide me your mail id.so that i can send you jar files
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi
Please send me the jar files to shanthchandra@gmail.com

Thanks in advance

regards
Prashanth
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
sent the jar files.Hope this will help you
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi
Thanks for the jar files you have sent me. But I am facing some more issues when I have put these jar files. Please find the error below.


Exception in thread "main" java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String V
at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java:77)
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:172)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at org.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:308)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
at FirstHibernate.FirstExample.main(FirstExample.java:14)


Thanks in advance
regards
Prashanth
Mahesh G P
Greenhorn

Joined: Apr 20, 2008
Posts: 7
This problem is resolved for me when i have changed from cglib jar 2.2 to 2.1.
Amol Wani
Greenhorn

Joined: Jul 26, 2010
Posts: 1
Please use "cglib-2.1.3.jar" and "asm-1.5.1.jar", you will not get this sort of exception.
Obed Vazquez
Greenhorn

Joined: Jan 26, 2012
Posts: 2
if you are using glassfish just delete the labrary asm
Aj Maven
Greenhorn

Joined: Jul 04, 2011
Posts: 22

Amol wani's suggestion worked perfectly, to solve this issue. Thanks a lot.


Thanks
-Aj
Sudheer Gollapudi
Greenhorn

Joined: Apr 20, 2010
Posts: 2
Amol Wani's reply worked perfectly without any issues.Thanks a lot
Sachin Telang
Greenhorn

Joined: Nov 02, 2007
Posts: 19
If still someone facing issue, please try cglib-nopep-2.1_3.jar instead of cglib-2.1_3.jar. So my combination is cglib-nopep-2.1_3.jar, hibernate-3.2.6.ga.jar and asm-1.5.3, I tried so many combinations on Websphere 8.5. And finally it worked.


Thanks<br />Sachin Telang<br />IBM Websphere Portal Application Developer Certified, Exam -399.
Sun Certified Java Programmer 1.5
 
Consider Paul's rocket mass heater.
 
subject: java.lang.NoSuchMethodError
 
Similar Threads
java.lang.IllegalAccessError
CGLib error in "Before Advice" case
ProxyFactory initialization error - Spring 1.2.1
Trouble to run a simple Hibernate /JPA CRUD sample
Can't connect to MySQL database with Hibernate