[jboss-user] [Installation, Configuration & Deployment] - Problem Retrieving Hibernate SessionFactory from JNDI
cdub
do-not-reply at jboss.com
Wed Sep 23 22:15:45 EDT 2009
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)
| 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).
| 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)
| 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.
| <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 !!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256760#4256760
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256760
More information about the jboss-user
mailing list