Joined: Sun Apr 06, 2014 8:05 am Posts: 1
|
public class UserDao{ @SuppressWarnings("deprecation") public static int register(User u){ int i=0;
//Session session=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory().openSession(); Configuration cfg=new Configuration(); cfg.configure("hibernate.cfg.xml");//populates the data of the configuration file //creating seession factory object
SessionFactory factory=cfg.buildSessionFactory(); //creating session object Session session=factory.openSession(); Transaction t=session.beginTransaction(); t.begin(); i=(Integer)session.save(u); t.commit(); session.close(); return i; } } I am calling this UserDao from jsp, that is not compiled error is giving in UserDao part type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 16 in the jsp file: /register.jsp The type org.hibernate.HibernateException cannot be resolved. It is indirectly referenced from required .class files 13: <body> 14: <% 15: 16: int i=com.javatpoint.UserDao.register(obj); 17: if(i>0) 18: out.print("You are successfully registered"); 19:
An error occurred at line: 16 in the jsp file: /register.jsp The method register(User) from the type UserDao refers to the missing type HibernateException 13: <body> 14: <% 15: 16: int i=com.javatpoint.UserDao.register(obj); 17: if(i>0) 18: out.print("You are successfully registered"); 19:
Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468) org.apache.jasper.compiler.Compiler.compile(Compiler.java:378) org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.50 logs.
I am using hibernate 4.1.2 is using
|
|