java.lang.NoSuchFieldError:sqlResultSetMappings

时间:2013-04-24 09:13:09

标签: java hibernate

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

我收到此错误而无法修复coz可能是因为缺乏对hibernate注释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)

我现在已添加了stacktrace。

2 个答案:

答案 0 :(得分:0)

假设您正在使用正确的Hibernate初始化代码,这个问题很可能是jar版本中的不一致。

虽然您已正确检测到原因,但我建议您在此处打印整个堆栈跟踪。您可以在堆栈跟踪中找到确切代码失败的位置(哪个类,方法等)。使用此信息按类名查找相关jar。 您可以将jarfinder用于此目的: Jarfinder

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

希望这有帮助

答案 1 :(得分:0)

您缺少字段中的某些字段

在此链接上查看“原生查询” http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html_single/