java.lang.ClassNotFoundException:javax.persistence.NamedStoredProcedureQuery - 休眠错误 [英] java.lang.ClassNotFoundException: javax.persistence.NamedStoredProcedureQuery - Hibernate Error

查看:148
本文介绍了java.lang.ClassNotFoundException:javax.persistence.NamedStoredProcedureQuery - 休眠错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上面的异常在创建一个hibernate会话工厂时一直在抛出。





在应用程序库文件夹中有hibernate-jpa-2.1-api和javax.persistence.2.1.0。我可以在jar中看到NamedStoredProcedureQuery类。但是我得到了classnotfoundexception的运行时错误。任何建议?

解决方案

NamedStoredProcedureQuery类可用于hibernate-jpa-2.1-api jar。但是这个jar在运行时引用了其他jar。所以我没有在编译时遇到错误,并在运行时遇到异常。我只是通过maven repository添加了其他休眠库。最初我只使用hibernate-core。现在artifactID是hibernate-core,hibernate-validator,hibernate-commons-annotations,hibernate-jpa-2.0-api和hibernate-entitymanager。

Above exception has been throwing While creating a hibernate session factory.

In application lib folder have hibernate-jpa-2.1-api and javax.persistence.2.1.0. I can able to see the NamedStoredProcedureQuery class in both jar. But I am getting runtime error for classnotfoundexception. Any suggestion?

解决方案

NamedStoredProcedureQuery class is available in hibernate-jpa-2.1-api jar. But this jar refers some other jar in run time. So I didn't get error in compile time and getting exception during runtime. I just added other hibernated libs through maven repository.Initially i used only hibernate-core. Now artifactIDs are hibernate-core,hibernate-validator,hibernate-commons-annotations,hibernate-jpa-2.0-api and hibernate-entitymanager.

这篇关于java.lang.ClassNotFoundException:javax.persistence.NamedStoredProcedureQuery - 休眠错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆