• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to create Hibernate Session from JSP....Could any experts help me on this !!!!

 
Praveen Ramachandran
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am facing a small issue with the HIbernate session creation again!!..
Description: I am having a jsp which takes two files and the business logic lies in a java file wich manipulates the uploaded files.So here i am introducing the Hibernate.
The jsp file is using the java class like this:
<jsp:useBean id="ppMbr" scope="page"
class="com.cambridge.internal.Coventry_PP_MBR">
<jsp:setProperty name="ppMbr" property="*" />
</jsp:useBean>

Here Coventry_PP_MBR.java is the file in which i am introducing hibernate..

the code snippet is as follows:

public class Coventry_PP_MBR {

ArrayList a=new ArrayList();
private File file = null;

StringBuffer duplicate1 = new StringBuffer();
StringBuffer duplicate2 = new StringBuffer();
StringBuffer duplicate3 = new StringBuffer();
List<String> b = new ArrayList<String>();
String Review_Vendor_Control= null;
int kk = 0;
int count= 0;
Session session = HiberUtil.getSession(); ==>> here the hiber sessison is called..

}

session factory class :HIberUtil.java

public class HiberUtil
{
private static SessionFactory sessionFactory;
private static Session session;
static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex){
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);}}
public static Session getSession()
{if(session==null)
{session=sessionFactory.openSession();}
return session;}

Result:
when i run this and upload the files i get this nasty exception :

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Same was happening with servlets too.I could'nt get a [proper solution and i am stuck half way.Could anybody out there help me on this.May be i am overlooking some jars or so?Thanks ..Please reply

Regards,
Praveen






 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic