首页 > 代码库 > [转]基于S2SH框架的项目—antlr-2.7.2.jar包冲突问题
[转]基于S2SH框架的项目—antlr-2.7.2.jar包冲突问题
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)
org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)
org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)
org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)
org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1789)
org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
………………………………………………………………
当我们在搭建Struts2、Spring、Hibernate框架的时候。
遇到一个问题,工程发布后执行hibernate语句会报错:java.lang.NoSuchMethodError: antlr.collections.AST.getLine(),
以前已经听说过是个jar包冲突的问题,原来也算SSH整合时一个经典的bug(主要怪MyEclipse):
Struts自带的antlr-2.7.2.jar与Hibernate3.3自带的antlr-2.7.6.jar发生冲突,需要删除旧的jar包.虽然过程麻烦点不过总算搞好了,最后总结如下:
- 在MyEclipse的configuration\org.eclipse.osgi\bundles目录下搜索antlr-2.7.2.jar,删除所有antlr-2.7.2的jar包文件;在MyEclipse的Common\plugins目录中
- 搜索 *struts*.jar总共有3个jar包,用winRAR之类的软件将其打开,删除lib或者data下的antlr-2.7.2.jar文件。
[转]基于S2SH框架的项目—antlr-2.7.2.jar包冲突问题