1 2 3 4 5 Previous Next 63 Replies Latest reply on Feb 28, 2012 10:46 PM by smarlow Go to original post
      • 30. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
        smarlow
        I wonder how this all makes sense with my situation. I have my old (online) webapp which works on JBoss AS 7.0.0.Final up to JBoss AS 7.1.0.CR1 using Seam 2.2.2 and it's not kicking in Hibernate 4. Then I changed the project to Maven, now resulting in a different set of deployed libs, a slightly different jboss-deployment-structure.xml, a slightly different dir structure plus the persistence now being JTA (not RESOURCE_LOCAL as the old app) and it's still using Seam 2.2.2 but this time the app is kicking in Hibernate 4.... it doesn't make sense to me to look into Seam as the cause.

         

        We probably could boot your app on AS 7.0.0.Final with JPA TRACE logging enabled and examine the server.log.  Some of the variables that we will look for, is which persistence provider is added to the javax.persistence.Persistence providers list.  I think it was probably the Hibernate 3 jars instead of the Hibernate 4 jars.

         

        If we cannot solve AS7-3423 (not an AS 7.1 task), I would look for a different way to allow the Hibernate 3 jars to be added to the javax.persistence.Persistence providers list (first).  The other way, could be allowing the default (global) persistence provider module to be configured but I would prefer to take the AS7-3423 route.

         

        Scott

        • 31. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
          ctomc

          Scott,

          seam does that with @Install annotations

          you can look at docs here:

          http://docs.jboss.org/seam/latest/reference/en-US/html/annotations.html

           

          if I remember correctly this would be the class signature for overriding the peristenceProvider

           

          @Name("org.jboss.seam.persistence.persistenceProvider")
          @Scope(ScopeType.STATELESS)
          @BypassInterceptors
          @Install(precedence=BUILT_IN, classDependencies={"org.hibernate.Session", "javax.persistence.EntityManager"})
          public class HibernatePersistenceProvider extends PersistenceProvider{
          

           

          I think this would be the proper way to override this with your own implementation, the core of the problem lies in newer version of hibernate as seam was compiled against 3.3

          I was working alot on migration of seam projects to as7 and there ware many paths I tryied, latest was making fork of seam to work with h4 but I haven't touched for a while now...

          Let me try to debug this on my machine as I think I have an idea how to fix this.

           

          fixed the precedence in example

          • 32. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
            kwutzke

            @Scott:

             

            The server logs are here to compare:

             

            NEW app (failing): https://community.jboss.org/servlet/JiveServlet/download/716761-51052/server.log.zip

            OLD app (working): https://community.jboss.org/servlet/JiveServlet/download/716767-51057/oldapp.server.log.zip

             

            The only thing I can clearly see is (NEW app):

            {code}lots of Seam stuff

            .

            .

            .

            11:07:27,578 INFO  [org.jboss.seam.Component] (MSC service thread 1-3) Component: totalTeamStatsQuery, scope: EVENT, type: JAVA_BEAN, class: com.kawoolutions.bbstats.da.TotalTeamStatsQuery

            11:07:27,583 WARNING [org.jboss.seam.security.permission.PersistentPermissionResolver] (MSC service thread 1-3) no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.

            11:07:27,688 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-3) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

            11:07:27,688 INFO  [org.hibernate.Version] (MSC service thread 1-3) HHH000412: Hibernate Core {4.0.0.Final}

            11:07:27,688 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH000206: hibernate.properties not found

            11:07:27,688 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH000021: Bytecode provider name : javassist

            11:07:28,249 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-3) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect

            11:07:28,249 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-3) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory

            11:07:28,265 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-3) HHH000397: Using ASTQueryTranslatorFactory

            11:07:28,280 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/bbstats]] (MSC service thread 1-3) Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener: org.jboss.seam.InstantiationException: Could not instantiate Seam component: emf

            .

            .

            .

            {code}

            OLD app:

            {code}

            lots of Seam stuff

            .

            .

            .

            12:44:18,567 INFO  [org.jboss.seam.Component] (MSC service thread 1-3) Component: totalTeamStatsQuery, scope: EVENT, type: JAVA_BEAN, class: com.kawoolutions.bbstats.semidao.TotalTeamStatsQuery

            12:44:18,567 WARNING [org.jboss.seam.security.permission.PersistentPermissionResolver] (MSC service thread 1-3) no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.

            12:44:18,817 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-3) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect

            12:44:18,817 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-3) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

            12:44:18,817 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-3) HHH000397: Using ASTQueryTranslatorFactory

            12:44:19,737 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Initializing Mojarra (1.2_15.jbossorg-1-20111019-SNAPSHOT) for context '/bbstats'

            .

            .

            .

            {code}

            Note the four 11:07:27,688 INFO entries. But again, I have no idea what causes this.

             

            Karsten

            • 33. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
              smarlow

              @Karsten,

               

              Can you provide the server.log output from AS start to after application is deployed.

               

              Scott

              • 34. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                kwutzke

                Scott, I've attached the logs and more in this thread already. Just follow the links of my previous reply.

                 

                Karsten

                 

                PS: I sent you a PM with links to the project ZIP including all sources and both the OLD and NEW deployments as ZIPs.

                • 35. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                  smarlow

                  Anyway, looking backwards at why your old application deployed successfully on AS 7.0.0.Final versus your new app is not going to show us what you need to change in your new app to deploy on AS 7.1.

                  • 36. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                    smarlow

                    I'll look at them...

                    • 37. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                      smarlow

                      I just pulled the old webapp from my remote server, it deployed to JBAS 7.1 CR1 without any exceptions.

                       

                      If your old app is working on 7.1, then my theory about why your old app worked on 7.0, is incorrect.  It must be something else that has changed. 

                      • 38. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                        kwutzke

                        Well, the two server logs were both from my local JBAS 7.1.0.CR1 instance, so that already says something...

                         

                        Karsten

                        • 39. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                          ctomc

                          Hi,

                           

                          I have now played with both versions of your application and now both deploy on current snapshot (build this afternoon)

                           

                          The trick is that your old version (from remote server) deployed becouse it used hibernate 4 as you can see from log and not bundled hibernate 3.

                          If I modify your new version of app so that i comment out exclude of hibernate in jboss-deployment-structure.xml and comment out

                           

                          <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />

                          it deployes, but with hibernate 4 not bundled version of hibernete.

                          I have not tested the functionaly of app but just that it deployed ant it was accessable trough browser.

                           

                          @Scott: you are right the problem is that with "hibernate3-bundled" it loads both versions of hibernate starts with one and than continues with another from main slot. this is a bug in jpa subsystem i belive...

                           

                          --

                          tomaz

                          1 of 1 people found this helpful
                          • 40. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                            smarlow

                            I have the old copy of the app locally and will investigate why Hibernate 4 is coming into play (probably because javax.persistence.Persistence.createEntityManagerFactory is used which only knows about Hibernate 4 but it will be good to verify). 

                             

                            For others having this problem, trying the @Install workaround that Tomaz mentioned earlier might be worth trying. 

                            • 41. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                              smarlow

                              @Tomaz, yes, its because javax.persistence.Persistence.createEntityManagerFactory only knows about the Hibernate 4 jars (just verified that is the root cause in the debugger). 

                               

                              I think trying to address AS7-3423 will be a good start. 

                              • 42. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                                kwutzke

                                @Tomaz and Scott:

                                Yes, you're correct, I never realized I was essentially using Hibernate 4 remotely. Visiting my test servlet http://www.bbstats.net/home reveals a [WORKING] version of Hibernate 4 as deployed along with JBAS 7.0 Final.

                                 

                                Well, now that I stepped back from the stuff for an hour, the problem that started all the Hibernate 3 bundling stuff along with Seam 2 is another problem I encountered while trying to use my Seam 2 app with Hibernate 4. The thread is here:

                                 

                                https://community.jboss.org/message/714893

                                 

                                or here on SO:

                                 

                                http://stackoverflow.com/questions/9164505/seam-entityhome-subclass-call-getter-fails-with-transactionrequiredexception-no

                                 

                                I have no answers for that TA exception. It occurrs only for one page: team-home. It's reachable via the nav to the left, Teams, then any in the list, baam. I hardly believe it's a Seam 2 problem, but I'm completely lost with that exception (even more).

                                 

                                @Tomaz: could you please try the above with Hibernate 4? Are you using MySQL? If so, which version (major enough).

                                 

                                Is Seam 2 compatible with Hibernate 4 at all?

                                 

                                Karsten

                                • 43. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                                  smarlow

                                  I'll respond on the Seam forum thread, I think you will need to try that @Install annotation workaround that Tomaz mentioned.

                                  • 44. Re: Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)
                                    manarh

                                    Tomaz Cerar wrote:

                                     

                                    Seam 2 works with hibernate 3.3.x and validator 3.1 that is your main couse of the problems.

                                    Bundle hibernate 3.3(jpa 1) instead 3.6(jpa 2) and it should work.

                                     

                                    --

                                    tomaz

                                    Or you need to use latest 2.3.0-SNAPSHOT starting from 8th February as this is the point when I added JPA2 and Bean Validation into org.jboss.seam:jboss-seam-jsf2:2.3.0-SNAPSHOT artifact.