-->
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.  [ 3 posts ] 
Author Message
 Post subject: java.lang.ExceptionInInitializerError, SessionFactory
PostPosted: Fri Aug 02, 2013 11:33 pm 
Newbie

Joined: Fri Aug 02, 2013 11:27 pm
Posts: 1
I am using below code to get sessionFactory object but I am getting an exception. How can I solve this exception.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;

/**
* Hibernate Utility class with a convenient method to get Session Factory
* object.
*
* @author Mithun
*/
public class NewHibernateUtil {

private static final SessionFactory sessionFactory;

static {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
// config file.
sessionFactory =new AnnotationConfiguration().configure().buildSessionFactory();
//new Configuration().buildSessionFactory();

} catch (Throwable ex) {
// Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}

public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}


Top
 Profile  
 
 Post subject: Re: java.lang.ExceptionInInitializerError, SessionFactory
PostPosted: Mon Aug 05, 2013 4:48 am 
Newbie

Joined: Sun Jul 08, 2012 2:04 pm
Posts: 3
Can you share your stack trace of the exception.


Top
 Profile  
 
 Post subject: Re: java.lang.ExceptionInInitializerError, SessionFactory
PostPosted: Wed Aug 07, 2013 7:26 am 
Beginner
Beginner

Joined: Wed Feb 06, 2013 2:43 am
Posts: 46
Please share you stack trace and hibernate.cfg.xml file

As the file you have shared is used by every one and we can not get what error it could be.

_________________
Thanks,
Ajit Singh
ajits@mindfiresolutions.com
www.mindfiresolutions.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.