This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NoSuchMethodError

 
Prashanth Chandra
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Prashanth Chandra
Ranch Hand
Posts: 79
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
place asm.jar,asm-attrs.jar instead of asm-3.0.jar files.
 
Prashanth Chandra
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
provide me your mail id.so that i can send you jar files
 
Prashanth Chandra
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Please send me the jar files to shanthchandra@gmail.com

Thanks in advance

regards
Prashanth
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sent the jar files.Hope this will help you
 
Prashanth Chandra
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem is resolved for me when i have changed from cglib jar 2.2 to 2.1.
 
Amol Wani
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use "cglib-2.1.3.jar" and "asm-1.5.1.jar", you will not get this sort of exception.
 
Obed Vazquez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are using glassfish just delete the labrary asm
 
Aj Maven
Greenhorn
Posts: 22
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amol wani's suggestion worked perfectly, to solve this issue. Thanks a lot.
 
Sudheer Gollapudi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amol Wani's reply worked perfectly without any issues.Thanks a lot
 
Sachin Telang
Greenhorn
Posts: 19
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic