gpt4 book ai didi

java - Hibernate:如何解决 java.lang.IncompatibleClassChangeError:

转载 作者:行者123 更新时间:2023-11-29 05:17:04 25 4
gpt4 key购买 nike

这是我第一次Hibernate实践,出现了如下错误

 java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter

我将jar文件添加到项目库中,但错误仍然存​​在。我正在使用 Eclipse。

我该如何解决这个问题,这与我的代码有关吗?或者关于 Eclipse 中的设置?

这是我的 hibernate 示例

This is my hibernate example

hibernate configuration

错误

Caused by: 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:1218)
at com.hib.anoop.ManageEmployee.main(ManageEmployee.java:20)
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.CallbackFilter
at java.net.URLClassLoader$1.run(Unknown Source)
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)
... 13 more

我已经添加了正确的jar,问题解决了,但是出现了新的问题如下

Caused by: java.lang.IncompatibleClassChangeError: class net.sf.cglib.core.DebuggingClassWriter has interface org.objectweb.asm.ClassVisitor as super class

我该如何解决这个问题?

最佳答案

问题已解决,问题与jar文件cglibasm的版本有关。

现在,我将 jar 替换为 cglib 2.2.2asm 3.3.1

现在,Mismatch 已经解决并得到输出。

关于java - Hibernate:如何解决 java.lang.IncompatibleClassChangeError:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26173802/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com