Hi I am developping a small application using hibernate2 and I bumped into the exception that reads java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter
Here is the stacktrace:
INFO: connection properties: {user=root, password=manel}
16 mai 2011 16:03:27 net.sf.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
16 mai 2011 16:03:27 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup con开发者_运维知识库figured (in JTA environment, use of process level read-write cache is not recommended)
16 mai 2011 16:03:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
16 mai 2011 16:03:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): true
16 mai 2011 16:03:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
16 mai 2011 16:03:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
16 mai 2011 16:03:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
16 mai 2011 16:03:28 net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
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:215)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:236)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:791)
at hibernate.dao.SessionHibernate.rebuildSessionFactory(SessionHibernate.java:68)
at hibernate.dao.SessionHibernate.getSession(SessionHibernate.java:51)
at hibernate.dao.TimesheetDAO.addTimesheet(TimesheetDAO.java:74)
at TestHibernate.main(TestHibernate.java:14)
any help please
You need the correct version of asm jar on your classpath
you have some conflict with your lib. hibernate uses cglib-xxxx.jar and it uses asm-xxxx.jar. and there is possibility of having multiple version of these jar either in your project or the other libs you are using may also have some dependency on some other version, so it gets conflict with each other.
You need to remove your cglib-xxxx.jar and replace with cglib-nodep-xxxx.jar and use latest asm-xxxx.jar or just try by removing asm-xxxx.jar from your hibernate dependency, as cglib-nodep-xxx.jar will look for another latest asm-xxxx.jar in your project or webserver libs. You can find cglib-nodep lib from the link
http://sourceforge.net/projects/cglib/files/
精彩评论