package org.zbq.action.type;
import java.util.Map;
import org.zbq.service.TypeService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class ListTypeAction extends ActionSupport {
private TypeService typeService;
public TypeService getTypeService() {
return typeService;
}
public void setTypeService(TypeService typeService) {
this.typeService = typeService;
}
@SuppressWarnings("unchecked")
@Override
public String execute() throws Exception {
Map request=(Map) ActionContext.getContext().get("request");
request.put("list",this.typeService.findAllType());
return SUCCESS;
}
}
打开网页链接报错
HTTP Status 500 – Internal Server Error
Type Exception Report
Message Method "execute" failed for object org.zbq.action.type.ListTypeAction@968db5d
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
ognl.MethodFailedException: Method "execute" failed for object org.zbq.action.type.ListTypeAction@968db5d [java.lang.NoSuchMethodError: org.hibernate.Session.createQuery(Ljava/lang/String;)Lorg/hibernate/Query;]
ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1311)
ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)
com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108)
ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1375)
ognl.ASTMethod.getValueBody(ASTMethod.java:91)
ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
ognl.SimpleNode.getValue(SimpleNode.java:258)
ognl.Ognl.getValue(Ognl.java:470)
ognl.Ognl.getValue(Ognl.java:434)
com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:398)
com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:450)
com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:396
java.lang.NoSuchMethodError: org.hibernate.Session.createQuery 调用的方法不存在?