3 Replies Latest reply on Jun 1, 2011 5:35 PM by takach

    Hibernate integration JbossAS 6.0.0

    flp05

      Hi, and congrats by this awesome community.

       

      I'm newbie in this area, and i'm starting to work with Jboss and Hibernate tecnologies. But, i'm having some dificulties.

       

      I´m trying to deploy a project to Jboss but it crashes because (i think) of the fact that Jboss brings hibernate libraries and i deploy the libraries again with a diferent version.

      What i want is just to deploy a simple project with hibernate. I want to work with the libraries but, in the end, don't deploy them.

      I'm using MyEclipse for developing, but to work with MyEclipse i need to use his libraries. So, when MyEclipse deploy the project (with hibernate jars), deploy fails.

       

       

      From this article:

      http://community.jboss.org/wiki/ClassLoadingConfiguration,

       

      i try to configure the class loader but i fall into the same error over again. So, i would like to have a little help.

       

       

       

      My jboss-web.xml:

       

      <?xml version='1.0' encoding='UTF-8'?>

      <jboss-web>

      <context-root>test</context-root>

      <class-loading java2ClassLoadingCompliance="false">

      <loader-repository>

      com.example:loader=test.war

      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>

      </loader-repository>

      </class-loading>

      </jboss-web>

       

       

      I put this file in my META-INF folder and "test" is the name of my project.

       

      What am i doing wrong?

       

      Thanks in advance.

        • 1. Re: Hibernate integration JbossAS 6.0.0
          peterj

          I don't use MyEclipse, so I can't help you with that. But here are some suggestions:

           

          a) Never use MyEclipse (or an other IDE) to build and deploy your app; instead use Ant or Maven. Then you will have more control over what is built (rather than having the IDE be too "helpful" and mess things up.)

           

          b) If I were doing this in Eclipse, I would install the JBoss Tools plugins. One of the Tools helps with Hibernate development. And since the Tools understand Jboss AS, they properly package apps thatuse Hibernate and thus avoid the situation you find yourself in. I don't know if Jboss Tools work in MyEclipse, but it would be worth a try.

           

          Both of the above suggestions prevent the Hibernate JARs from being packaged with the app, thus avoiding having to use a classloader repository.

          • 2. Re: Hibernate integration JbossAS 6.0.0
            flp05

            Thanks Peter

             

            Unfortunately, the choice of MyEclipse to IDE was not mine and is out of my control.

             

            MyEclipse has hibernate and Jboss integration , but don't prevent de jars from being deployed. I don't know why and don't make sense but...

             

            I solve the problem temporarily and i was able to deploy the project but i will take your advice and start to use Ant or Maven to deploy.

             

            Many thanks

            • 3. Re: Hibernate integration JbossAS 6.0.0
              takach

              For WAR Project use jboss-web.xml and put it into WEB-INF Folder. It will be not considered by JBoss if it is in META-INF.

               

              For EAR Project use jboss-app.xml and put it into META-INF Folder.