java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
root cause
第二段:
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
org.hibernate.hql.ast.HqlSqlWalker.generateNamedParameter(HqlSqlWalker.java:915)
org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4764)
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)
就这些,使用hibernate+struts2+jpa做的简单登录而已。
配置简单,可以在UserAction中得到页面的数据(用户名和密码),就是执行不了方法!
6 个解决方案
#1
jar包冲突的问题。我之前用MyEclipse自带的jar就出现过这问题。你看下你的项目中jar包。是不是有antlr.jar有多个。把低版本的删掉就行了。
#2
貌似系统添加的怎么移除出去?hibernate中有一个2.7.6,struts2中有2.7.2的
#3
呵呵,自己摸索了一下,不用移除包也可以了,关键是在使用什么方法去查询,
贴贴我出错的地方:
注释这里是出错的地方,我这里查询呢,使用了Criteria而不是Query方法,朋友们可以借鉴一下的哦!
贴贴我出错的地方:
public Users getUser(Users users) {
// TODO Auto-generated method stub
Session session=HibernateSessionFactory.getSession();
Criteria criteria=session.createCriteria(Users.class);
criteria.add(Restrictions.eq("uname", users.getUname()));
criteria.add(Restrictions.eq("upass", users.getUpass()));
if(criteria.list().size()>0){
System.out.println("yes");
return (Users)criteria.list().get(0);
}else{
System.out.println("no");
return null;
}
/*Query query=session.createQuery("from Users where uname=:name and upass=:pwd");
query.setParameter("name", users.getUname());
query.setParameter("pwd", users.getUpass());
if(query.list().size()>0){
System.out.println("yes");
return (Users)query.list().get(0);
}else{
System.out.println("no");
return null;
}*/
}
注释这里是出错的地方,我这里查询呢,使用了Criteria而不是Query方法,朋友们可以借鉴一下的哦!
#4
其实主要问题还是出在antlr.jar。这个包主要是做语法解析的,将hql转化成sql。你用Criteria肯定没问题。
#5
我也出现了这个问题,还不知道怎么解决呢!
#6
你最后咋解决的
#1
jar包冲突的问题。我之前用MyEclipse自带的jar就出现过这问题。你看下你的项目中jar包。是不是有antlr.jar有多个。把低版本的删掉就行了。
#2
貌似系统添加的怎么移除出去?hibernate中有一个2.7.6,struts2中有2.7.2的
#3
呵呵,自己摸索了一下,不用移除包也可以了,关键是在使用什么方法去查询,
贴贴我出错的地方:
注释这里是出错的地方,我这里查询呢,使用了Criteria而不是Query方法,朋友们可以借鉴一下的哦!
贴贴我出错的地方:
public Users getUser(Users users) {
// TODO Auto-generated method stub
Session session=HibernateSessionFactory.getSession();
Criteria criteria=session.createCriteria(Users.class);
criteria.add(Restrictions.eq("uname", users.getUname()));
criteria.add(Restrictions.eq("upass", users.getUpass()));
if(criteria.list().size()>0){
System.out.println("yes");
return (Users)criteria.list().get(0);
}else{
System.out.println("no");
return null;
}
/*Query query=session.createQuery("from Users where uname=:name and upass=:pwd");
query.setParameter("name", users.getUname());
query.setParameter("pwd", users.getUpass());
if(query.list().size()>0){
System.out.println("yes");
return (Users)query.list().get(0);
}else{
System.out.println("no");
return null;
}*/
}
注释这里是出错的地方,我这里查询呢,使用了Criteria而不是Query方法,朋友们可以借鉴一下的哦!
#4
其实主要问题还是出在antlr.jar。这个包主要是做语法解析的,将hql转化成sql。你用Criteria肯定没问题。
#5
我也出现了这个问题,还不知道怎么解决呢!
#6
你最后咋解决的