7 Replies Latest reply on Feb 4, 2011 4:41 PM by ventmonkey

    Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven

    ventmonkey

      Hi all.  Sorry if this is the wrong forum for this question.  I posted this in the Seam discussion board, then realized it should probably be here.

       

      I am trying to deploy a seam app to Jboss AS 6.0.0.Final, using the hibernate included in the Seam pom, and have the following in my pom.xml

       

       

      <properties>

              <version.seam>2.2.1.Final</version.seam>

          </properties>

       

          <dependency>

              <groupId>org.jboss.seam</groupId>

              <artifactId>jboss-seam</artifactId>

              <version>${version.seam}</version>

          </dependency>

       

          <dependency>

              <groupId>org.jboss.seam</groupId>

              <artifactId>jboss-seam-ui</artifactId>

              <version>${version.seam}</version>

          </dependency>

       

          <dependency>

              <groupId>org.jboss.seam</groupId>

              <artifactId>jboss-seam-remoting</artifactId>

              <version>${version.seam}</version>

          </dependency>

       

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-core</artifactId>

                  <scope>compile</scope>

                  <exclusions>

                      <exclusion>

                          <groupId>antlr</groupId>

                          <artifactId>antlr</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-search</artifactId>

                  <scope>compile</scope>

                  <exclusions>

                      <exclusion>

                          <groupId>antlr</groupId>

                          <artifactId>antlr</artifactId>

                      </exclusion>

                      <exclusion>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-core</artifactId>

                      </exclusion>

                      <exclusion>

                          <groupId>org.hibernate</groupId>

                          <artifactId>ejb3-persistence</artifactId>

                      </exclusion>

                      <exclusion>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-commons-annotations</artifactId>

                      </exclusion>

                      <exclusion>

                          <groupId>org.slf4j</groupId>

                          <artifactId>slf4j-api</artifactId>

                      </exclusion>

                      <exclusion>

                          <groupId>javax.transaction</groupId>

                          <artifactId>jta</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-annotations</artifactId>

                  <scope>compile</scope>

                  <exclusions>

                      <exclusion>

                          <groupId>org.apache.lucene</groupId>

                          <artifactId>lucene-core</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-entitymanager</artifactId>

                  <scope>compile</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-commons-annotations</artifactId>

                  <scope>compile</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-tools</artifactId>

                  <scope>compile</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-validator</artifactId>

                  <scope>compile</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate.javax.persistence</groupId>

                  <artifactId>hibernate-jpa-2.0-api</artifactId>

                  <version>1.0.0.Final</version>

                  <scope>compile</scope>

              </dependency>

       

              <dependency>

                  <groupId>org.apache.lucene</groupId>

                  <artifactId>lucene-snowball</artifactId>

                  <version>2.4.1</version>

              </dependency>

      ......

       

           <build>

              <pluginManagement>

                  <plugins>

                      <plugin>

                          <groupId>org.apache.maven.plugins</groupId>

                          <artifactId>maven-ear-plugin</artifactId>

                          <version>2.5</version>

                          <configuration>

                              <version>5</version>

                              <defaultLibBundleDir>lib</defaultLibBundleDir>

                              <modules>

                                  <ejbModule>

                                      <groupId>com.myproj</groupId>

                                      <artifactId>myproj-ejb</artifactId>

                                  </ejbModule>

                              </modules>

                              <jboss>

                                  <loader-repository>

        com.myproj:archive=unique-archive-name

                                  </loader-repository>

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

                              </jboss>

                          </configuration>

                      </plugin>

                  </plugins>

              </pluginManagement>

          </build>

       

      This adds the folowing libs to my project

       

      find . -name \*hiber\*.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-tools-3.2.4.GA.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-commons-annotations-3.1.0.GA.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-entitymanager-3.4.0.GA.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-validator-3.1.0.GA.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-annotations-3.4.0.GA.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-search-3.1.1.GA.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/hibernate-core-3.3.1.GA.jar

      mason@mason-desktop:/proj/myproj$ find . -name \*seam\*.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/jboss-seam-remoting-2.2.1.Final.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/jboss-seam-ui-2.2.1.Final.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/lib/jboss-seam-2.2.1.Final.jar

      ./myproj-ear/target/myproj-ear-1.0-SNAPSHOT/jboss-seam-2.2.1.Final.jar

      mason@mason-desktop:/proj/myproj$

       

      my META-INF/jboss-app.xml looks like

       

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

      <!DOCTYPE jboss-app PUBLIC

              "-//JBoss//DTD J2EE Application 1.4//EN"

              "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">

      <jboss-app>

        <loader-repository>com.myproj:archive=unique-archive-name<loader-repository-config>java2ParentDelegation=false</loader-repository-config>

        </loader-repository>

      </jboss-app>

       

      and when I deploy, I get this error...

       

      19:17:36,321 ERROR [AbstractKernelController] Error installing to Start: name=jboss.j2ee:ear=myproj-ear-1.0-SNAPSHOT.ear,jar=myproj-ejb-1.0-SNAPSHOT.jar,name=GoogleAccountBean,service=EJB3 state=Create: java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to org.hibernate.hql.ast.HqlToken

              at org.hibernate.hql.ast.HqlLexer.makeToken(HqlLexer.java:62) [:3.6.0.Final]

              at org.hibernate.hql.antlr.HqlBaseLexer.mIDENT(HqlBaseLexer.java:599) [:3.6.0.Final]

              at org.hibernate.hql.antlr.HqlBaseLexer.nextToken(HqlBaseLexer.java:270) [:3.6.0.Final]

              at antlr.TokenBuffer.fill(Unknown Source) [:6.0.0.Final]

              at antlr.TokenBuffer.LA(Unknown Source) [:6.0.0.Final]

              at antlr.LLkParser.LA(Unknown Source) [:6.0.0.Final]

              at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:141) [:3.6.0.Final]

              at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:274) [:3.6.0.Final]

              at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182) [:3.6.0.Final]

              at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) [:3.6.0.Final]

              at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) [:3.6.0.Final]

              at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [:3.6.0.Final]

              at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) [:3.6.0.Final]

              at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) [:3.6.0.Final]

              at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) [:3.6.0.Final]

              at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) [:3.6.0.Final]

              at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272) [:3.6.0.Final]

              at org.jboss.ejb3.timerservice.mk2.TimerServiceImpl.getActiveTimers(TimerServiceImpl.java:983) [:1.0.0-alpha-13]

              at org.jboss.ejb3.timerservice.mk2.TimerServiceImpl.restoreTimers(TimerServiceImpl.java:738) [:1.0.0-alpha-13]

              at org.jboss.ejb3.timerservice.mk2.TimerServiceFactoryImpl.restoreTimerService(TimerServiceFactoryImpl.java:123) [:1.0.0-alpha-13]

              at org.jboss.ejb3.TimerServiceContainer.restoreTimerService(TimerServiceContainer.java:244) [:1.7.17]

              at org.jboss.ejb3.TimerServiceContainer.afterStart(TimerServiceContainer.java:129) [:1.7.17]

              at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:1113) [:1.7.17]

       

      I cannot figure out if I am missing a hibernate lib, or if this is a class loading order issue.  Please help.  Has anyone else gotten Seam 2.2.1, Hibernate-search, and Jboss AS 6 working in a maven project?

      Thanks,Mason

        • 1. Re: Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven
          ventmonkey

          grrr....that didnt seem to show my pom.xml.  Let me try again...

           

           

           <properties>
                  <version.seam>2.2.1.Final</version.seam>
              </properties>
          
              <dependency>
                  <groupId>org.jboss.seam</groupId>
                  <artifactId>jboss-seam</artifactId>
                  <version>${version.seam}</version>
              </dependency>
          
              <dependency>
                  <groupId>org.jboss.seam</groupId>
                  <artifactId>jboss-seam-ui</artifactId>
                  <version>${version.seam}</version>
              </dependency>
          
              <dependency>
                  <groupId>org.jboss.seam</groupId>
                  <artifactId>jboss-seam-remoting</artifactId>
                  <version>${version.seam}</version>
              </dependency>
          
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-core</artifactId>
                      <scope>compile</scope>
                      <exclusions>
                          <exclusion>
                              <groupId>antlr</groupId>
                              <artifactId>antlr</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-search</artifactId>
                      <scope>compile</scope>
                      <exclusions>
                          <exclusion>
                              <groupId>antlr</groupId>
                              <artifactId>antlr</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.hibernate</groupId>
                              <artifactId>hibernate-core</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.hibernate</groupId>
                              <artifactId>ejb3-persistence</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.hibernate</groupId>
                              <artifactId>hibernate-commons-annotations</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.slf4j</groupId>
                              <artifactId>slf4j-api</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>javax.transaction</groupId>
                              <artifactId>jta</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-annotations</artifactId>
                      <scope>compile</scope>
                      <exclusions>
                          <exclusion>
                              <groupId>org.apache.lucene</groupId>
                              <artifactId>lucene-core</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-entitymanager</artifactId>
                      <scope>compile</scope>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-commons-annotations</artifactId>
                      <scope>compile</scope>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-tools</artifactId>
                      <scope>compile</scope>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-validator</artifactId>
                      <scope>compile</scope>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate.javax.persistence</groupId>
                      <artifactId>hibernate-jpa-2.0-api</artifactId>
                      <version>1.0.0.Final</version>
                      <scope>compile</scope>
                  </dependency>
          
                  <dependency>
                      <groupId>org.apache.lucene</groupId>
                      <artifactId>lucene-snowball</artifactId>
                      <version>2.4.1</version>
                  </dependency>
          ......
          
               <build>
                  <pluginManagement>
                      <plugins>
                          <plugin>
                              <groupId>org.apache.maven.plugins</groupId>
                              <artifactId>maven-ear-plugin</artifactId>
                              <version>2.5</version>
                              <configuration>
                                  <version>5</version>
                                  <defaultLibBundleDir>lib</defaultLibBundleDir>
                                  <modules>
                                      <ejbModule>
                                          <groupId>com.myproj</groupId>
                                          <artifactId>myproj-ejb</artifactId>
                                      </ejbModule>
                                  </modules>
                                  <jboss>
                                      <loader-repository>
            com.myproj:archive=unique-archive-name
                                      </loader-repository>
                                      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
                                  </jboss>
                              </configuration>
                          </plugin>
                      </plugins>
                  </pluginManagement>
              </build>
          
          • 2. Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven
            nickarls

            Tried dropping all hibernate jars from your app that's already on the AS?

            • 3. Re: Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven
              ventmonkey

              THanks for the suggestion.  I tried dropping all but hibernate-search-3.1.1.GA.jar, I then get the following error...

              20:44:10,621 INFO  [Version] Hibernate Search 3.1.1.GA
              20:44:10,771 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=myproj-ear-1.0-SNAPSHOT.ear/persistence.xml#FiviProduction-ejbPU state=Create: java.lang.NoSuchMethodError: org.hibernate.util.SoftLimitMRUCache.<init>(I)V
                      at org.hibernate.search.filter.MRUFilterCachingStrategy.initialize(MRUFilterCachingStrategy.java:25)
                      at org.hibernate.search.impl.SearchFactoryImpl.buildFilterCachingStrategy(SearchFactoryImpl.java:461)
                      at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:131)
                      at org.hibernate.search.event.ContextHolder.getOrBuildSearchFactory(ContextHolder.java:30)
                      at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:79)
                      at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198) [:3.6.0.Final]
                      at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181) [:3.6.0.Final]
                      at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194) [:3.6.0.Final]
                      at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1980) [:3.6.0.Final]
                      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842) [:3.6.0.Final]
                      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) [:3.6.0.Final]
                      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [:3.6.0.Final]
                      at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47) [:1.0.2-alpha-3]
                      at org.jboss.as.jpa.scanner.HackCEMFBuilder.build(HackCEMFBuilder.java:49) [:6.0.0.Final]
                      at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275) [:1.0.2-alpha-3]
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20]
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.6.0_20]
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_20]
              
              • 4. Re: Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven
                nickarls

                Tried taking it out and placing it in the common dir with the other hib jars (well, a matching version of hib-search)?

                1 of 1 people found this helpful
                • 5. Re: Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven
                  shelly.mcgowan

                  Use Hibernate Search 3.3 with JBoss AS 6.  See: JBSEAM-4714 / JBAS-8500

                  1 of 1 people found this helpful
                  • 6. Re: Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven
                    ventmonkey

                    I think I figured it out, with both of your help.  Using the hibernate-search lib from the seam example worked. I realized that my hibernate-search dependency was using the hibernate-search within seam under the pom's dependencyManagement.  Once I excluded hibernate-search and set a version (3.3.0, was previously using 3.3.1 from seam), maven downloaded hibernate-search-3.3.0.Final.jar and hibernate-search-analyzers-3.3.0.Final.jar, and it seems to be worknig!  er, actually, I'm getting other errors, but I think I can get through those.  Thanks!

                    • 7. Re: Seam 2.2.1.final, Hibernate-search, jboss AS 6, and Maven
                      ventmonkey

                      Unfortunatly, this is now broken again.  Once I got enough other errors out of the way, I realized my Hibernate annotations were no longer working.  I added hibernate-annotations-3.3.0.ga.jar, and am now get the error bellow.

                       

                      I've tried every version of Hibernate annotations I can think of.

                       

                      I've also tried including All hibernate jars in my project to override those in Jboss AS 6, but I always seem to get ClassCastExceptions.  Does anyone have any advice on how to get hibernate-annotations working in AS 6, or how to replace hibernate entirely?

                       

                      Thanks,

                      Mason

                       

                       

                      21:36:52,016 ERROR [AbstractKernelController] Error installing to Start: name=jboss.j2ee:ear=myproj-ear-1.0-SNAPSHOT.ear,jar=myproj-ejb-1.0-SNAPSHOT.jar,name=ArticleBean,service=EJB3 state=Create: java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token
                              at antlr.CharScanner.makeToken(Unknown Source) [:6.0.0.Final]
                              at org.hibernate.hql.ast.HqlLexer.makeToken(HqlLexer.java:62) [:3.6.0.Final]
                              at org.hibernate.hql.antlr.HqlBaseLexer.mIDENT(HqlBaseLexer.java:599) [:3.6.0.Final]
                              at org.hibernate.hql.antlr.HqlBaseLexer.nextToken(HqlBaseLexer.java:270) [:3.6.0.Final]
                              at antlr.TokenBuffer.fill(Unknown Source) [:6.0.0.Final]
                              at antlr.TokenBuffer.LA(Unknown Source) [:6.0.0.Final]
                              at antlr.LLkParser.LA(Unknown Source) [:6.0.0.Final]
                              at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:141) [:3.6.0.Final]
                              at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:274) [:3.6.0.Final]
                              at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182) [:3.6.0.Final]
                              at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) [:3.6.0.Final]
                              at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) [:3.6.0.Final]
                              at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [:3.6.0.Final]
                              at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) [:3.6.0.Final]
                              at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) [:3.6.0.Final]
                              at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) [:3.6.0.Final]
                              at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) [:3.6.0.Final]
                              at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272) [:3.6.0.Final]
                              at org.jboss.ejb3.timerservice.mk2.TimerServiceImpl.getActiveTimers(TimerServiceImpl.java:983) [:1.0.0-alpha-13]
                              at org.jboss.ejb3.timerservice.mk2.TimerServiceImpl.restoreTimers(TimerServiceImpl.java:738) [:1.0.0-alpha-13]
                              at org.jboss.ejb3.timerservice.mk2.TimerServiceFactoryImpl.restoreTimerService(TimerServiceFactoryImpl.java:123) [:1.0.0-alpha-13]
                              at org.jboss.ejb3.TimerServiceContainer.restoreTimerService(TimerServiceContainer.java:244) [:1.7.17]
                              at org.jboss.ejb3.TimerServiceContainer.afterStart(TimerServiceContainer.java:129) [:1.7.17]
                              at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:1113) [:1.7.17]
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20]