0 Replies Latest reply on Aug 9, 2005 8:57 AM by ads_green

    Jboss 4.0.1 and Hibernate - java.lang.StackOverFlow Error

    ads_green

      Hi,

      I'm trying to deploy a WAR web application that uses hibernate to connect to a DataSource configured in a Jboss 4.0.1 App server.

      However, evertime I start the application server it throws a java.lang.StackOverflow error when trying to build the Hibernate SessionFactory.

      Here is the datasource definition in the deploy directory

      <datasources>
       <local-tx-datasource>
       <jndi-name>comp/env/jdbc/DB1</jndi-name>
       <use-java-context>true</use-java-context>
       <connection-url>jdbc:mysql://localhost:3306/DB1?autoReconnect=true</connection-url>
       <driver-class>org.gjt.mm.mysql.Driver</driver-class>
       <user-name>root</user-name>
       <password>root</password>
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      The jboss web defining the JNDI references
      <jboss-web>
       <resource-ref>
       <res-ref-name>jdbc/DB1</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <jndi-name>java:/comp/env/jdbc/DB</jndi-name>
       </resource-ref>
      </jboss-web>
      


      The web.xml fragment defining the resource reference
      <resource-ref>
       <res-ref-name>jdbc/DB1</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      <resource-ref>
      


      The hibernate configuration is:
      <hibernate-configuration>
       <session-factory name="emp:/hibernate/SessionFactory">
       <property name="connection.datasource">java:comp/env/jdbc/DB1</property>
       <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      


      Finally, the class used to constuct the hibernate factory:
      URL configFileURL = HibernatePlugIn.class.getResource(configFile);
      Configuration configuration = (new Configuration()).configure(configFileURL);
      SessionFactory factory = configuration.buildSessionFactory();
      


      The java.lang.StackOverflow exception is thrown at the buildSessionFactory.

      Does anybody see any problems or have any examples of using hibernate with datasources in jboss without using the hibernate deployer?

      Thanks,

      Ads