0
Initial SessionFactory creation failed.java.lang.NoSuchFieldError: sqlResultSetMappings` <br/> 

我收到此错误并且无法修复,因为这可能是对休眠注释 jar 缺乏了解。

java.lang.NoSuchFieldError: sqlResultSetMappings
at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:166)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:254)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1036)
at com.util.HibernateUtil.<clinit>(HibernateUtil.java:16)
at com.view.OrderProcessingAction.<init>(OrderProcessingAction.java:84)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:123)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:154)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143)
at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:113)
at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:275)
at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)
at com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)

我现在添加了堆栈跟踪。

4

2 回答 2

0

您的字段中缺少一些字段

查看此链接http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html_single/上的“本机查询”

于 2014-10-10T21:54:06.103 回答
0

假设您使用的是正确的 Hibernate 初始化代码,则此问题可能是 jar 版本不一致。

尽管您已正确检测到原因,但我建议您在此处打印整个堆栈跟踪。您可以在堆栈跟踪中找到代码失败的确切位置(哪个类、方法等)。有了这些信息,可以通过类名找到相关的 jar。您可以为此目的使用 jarfinder: Jarfinder

这会让你知道哪个 jar 与你当前的 hibernate 配置不一致。

希望这可以帮助

于 2013-04-24T09:23:57.120 回答