1 2 Previous Next 24 Replies Latest reply on Aug 18, 2008 8:37 AM by jinpsu Go to original post
      • 15. Re: Upgrading hibernate in JBoss 4.2.2.GA

        Thanks.

        hibernate-commons-annotations.jar: 3.0.0.GA

        • 16. Re: Upgrading hibernate in JBoss 4.2.2.GA

          Hmm, when I build the ear via ant, the exception is different than the one I previously posted which was built from eclipse. I guess the difference is that no hibernate jars are in the classpath when building with ant (I have no direct compile dependencies).

          Caused by: java.lang.NullPointerException
           at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)
           at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
           at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
           at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
           at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
           at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
           at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
           at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
           at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
           ... 61 more
          


          p.s. You are correct in assuming my war does not include any hibernate jars. They are only in the lib directory of the ear.

          justin.

          • 17. Re: Upgrading hibernate in JBoss 4.2.2.GA
            jaikiran

             

            "jinpsu" wrote:
            Hmm, when I build the ear via ant, the exception is different than the one I previously posted which was built from eclipse.


            Let's stick to the ear generated through Ant, henceforth. That is much more reliable than the one generated by Eclipse.


            "jinpsu" wrote:

            Caused by: java.lang.NullPointerException
             at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)
            




            This looks like an issue with your entity mappings. Probably something wrong with one of your @OneToOne mapping. Based on what i see in a hibernate JIRA, this might be because of some incorrect mappedBy in your OneToOne mapping http://opensource.atlassian.com/projects/hibernate/browse/ANN-554





            • 18. Re: Upgrading hibernate in JBoss 4.2.2.GA

              To me it still smells like my app is using the old hibernate. According to the hibernate forum thread linked by ANN-554, the last post says to use hibernate annotations 3.3.0.

              I only see this issue if I leave the default hibernate jars in jboss (hibernate annotations 3.2.1.GA). If I overwrite the jboss hibernate jars with the new ones, it goes away (hibernate annotations 3.3.1.GA).

              • 19. Re: Upgrading hibernate in JBoss 4.2.2.GA
                jaikiran

                 

                To me it still smells like my app is using the old hibernate


                Okay, so let's try the next best way to debug this. In your run.bat file add -verbose:class option to the JAVA_OPTS and restart JBoss. The -verbose:class will print out the classes being loaded and the jar files being used for loading the classes. You may want to redirect STDOUT to some file since the logging will be too much.

                run.bat -b 0.0.0.0 > myconsole.log



                Post or upload this verbose class information.

                By the way, in the other thread that i was refering to, in addition to the classloading configuration and all the hibernate jars that you have included, we had to

                1) Also add hibernate-search.jar (the version is 3.0.0.GA) to the lib folder of EAR
                2) Also add lucene-core-2.2.0.jar to the lib folder of EAR.



                • 20. Re: Upgrading hibernate in JBoss 4.2.2.GA

                  Well it's definitely pulling the hibernate jars in from jboss-4.2.2.GA/server/default/lib/ and not my ear. The verbose log doesn't load anything from the jars in my ear lib directory.

                  I also put those other two jars in the ear, no change.

                  justin.

                  • 21. Re: Upgrading hibernate in JBoss 4.2.2.GA
                    jaikiran

                    In the past (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=133202), we have got the Hibernate version upgrade working in JBoss-4.2.x, so i know it works.

                    But, i don't exactly know what's the problem with your setup. Right now, its too late in the night for me to think about other possible reasons why its not working. In the meantime, post the verbose class logs and also the output of:

                    jar -tf yourapp.ear


                    I'll look at it with a fresh mind, sometime during the weekend and see if those logs and the ear listing helps in understanding what's wrong.




                    • 22. Re: Upgrading hibernate in JBoss 4.2.2.GA

                      OK, thanks for bearing with me. I'm now back to the NoSuchMethodException: org.hibernate.validator.ClassValidator exception. There was an error in my ant script and the hibernate jars went into the ear root instead of lib/... oops!

                      Now, after jboss starts and I try to use hibernate from my .war, I see classes being loaded from my ear hibernate jars (hooray). Correct versions are printed by hibernate, hibernate annotations, and hibernate entity manager.

                      All appears to go well until my jpa entities get mapped. Classes start being loaded from the old hibernate (starting with ClassValidator) and then the exception is generated.

                      Here is the relevant portion of the log:

                      [Loaded org.hibernate.mapping.OneToMany from file:/opt/jboss-4.2.2.GA/server/default/tmp/deploy/tmp54556application.ear-contents/lib/hibernate3.jar]
                      
                       ...Debug from CollectionBinder "Mapping Collection: ..."
                      
                      [Loaded org.hibernate.cfg.Mappings$PropertyReference from file:/opt/jboss-4.2.2.GA/server/default/tmp/deploy/tmp54556application.ear-contents/lib/hibernate3.jar]
                      
                       ...Debug from CollectionBinder "Mapping Collection: ..."
                      
                      [Loaded org.hibernate.mapping.UniqueKey from file:/opt/jboss-4.2.2.GA/server/default/tmp/deploy/tmp54556application.ear-contents/lib/hibernate3.jar]
                      [Loaded org.hibernate.validator.ClassValidator from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.hibernate.validator.MessageInterpolator from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.hibernate.validator.InvalidStateException from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.hibernate.reflection.XAnnotatedElement from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.hibernate.reflection.XMember from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.hibernate.exception.Nestable from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate3.jar]
                      [Loaded org.hibernate.exception.NestableRuntimeException from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate3.jar]
                      [Loaded org.hibernate.AssertionFailure from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate3.jar]
                      [Loaded org.hibernate.HibernateException from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate3.jar]
                      [Loaded org.hibernate.MappingException from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate3.jar]
                      [Loaded org.hibernate.reflection.ReflectionManager from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.hibernate.reflection.Filter from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.hibernate.reflection.XClass from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                      [Loaded org.apache.log4j.spi.ThrowableInformation from file:/opt/jboss-4.2.2.GA/lib/log4j-boot.jar]
                      [Loaded org.apache.log4j.spi.VectorWriter from file:/opt/jboss-4.2.2.GA/lib/log4j-boot.jar]
                      [Loaded org.apache.log4j.spi.NullWriter from file:/opt/jboss-4.2.2.GA/lib/log4j-boot.jar]
                      
                       ... EXCEPTION ...
                      


                      • 23. Re: Upgrading hibernate in JBoss 4.2.2.GA
                        jaikiran

                         

                        "jinpsu" wrote:


                        I'm now back to the NoSuchMethodException: org.hibernate.validator.ClassValidator exception.

                        All appears to go well until my jpa entities get mapped. Classes start being loaded from the old hibernate (starting with ClassValidator) and then the exception is generated.

                        Here is the relevant portion of the log:

                        [Loaded org.hibernate.validator.ClassValidator from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                        [Loaded org.hibernate.validator.MessageInterpolator from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                        [Loaded org.hibernate.validator.InvalidStateException from file:/opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar]
                        
                        


                        There you go - Fresh day, fresh mind :-)
                        The org.hibernate.validator package is now in hibernate-validator project. So in your upgrade, you should also add the (correct version) of hibernate-validator jar (i guess version 3.0.x), in the EAR/lib folder. Once you do that, you *might* run into a ClassCastException with the FullTextIndexEventListener, in which case:

                        1) Also add hibernate-search.jar (the version is 3.0.0.GA) to the lib folder of EAR
                        2) Also add lucene-core-2.2.0.jar to the lib folder of EAR.


                        • 24. Re: Upgrading hibernate in JBoss 4.2.2.GA

                          And all is well in the world... or at least my app.

                          Thanks again, jaikiran!

                          Justin.

                          1 2 Previous Next