1 Reply Latest reply on Mar 28, 2006 3:25 PM by davidchen

    problem to bind hibernate session factory to JNDI

    davidchen Newbie

      Hi, there:

      Searching the forum, it seems a quite old problem, but didn't get any clear answer yet. Using JBoss-4.0.3sp1, hibernate3.jar, following document, I deployed a test har into my default/deploy directory, and I got that very famous "Not binding factory to JNDI" log, and my client side code can not find the session factory.

      My jboss-service.xml is:

      <?xml version="1.0" encoding="UTF-8"?>
      <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.adminguide:name=ExampleSessionFactory">
      <attribute name="DatasourceName">java:/DefaultDS</attribute>
      <attribute name="Dialect">
      <attribute name="SessionFactoryName">

      And my har file doesn't include any lib jar files, only classes files and hbm.xml files. After deploying to jboss, I got logs like:
      INFO [org.hibernate.impl.SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
      INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
      INFO [org.hibernate.impl.SessionFactoryImpl] Checking 0 named queries
      INFO [org.jboss.hibernate.jmx.Hibernate] SessionFactory successfully built and bound into JNDI [java:/hibernate/ExampleSessionFactory]

      However, in my client code,

      throws NamingException: hibernate not bound

      Could any one please give me some hints or solutions?
      Hightly appreciated if any comments or suggestions.

      Thanks a lot in advance