-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Not able to create object of SessionFactory.
PostPosted: Wed Jan 25, 2006 1:29 am 
Newbie

Joined: Wed Jan 25, 2006 1:07 am
Posts: 1
I have encounterd a problem. In my first web application I am not able to create object of SessionFactory, The same application is running perfectly in my friend's computer. it gives me error as below.

java.lang.NoClassDefFoundError: org/dom4j/DocumentException
com.SaveEmpH.addEmployee(Unknown Source)
com.EmpInfoAction.execute(Unknown Source)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

here my SaveEmpH.java is as below



package com;

import java.util.*;
import org.hibernate.*;
import org.hibernate.cfg.Configuration;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.Session;

public class SaveEmpH {

public void addEmployee(Employee employee)
{
Session session1 = null;
SessionFactory sessionFactory;
try{
sessionFactory = new Configuration().configure().buildSessionFactory();
session1 = sessionFactory.openSession();
if(session1!=null){
session1.save(employee);
session1.flush();
session1.connection().commit();
System.out.println("Done");
session1.close();
}
}catch (MappingException e)
{
System.err.println("Mapping Exception" + e.getMessage());
throw new RuntimeException(e);
}
catch (HibernateException e)
{
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);
}

catch(Exception e){
System.out.println("vijay "+e.getMessage());
}
finally
{

}
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 4:04 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Add dom4j jar in to the buildpath.

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.