facebook

/hibernate.cfg.xml not found

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #236723 Reply

    jdsrinivas
    Member

    Hi There,

    My Application is unable to find the hibernate.cfg.xml file and throwing the following exception when i deployed my application in Websphere 5.1 AS.

    //

    [9/6/05 12:43:44:913 EDT] 416e479 Configuration I net.sf.hibernate.cfg.Configuration configuring from resource: /hibernate.cfg.xml
    [9/6/05 12:43:44:913 EDT] 416e479 Configuration I net.sf.hibernate.cfg.Configuration Configuration resource: /hibernate.cfg.xml
    [9/6/05 12:43:44:913 EDT] 416e479 Configuration W net.sf.hibernate.cfg.Configuration /hibernate.cfg.xml not found
    [9/6/05 12:43:44:929 EDT] 416e479 RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class java.lang.NullPointerException
    [9/6/05 12:43:44:929 EDT] 416e479 WebGroup E SRVE0026E: [Servlet Error]-[]: java.lang.NullPointerException
    at us.ny.state.otda.dcse.commons.persistence.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:59)
    at us.ny.state.otda.dcse.login.persistence.LoginPersister.getParentRole(LoginPersister.java:64)

    //

    It works fine when i ran it locally by using test case..

    Here is the code for currentSession method in my HibernateSessionFactory..

    
        public static Session currentSession() throws HibernateException {
            Session session = (Session) threadLocal.get();
    
            if (session == null) {
                if (sessionFactory == null) {
                    try {
                        System.out.println("1:");
                        cfg.configure(CONFIG_FILE_LOCATION);
                        System.out.println("2:");
                        sessionFactory = cfg.buildSessionFactory();
                        System.out.println("3:");
                    }
                    catch (Exception e) {
                        System.err.println("%%%% Error Creating SessionFactory %%%%");
                        e.printStackTrace();
                    }
                }
                session = sessionFactory.openSession();
                threadLocal.set(session);
            }
    
            return session;
        }
    

    Its printing 1: and generating error in my log file..Its not printing 2:

    My Co-worker is working on same application ..he doesn’t have any problem..

    Any Suggestion is Very Much Appreciated and thanks In Advance

    JD

    #236725 Reply

    jdsrinivas
    Member

    Exact problem is BOLD letters

    [9/6/05 12:43:44:913 EDT] 416e479 Configuration I net.sf.hibernate.cfg.Configuration configuring from resource: /hibernate.cfg.xml
    [9/6/05 12:43:44:913 EDT] 416e479 Configuration I net.sf.hibernate.cfg.Configuration Configuration resource: /hibernate.cfg.xml
    [9/6/05 12:43:44:913 EDT] 416e479 Configuration W net.sf.hibernate.cfg.Configuration /hibernate.cfg.xml not found
    [9/6/05 12:43:44:929 EDT] 416e479 RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class java.lang.NullPointerException
    [9/6/05 12:43:44:929 EDT] 416e479 WebGroup E SRVE0026E: [Servlet Error]-[]: java.lang.NullPointerException
    at us.ny.state.otda.dcse.commons.persistence.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:59)
    at us.ny.state.otda.dcse.login.persistence.LoginPersister.getParentRole(LoginPersister.java:64)

    #236726 Reply

    jdsrinivas
    Member

    Here is the code for declaration of CONFIG_FILE_LOCATION

    
    private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml"; 
    
Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: /hibernate.cfg.xml not found

You must be logged in to post in the forum log in