Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting SessionFactory in hibernate-core-4.3.0.Beta5.jar
    primarykey
    data
    text
    <p>I am trying to initialize the SessionFactory using hibernate-core-4.3.0.Beta5.jar. But i am getting the java.lang.NullPointerException.</p> <p>Below is my code </p> <pre><code>public class HibernateUtil { private static final ServiceRegistry serviceRegistry; private static final SessionFactory sessionFactory; static { try { Configuration configuration = new Configuration().configure(); serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); sessionFactory = configuration.configure().buildSessionFactory(serviceRegistry); } catch(Exception ex){ System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void main(String args[]) { Session session = HibernateUtil.getSessionFactory().withOptions().openSession(); System.out.println(session.isConnected()); } </code></pre> <p>This is the exception </p> <pre><code>Initial SessionFactory creation failed.java.lang.NullPointerException java.lang.ExceptionInInitializerError at hibernate4.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:29) Caused by: java.lang.NullPointerException at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:92) at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:58) at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:68) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:265) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:99) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132) at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1881) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1839) at hibernate4.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:25) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload