-->
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: Problem Retrieving Hibernate SessionFactory from JNDI
PostPosted: Wed Sep 23, 2009 10:17 pm 
Newbie

Joined: Sat Nov 22, 2008 1:35 pm
Posts: 7
I am having a very peculiar problem retrieving a Hibernate SessionFactory from JNDI. I am using JBOSS 5.1.0, Hibernate 3.3.1, and Netbeans 6.7.1.

Following is the code that I use to attempt to retrieve the SessionFactory from JNDI: (The lookup method below returns a null value)

Code:
InitialContext ctx = new InitialContext();
_session_factory  = (SessionFactory) ctx.lookup("java:/hibernate/GGGoMobileSessionFactory");


From looking at the server logs, I can see the SessionFactory being created and bound to JNDI (see below).

Code:
SessionFactory successfully built and bound into JNDI [java:/hibernate/GGGoMobileSessionFactory]


If I use the JNDIView MBean to look at objects in JNDI, I clearly see the HibernateSessionFactory present in the JNDI. (see below)

Code:
java: Namespace
...

  +- hibernate (class: org.jnp.interfaces.NamingContext)
  |   +- GGGoMobileSessionFactory (class: org.hibernate.impl.SessionFactoryImpl)

...


Following are the contents of the gggomobile-hibernate.xml that is used to define the parameters of the Hibernate SessionFactory so it can automatically be started by JBOSS.
Code:
<hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0">
   <session-factory name="java:/hibernate/GGGoMobileSessionFactory" bean="jboss.gggomobile:name=GGGoMobileSessionFactory">
      <property name="datasourceName">java:/GGGoMobileDS</property>
      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      <depends>jboss:service=Naming</depends>
      <depends>jboss:service=TransactionManager</depends>
   </session-factory>
</hibernate-configuration>


Does anyone have an idea on this issue ? Very very very strange !!


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.