当前位置: 代码迷 >> Java Web开发 >> struts1.3+JPA+spring2.5整合出现:java.lang.NoSuchMethodError(急),该如何处理
  详细解决方案

struts1.3+JPA+spring2.5整合出现:java.lang.NoSuchMethodError(急),该如何处理

热度:725   发布时间:2016-04-17 10:24:01.0
struts1.3+JPA+spring2.5整合出现:java.lang.NoSuchMethodError(急!!!)
代码:

@Controller("/control/product/type/list")
public class ProductTypeAction extends Action {
  @Resource(name="productTypeDAOBean")
private ProductTypeDAO productTypeDAO;
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ProductTypeForm formbean=(ProductTypeForm)form;
StringBuffer jpql=new StringBuffer("o.visiable=?1");
List<Object>params=new ArrayList<Object>();
params.add(true);
if("true".equals(formbean.getQuery())){
if(formbean.getName()!=null&&!"".equals(formbean.getName().trim())){
jpql.append(" o.name like ?"+(params.size()+1));
params.add("%"+formbean.getName()+"%");
}
}else{
if(formbean.getParentid()!=null&&formbean.getParentid()>0){
jpql.append(" and o.parent.typeid=?"+(params.size()+1));
params.add(formbean.getParentid());
}else{
jpql.append(" and o.parent is null");
}

}
PageView<ProductType> pageView=new PageView<ProductType>(5,formbean.getPage());

int firstindex=(pageView.getCurrentpage()-1)*pageView.getMaxresult();
LinkedHashMap<String,String> orderby=new LinkedHashMap<String, String>();
orderby.put("typeid", "desc");
QueryResult<ProductType> qr=productTypeDAO.getScrollData(ProductType.class, firstindex, 
pageView.getMaxresult(), jpql.toString(), params.toArray(), orderby);
pageView.setQueryResult(qr);
request.setAttribute("pageView", pageView);
return mapping.findForward("list");
}


}

出现的异常:

java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl/BitSet;)V
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:655)
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2586)
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2542)
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2413)
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2341)
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2296)
at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:2082)
at org.hibernate.hql.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1858)
at org.hibernate.hql.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:454)
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:708)
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:296)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:159)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:248)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
  相关解决方案