-->
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.  [ 1 post ] 
Author Message
 Post subject: [SessionFactoryObjectFactory] Not found:
PostPosted: Mon Jan 08, 2007 9:33 am 
Newbie

Joined: Fri Dec 22, 2006 2:32 pm
Posts: 16
Hello,

I am trying to set up a simple Hibernate (with annotations) project with JBoss and Maven 2.

I have put all my hibernate-classes inside a sub-project that is packaged up into a .HAR file and deployed in the main .EAR file. The structure of the .HAR file is:

Code:
bm-hibernate.har/META-INF/jboss-service.xml
bm-hibernate.har/META-INF/MANIFEST.MF
bm-hibernate.har/com.path.to/HibernateObject


I then have a HibernateUtil class that I use to get the Hibernate Session:

Code:
package ...;

import javax.naming.InitialContext;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
   private static SessionFactory sessionFactory;
   
   static {
      try {
         InitialContext ictx = new InitialContext();
         sessionFactory = (SessionFactory)ictx.lookup("java:/hibernate/SessionFactory");
         sessionFactory.openSession();
      } catch (Throwable ex) {
         System.out.println("EXCEPTION: " + ex);
         ex.printStackTrace();
         throw new ExceptionInInitializerError(ex);
      }
   }
   
   public static Session getSession() throws HibernateException {
      return sessionFactory.openSession();
   }

}


However, when I try to run sessionFactory.openSession I get the following error:

Code:
14:11:44,562 WARN  [SessionFactoryObjectFactory] Not found: 2c99e4e110019b42011001d5f1690008
14:11:44,563 INFO  [STDOUT] EXCEPTION: java.lang.NullPointerException
14:11:44,563 ERROR [STDERR] java.lang.NullPointerException
at com.path.to.source.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:22)



When the application is deployed to JBoss, it does state this though:

Code:
14:11:42,698 INFO  [Hibernate] SessionFactory successfully built and bound into JNDI [java:/hibernate/SessionFactory]


My jboss-service.xml file looks like this:

<server>
<mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
<attribute name="DatasourceName">java:/MyDataSourceDS</attribute>
<attribute name="Dialect">org.hibernate.dialect.OracleDialect</attribute>
<attribute name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
<attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
<attribute name="ShowSqlEnabled">true</attribute>
<attribute name="ScanForMappingsEnabled">true</attribute>
</mbean>
</server>


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

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.