1 Reply Latest reply on Sep 2, 2005 3:33 AM by happyfrog

    Trouble deploying Hibernate as a SAR

    jgisler

      Hibernate 3, Jboss 3.2.5

      I am deploying Hibernate as an MBean. I see Hibernate register itself in JBoss but when I try to get the SessionFactory by name, I get a NameNotFoundException.

      Has anyone else seen this? How did you resolve this? Hibernate works fine outside an MBean, FWIW.

      try {
       sessionFactory = (SessionFactory)ctx.lookup("java:comp/env/Hibernate/QSAdmin");
      }
      catch( NamingException e ) {
       logger.error( e.toString() );
       e.printStackTrace();
      }
      


      -- jboss-service.xml --
      <mbean code="org.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,name=HibernateFactory">
      
       <!-- Required services -->
       <depends>jboss.jca:service=RARDeployer</depends>
       <depends>jboss.jca:service=LocalTxCM,name=RIT-DMS</depends>
      
       <!-- Bind the Hibernate service to JNDI -->
       <attribute name="JndiName">java:comp/env/Hibernate/QSAdmin</attribute>
      
       <!-- Datasource settings -->
       <attribute name="Datasource">java:/RIT-DMS</attribute>
       <attribute name="Dialect">org.hibernate.dialect.Oracle9Dialect</attribute>
      
       <!-- Transaction integration -->
       <attribute name="TransactionStrategy">org.hibernate.transaction.JTATransactionFactory</attribute>
       <attribute name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
       <attribute name="FlushBeforeCompletionEnabled">true</attribute>
       <attribute name="AutoCloseSessionEnabled">true</attribute>
       <attribute name="UserTransactionName">UserTransaction</attribute>
      
       <!-- Fetching options -->
       <attribute name="MaximumFetchDepth">5</attribute>
      
       <!-- Second-level caching -->
       <attribute name="SecondLevelCacheEnabled">true</attribute>
       <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
       <attribute name="QueryCacheEnabled">true</attribute>
      
       <!-- Logging -->
       <attribute name="ShowSqlEnabled">false</attribute>
       <!-- <attribute name="ShowStatistics">true</attribute> -->
      
       <!-- Mapping files -->
       <attribute name="MapResources">
       com/blah/dms/model/Taccount.hbm.xml
       </attribute>
      </mbean>
      </server>