1 Reply Latest reply on Aug 8, 2005 9:14 AM by Alexandre Torres

    Jboss 3 to 4 and hibernate sars x har

    Alexandre Torres Newbie

      Hi.
      I upgraded my jboss from 3.x to 4 series and I got a problem with my hibernate sar. My application was deployed as an EAR with a SAR inside:

      app.ear
      --- app.sar
      ------(hbm.xml files)
      ------meta-inf
      ---------jboss-service.xml (referencing classpath to external jars)
      ---app.war(...)
      --- meta-inf (...)

      But something weird started to happen. The service is registered, the jboss log does not give any error, but when I try to lookup it just returns null. It does not return a not-found error... what is strange! I see that there is a more integrated way to do this with the har archive... but I found the wiki unclear on how to use it. I just don't TRUST it! can't make it work.
      is the sar deprecated for hibernate deployment? I really wanted to make my EAR JBOSS VERSION INDEPENDENT.
      my jboss-service is:

      <server>
       <classpath codebase='deploy/pettwo.ear/pettwo.war/WEB-INF/lib/' archives='*' />
       <classpath codebase='deploy/pettwo.ear/' archives='*' />
       <mbean code="org.hibernate.jmx.HibernateService" name="jboss.jca:service=pettwoHibernateSessionFactory">
       <depends>jboss.jca:service=RARDeployer</depends>
       <attribute name="MapResources">
      (...my files...)
      </attribute>
       <attribute name="JndiName">java:/hibernate/pettwoSessionFactory</attribute>
       <attribute name="Datasource">java:/jdbc/pettwo</attribute>
       <attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute>
       <attribute name="UserTransactionName">java:comp/UserTransaction</attribute>
       <attribute name="TransactionStrategy">org.hibernate.transaction.JTATransactionFactory</attribute>
       <attribute name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
       </mbean>
      </server>
      

      my java lookup code is:

       InitialContext ic = new InitialContext();
       SessionFactory _sessionFactory = (SessionFactory) ic.lookup("java:/hibernate/pettwoSessionFactory");
      


      the jboss log:

      2005-08-05 18:09:58,984 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
      2005-08-05 18:09:58,984 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: hibernate/pettwoSessionFactory
      2005-08-05 18:09:58,984 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=402880830588776801058877718c0000
      2005-08-05 18:09:58,984 WARN [org.hibernate.impl.SessionFactoryObjectFactory] Not found: 402880830588776801058877718c0000

      It worked fine on jboss 3x series.
      Thanks

        • 1. Re: Jboss 3 to 4 and hibernate sars x har
          Alexandre Torres Newbie

          I think I have solved the problem. My error was using the classpath to include apache's collection libraries.
          Well, removing the classpath and adding the missing jars directly in the jboss-hibernate depoyer solved my problem.
          The fact is that by using the classpath, each class were created by different classloaders. I ended with 2 active hibernate jars.
          I think that jboss should put the missing jars in the distribution... but I found in jira this issue, and I think it will be solved soon