6 Replies Latest reply on Nov 14, 2011 3:21 AM by nuki

    EAR packaging and deployment issue HibernateProxy not found

    nuki Newbie

      Hi,

       

      I currently try to work with the new JBoss AS7. I am able to deploy my application and it works fine. But during the deployment i get some errors:

      23:56:17,105 ERROR [org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer] (MSC service thread 1-3) HHH00142:Javassist Enhancement failed: de.schweigerconsulting.ejb3.user.User: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy

      After a lot of documentation reading I know that the problem has something to do with my ear packaging and the place of my persistence.xml file:

       

      myApp.ear

      |_ META-INF

      |_ EJB-User-Library.jar (Module created for using in different ears)

      |_ EJB-Article-Library.jar (Module created for using in different ears)

      |_ EJB-News-Library.jar (Module created for using in different ears)

      |_ lib/

          |_ Persistence.jar

              |_ persistence.xml

       

      If I put the persistence.xml into the EJB-*-Library.jars everything works fine. But my goal is to use these jars in multiple projects, so I am not able to define the persistence-unit there. I want to define one persistence unit in a dedicated jar (like my persistence.jar) which will be used by all libraries.

       

      Is there any solution?

        • 1. Re: EAR packaging and deployment issue HibernateProxy not found
          Scott Marlow Master

          Try the nightly AS7 build from this link community.jboss.org/thread/167590, that might be of some help.

           

          Also, is the persistence.xml in  Persistence.jar/META-INF?  In your diagram, it looks like its in the root of the Persistence.jar.  I think you want the following instead:

           

           

          myApp.ear

          |_ META-INF

          |_ EJB-User-Library.jar (Module created for using in different ears)

          |_ EJB-Article-Library.jar (Module created for using in different ears)

          |_ EJB-News-Library.jar (Module created for using in different ears)

          |_ lib/

              |_ Persistence.jar

                  |_META-INF

                      |_ persistence.xml

          • 2. Re: EAR packaging and deployment issue HibernateProxy not found
            nuki Newbie

            Hi Scott,

             

            thanks for your reploy. Your structure diagramm is correct. The persistence.xml is in the Persistence.jar/META-INF folder. It was late last night here in Germany :-)

             

            Is it possible, that my failure is in the application.xml?

             

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

            <!DOCTYPE application PUBLIC

                "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"

                "http://java.sun.com/dtd/application_1_3.dtd">

            <application>

              <display-name>My Ear Name displayed in the App Server</display-name>

              <module>

                <web>

                  <web-uri>struts2-sandbox.war</web-uri>

                  <context-root>/ear-sandbox</context-root>

                </web>

              </module>

              <module>

                <ejb>ejb3-user.jar</ejb>

              </module>

              <module>

                <ejb>ejb3-article.jar</ejb>

              </module>

              <module>

                <ejb>ejb3-news.jar</ejb>

              </module>

              <library-directory>lib</library-directory>

            </application>

             

            PS: I can't download the nightly build from your link, cause of 503 error.

             

            kind regards

            • 4. Re: EAR packaging and deployment issue HibernateProxy not found
              nuki Newbie

              I tried to put the persistence.xml into the META-INF folder of the ear file:

               

              myApp.ear

              |_ META-INF

                 |_ persistence.xml

              |_ EJB-User-Library.jar (Module created for using in different ears)

              |_ EJB-Article-Library.jar (Module created for using in different ears)

              |_ EJB-News-Library.jar (Module created for using in different ears)

               

              Database operations work fine, but JBoss AS7 still give me the error message HHH00142: Javassist Enhancement failed: ejb3.user.User

               

              kind regards   

              • 5. Re: EAR packaging and deployment issue HibernateProxy not found
                Scott Marlow Master

                Having several EARs depend on a single persistence deployment isn't something you can do currently on AS7.  If this is important, please vote for the jira referenced in the above forum post you just mentioned.  It sounds like you are trying to do something a little different than that (since each EAR will have its own persistence.xml).  I'd like to see the full exception call stack, if you could attach the as7/standalone/logs/server.log with the error (or just the part with the error).  I'll take a look.

                 

                Also let me know if you are packaging a copy of any Hibernate jars in the ear.

                 

                The nightly builds link should be available now (I just tried accessing the site).  I don't think that will make a difference but its worth trying that too.

                • 6. Re: EAR packaging and deployment issue HibernateProxy not found
                  nuki Newbie

                  Good morning Scott,

                   

                  thanks for your reply.

                   

                  I don't use any packaged Hibernate jars in my projects, so my applications are able to use the Hibernate 4.0.0 RC2 jars from the Jboss directly.

                   

                  Yesterday I solved the problem by changing my EAR structure:

                   

                  myApp.ear

                  |_ META-INF

                  |_ EJB-User-Library.jar (Module created for using in different ears, only beans - no entities)

                  |_ EJB-Article-Library.jar (Module created for using in different ears, only beans - no entities)

                  |_ EJB-News-Library.jar (Module created for using in different ears, only beans - no entities)

                  |_ lib/

                      |_ Entity-User-Library.jar (Module created for using in different ears, only entities)

                      |_ Entity-Article-Library.jar (Module created for using in different ears,only entities)

                      |_ Entity-News-Library.jar (Module created for using in different ears, only entities)

                      |_ Persistence.jar

                          |_META-INF

                              |_ persistence.xml

                   

                  The problem was, that the persistence.jar was not able to find my entities which were in the EJB-*-Library.jars on the root of the EAR.

                   

                  kind regards!