| 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
 {
 
 }
 }
 }
 
 
 |  |