hibernate 报错
代码如下:第63行 (LoginDAO loginDAO = new LoginDAO();)
Login login = new Login();
login.setUsername("ad");
login.setPassword("12");
LoginDAO loginDAO = new LoginDAO();
Transaction tra = loginDAO.getSession().beginTransaction();
loginDAO.attachDirty(login);
tra.commit();
loginDAO.getSession().close();
return null;
如下报错:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: org/hibernate/criterion/Criterion
com.yourcompany.struts.action.LoginAction.execute(LoginAction.java:63)
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.ClassNotFoundException: org.hibernate.criterion.Criterion
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
com.yourcompany.struts.action.LoginAction.execute(LoginAction.java:63)
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
------解决方案--------------------
LoginDAO loginDAO = new LoginDAO();中的LoginDAO 是接口还是类?如果是接口,肯定不能new出来了..不然的话我想出来这里怎么会出错..
------解决方案--------------------
java.lang.ClassNotFoundException: org.hibernate.criterion.Criterion
没找到类 不是缺jar包就是有冲突
------解决方案--------------------
LoginDAO loginDAO = new LoginDAO();
这个不能直接new 接口的。帅哥。你要动态绑定实现它的实体类。而不是new 这个借口
应该是这样吧:LoginDAO loginDAO = new LoginDAOImpl();
------解决方案--------------------
org/hibernate/criterion/Criterion
没有这个类,少jar包了吧
------解决方案--------------------
详细解决方案
The server encountered an internal error () that prevented it from fulfilling this request.
热度:518 发布时间:2016-04-17 17:22:31.0
相关解决方案
- request.setAttribute("list" "''");该怎么解决
- myeclipse联接sql server 2008看不到用户表
- Server Tomcat v7.0 Server不能起步
- request.setAttribute("message" message)不能传int参数,该怎么处理
- java报错Syntax error on token "return" invalid Type解决方案
- RequestDispatcher rd = request.getRequestDispatcher跳转页面出现有关问题
- 在哪找的SQL Server 2005数据库驱动文件?为什么sql server2005安装盘上面没有找到
- The server encountered an internal error () that prevented it from fulfilling th解决方案
- request.setAttribute("message" message)不能传int参数,该怎么解决
- struts2的Action怎么返回指定路径的jsp或html,而不是返回SUCCESS、ERROR
- 'Update Progress' has encountered a problem An internal error has occurred解决方案
- 为何jsp request.getParameter取不到值,但request.getQueryString()却有值呢
- JSP向SQL数据库中写下数据时提示:Network error IOException: Connection refused: connect
- Error creating bean with name 'sessionFactory' defined in ServletContext resourc解决方法
- servlet+jquery1.4.2(ajax error?)解决方案
- Parse error in application web.xml,该如何解决
- 求老妪能解解释Response、Request
- java itext导出报Connection reset by peer: socket write error,该怎么处理
- Error reading resource: com/user/User.hbm.xml,该怎么解决
- request.setAttribute()有关问题
- JSP运行异常 STRUTS + SQL SERVER 2005
- jsp连接sql server 2005时出现的异常
- jsp连接sql server 2005数据库是异常!
- @Context HttpServletRequest request,@Context HttpServletResponse response,该如何解决
- fatal error; call to a member function query() on a non-object异常求回答啊 php+sqlite
- Error creating bean with name 'sessionFactory' defined in class path resource解决方法
- 大家帮帮忙呀The server encountered an internal error () that prevented it解决方法
- ASP上Set GetSession("conn")=server.CreateObject("adodb.connection")
- Server Apache Tomcat v6.0.35 at localhost failed to start
- JDBC 连接sql server 2005老是失败怎么处理?恳请高手帮忙。