Spring framework3.1整合hibernate4.1报错:

来源:互联网 发布:日本体育课运动服 淘宝 编辑:程序博客网 时间:2024/06/12 18:14
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd

           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

Spring 头 要配对xmlns:tx  中引入xsi:schemaLocation中写入http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd

java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I 

当在几种框架集成的时候,在调用HibernateDaoSupport中的某个方法时会出现:

java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I 的错误。这是因为在struts2自带的antlr-2.7.2.jar包的版本较低。

需要换成antlr-2.7.6.jar。其实在项目中已经存在了antlr-2.7.6.jar这个包,现在唯一需要做的就是删除antlr-2.7.2.jar包。

选择windows---preferences---在文本框中搜索struts 2(中间有空格)---选择struts 2---选择antlr-2.7.2.jar---Remove---OK。

0 0
原创粉丝点击