struts2+hiberate3查询数据库语句时报java.lang.reflect.InvocationTargetException异常?

问题描述:用struts2+hiberate3查询数据库语句时报java.lang.reflect.InvocationTargetException异常?

 

hibernate查询语句截图如下:

 struts2+hiberate3查询数据库语句时报java.lang.reflect.InvocationTargetException异常?_第1张图片

 

报错页面如下:

 struts2+hiberate3查询数据库语句时报java.lang.reflect.InvocationTargetException异常?_第2张图片

 

原因:myeclipse插件自带的hibernate插件的核心包antlr-2.7.6.jarstruts2插件的核心包antlr-2.7.2.jar冲突所导致。

 struts2+hiberate3查询数据库语句时报java.lang.reflect.InvocationTargetException异常?_第3张图片

 

解决方法:打开window->preferences->MyEclipse->Project Capabilities->Struts2中的antlr-2.7.2.jar将它remove,此时再发布项目发现,问题还是存在,原因是刚刚已发布到tomcat,所以导致服务器已存在这个包,到tomcat找到该工程下的WEB-IF->lib找到antlr-2.7.2.jar将它删除,则完全解决上述问题。

Struts2核心包删除示意图如下:

 struts2+hiberate3查询数据库语句时报java.lang.reflect.InvocationTargetException异常?_第4张图片

你可能感兴趣的:(struts2.0,博客,java,hibernate,web)