2

我是休眠新手,我正在尝试创建一个示例休眠搜索项目...当我尝试运行该项目时,出现以下异常:

Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
    at org.hibernate.bytecode.cglib.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:33)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:182)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:160)
    at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
    at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:269)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:425)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
    at de.laliluna.search.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:13)
    at de.laliluna.search.SearchTest.createSomeArticles(SearchTest.java:59)
    at de.laliluna.search.SearchTest.main(SearchTest.java:18)
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.CallbackFilter
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)

我用谷歌搜索,答案是包括 asm 和 cglib 库。我这样做了,但我仍然得到同样的例外。我应该怎么办?我正在使用 eclipse 来运行项目。

4

1 回答 1

3

您已经使用cglib-nodep-2.2.jar而不是cglib.jar在您的库中。

于 2012-01-07T12:54:51.827 回答