1 Reply Latest reply on Jan 12, 2008 7:20 AM by megha likhar

    Unable to connect Hibernate thru JNDI (javax.naming.NameNotF

    Tulsi Rai Newbie

      Hello Folks,
      I am trying to use Hibernate 3 with JBoss4.0.4. I have the followings:

       j2eeRnD
       - com.bizObj
       - CarBean.java
       - CarBean.hbm.xml
       - META-INF
       - jboss-app.xml
       - hibernate-service.xml
       - WEB-INF
       - web.xml
       - jboss-web.xml
      
      
      (content of jboss-app.xml)
      
      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
      <jboss-app>
       <module>
       <service>hibernate-service.xml</service>
       </module>
      </jboss-app>
      
      (content of hibernate-service.xml)
      <server>
       <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.bizObj:j2eeRnD=Hibernate">
       <attribute name="DataSourceName">java:/SessionFactory</attribute>
       <attribute name="Dialiect">org.hibernate.dialect.Oracle9Dialect</attribute>
       <attribute name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
       <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
       <attribute name="Hbm2ddlAuto">create-drop</attribute>
       <attribute name="ShowSqlEnabled">true</attribute>
       <attribute name="ScanForMappingsEnabled">true</attribute>
       </mbean>
      </server>
      
      Couple of things that I am not sure about here in this file is "name="jboss.bizObj:j2eeRnD=Hibernate" - i am not sure about my bizObj:j2eeRnD - I am not even sure why I have this here - more than that I am not sure What value should be there?
      
      JNDI Lookup
      ========
      Context ctx = new InitialContext();
      SessionFactory sessionFactory = (SessionFactory)ctx.lookup("java:/hibernate/SessionFactory");
      
      this is where the exception is thrown.
      


      Please help me with this configuration. Thanks.