13 Replies Latest reply on Jan 22, 2013 8:07 AM by Sam W

    NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0

    Sam W Expert

      With JBOSS 7.1.1  Final and Hibernate-search 4.2.0, when I deploy the ear project, its ejb module thrown the following exception:

       

       

      12:39:46,162 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-7) Creating Service {http://articlepointform.service.product.ForestSurf/}ArticlePointFormServiceImplService from class ForestSurf.product.service.articlepointform.ArticlePointFormService

      12:39:46,205 WARN  [org.jboss.modules] (MSC service thread 1-2) Failed to define class org.hibernate.search.util.impl.DelegateNamedAnalyzer in Module "deployment.ForestSurf-ear-1.0.ear:main" from Service Module Loader: java.lang.VerifyError: class org.hibernate.search.util.impl.DelegateNamedAnalyzer overrides final method tokenStream.(Ljava/lang/String;Ljava/io/Reader;)Lorg/apache/lucene/analysis/TokenStream;

              at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_07]

              at java.lang.ClassLoader.defineClass(ClassLoader.java:620) [rt.jar:1.6.0_07]

              at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) [rt.jar:1.6.0_07]

              at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

              at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

              at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

              at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

              at org.jboss.modules.Module.loadModuleClass(Module.java:517)

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

              at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [rt.jar:1.6.0_07]

              at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:365) [hibernate-search-engine-4.2.0.Final.jar:4.2.0.Final]

              at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:222) [hibernate-search-engine-4.2.0.Final.jar:4.2.0.Final]

              at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:146) [hibernate-search-engine-4.2.0.Final.jar:4.2.0.Final]

              at org.hibernate.search.event.impl.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:130) [hibernate-search-orm-4.2.0.Final.jar:4.2.0.Final]

              at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:83) [hibernate-search-orm-4.2.0.Final.jar:4.2.0.Final]

              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]

              at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

       

       

      12:39:46,230 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": Failed to start service

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]

              at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

      Caused by: java.lang.NoClassDefFoundError: org/hibernate/search/util/impl/DelegateNamedAnalyzer

              at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:365)

              at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:222)

              at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:146)

              at org.hibernate.search.event.impl.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:130)

              at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:83)

              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294)

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)

              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              ... 3 more

      Caused by: java.lang.ClassNotFoundException: org.hibernate.search.util.impl.DelegateNamedAnalyzer from [Module "deployment.ForestSurf-ear-1.0.ear:main" from Service Module Loader]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

              at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [rt.jar:1.6.0_07]

       

       

      Here is my pom.xml file:

       

       

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

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

          <modelVersion>4.0.0</modelVersion>

          <parent>

          <artifactId>ForestSurf</artifactId>

          <groupId>ForestSurf</groupId>

          <version>1.0</version>

        </parent>

       

       

          <groupId>ForestSurf</groupId>

          <artifactId>ForestSurf-ejb</artifactId>

          <version>1.0</version>

          <packaging>ejb</packaging>

       

       

          <name>ForestSurf-ejb</name>

       

       

          <properties>

              <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>

              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

              <log4j.version>1.2.14</log4j.version>

              <hibernate.version>4.1.7.Final</hibernate.version>

              <org.springframework-version>3.0.7.RELEASE</org.springframework-version>

          </properties>

       

       

          <dependencies>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-core</artifactId>

                  <version>4.1.9.Final</version>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-annotations</artifactId>

                  <version>3.5.6-Final</version>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-search</artifactId>

                  <version>4.2.0.Final</version>

              </dependency>

              <dependency>

                  <groupId>org.springframework</groupId>

                  <artifactId>spring-orm</artifactId>

                  <version>3.2.0.RELEASE</version>

              </dependency>

              <dependency>

                  <groupId>javax</groupId>

                  <artifactId>javaee-api</artifactId>

                  <version>6.0</version>

                  <scope>provided</scope>

              </dependency>

       

       

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-envers</artifactId>

                  <version>4.1.9.Final</version>

       

       

                  <exclusions>

                      <exclusion>

                          <groupId>dom4j</groupId>

                          <artifactId>dom4j</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

             

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-entitymanager</artifactId>

                  <version>4.1.9.Final</version>

                  <type>jar</type>

       

       

              </dependency>

              <dependency>

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

                      <artifactId>lucene-snowball</artifactId>

                      <version>3.0.3</version>

              </dependency>

              <dependency>

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

                  <artifactId>lucene-core</artifactId>

                  <version>4.0.0</version>

              </dependency>

              <dependency>

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

                      <artifactId>lucene-analyzers-common</artifactId>

                      <version>4.0.0</version>

              </dependency>

      <!--        <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-search-engine</artifactId>

                      <version>4.1.1.Final</version>

              </dependency>-->

              <dependency>

                  <groupId>commons-lang</groupId>

                  <artifactId>commons-lang</artifactId>

                  <version>2.6</version>

              </dependency>

              <dependency>

                  <groupId>joda-time</groupId>

                  <artifactId>joda-time</artifactId>

                  <version>2.1</version>

              </dependency>

              <dependency>

                  <groupId>org.slf4j</groupId>

                  <artifactId>slf4j-log4j12</artifactId>

                  <version>1.7.2</version>

                  <type>jar</type>

              </dependency>

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.8.1</version>

                  <scope>test</scope>

              </dependency>

          </dependencies>

       

       

          <build>

              <plugins>

                  <plugin>

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

                      <artifactId>maven-compiler-plugin</artifactId>

                      <version>2.3.2</version>

                      <configuration>

                          <source>1.6</source>

                          <target>1.6</target>

                          <compilerArguments>

                              <endorseddirs>${endorsed.dir}</endorseddirs>

                          </compilerArguments>

                      </configuration>

                  </plugin>

                  <plugin>

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

                      <artifactId>maven-ejb-plugin</artifactId>

                      <version>2.3</version>

                      <configuration>

                          <ejbVersion>3.1</ejbVersion>

                      </configuration>

                  </plugin>

                  <plugin>

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

                      <artifactId>maven-dependency-plugin</artifactId>

                      <version>2.1</version>

                      <executions>

                          <execution>

                              <phase>validate</phase>

                              <goals>

                                  <goal>copy</goal>

                              </goals>

                              <configuration>

                                  <outputDirectory>${endorsed.dir}</outputDirectory>

                                  <silent>true</silent>

                                  <artifactItems>

                                      <artifactItem>

                                          <groupId>javax</groupId>

                                          <artifactId>javaee-endorsed-api</artifactId>

                                          <version>6.0</version>

                                          <type>jar</type>

                                      </artifactItem>

                                  </artifactItems>

                              </configuration>

                          </execution>

                      </executions>

                  </plugin>

              </plugins>

          </build>

       

       

      </project>

       

       

      Ear file list:

       

       

      $jar tf ForestSurf-ear-1.0.ear

      META-INF/

      META-INF/MANIFEST.MF

      lib/

      ForestSurf-ejb-1.0.jar

      ForestSurf-web-1.0.war

      lib/antlr-2.7.7.jar

      lib/aopalliance-1.0.jar

      lib/avro-1.6.3.jar

      lib/commons-codec-1.6.jar

      lib/commons-io-2.1.jar

      lib/commons-lang-2.6.jar

      lib/commons-logging-1.1.1.jar

      lib/dom4j-1.6.1.jar

      lib/guava-r05.jar

      lib/hibernate-annotations-3.5.6-Final.jar

      lib/hibernate-commons-annotations-3.2.0.Final.jar

      lib/hibernate-commons-annotations-4.0.1.Final.jar

      lib/hibernate-core-4.1.9.Final.jar

      lib/hibernate-entitymanager-4.1.9.Final.jar

      lib/hibernate-envers-4.1.9.Final.jar

      lib/hibernate-jpa-2.0-api-1.0.1.Final.jar

      lib/hibernate-search-4.2.0.Final.jar

      lib/hibernate-search-analyzers-4.2.0.Final.jar

      lib/hibernate-search-engine-4.2.0.Final.jar

      lib/hibernate-search-orm-4.2.0.Final.jar

      lib/jackson-core-asl-1.8.8.jar

      lib/jackson-mapper-asl-1.8.8.jar

      lib/javassist-3.17.1-GA.jar

      lib/jboss-logging-3.1.0.GA.jar

      lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar

      lib/joda-time-2.1.jar

      lib/log4j-1.2.17.jar

      lib/lucene-analyzers-3.6.2.jar

      lib/lucene-analyzers-common-4.0.0.jar

      lib/lucene-core-4.0.0.jar

      lib/lucene-facet-3.6.2.jar

      lib/lucene-grouping-3.6.2.jar

      lib/lucene-highlighter-3.6.2.jar

      lib/lucene-kuromoji-3.6.2.jar

      lib/lucene-memory-3.6.2.jar

      lib/lucene-misc-3.6.2.jar

      lib/lucene-phonetic-3.6.2.jar

      lib/lucene-smartcn-3.6.2.jar

      lib/lucene-snowball-3.0.3.jar

      lib/lucene-spatial-3.6.2.jar

      lib/lucene-spellchecker-3.6.2.jar

      lib/lucene-stempel-3.6.2.jar

      lib/paranamer-2.3.jar

      lib/slf4j-api-1.5.8.jar

      lib/slf4j-log4j12-1.7.2.jar

      lib/snappy-java-1.0.4.1.jar

      lib/solr-analysis-extras-3.6.2.jar

      lib/solr-core-3.6.2.jar

      lib/solr-solrj-3.6.2.jar

      lib/spring-beans-3.2.0.RELEASE.jar

      lib/spring-core-3.2.0.RELEASE.jar

      lib/spring-jdbc-3.2.0.RELEASE.jar

      lib/spring-orm-3.2.0.RELEASE.jar

      lib/spring-tx-3.2.0.RELEASE.jar

      META-INF/application.xml

      META-INF/jboss-app.xml

      META-INF/maven/

      META-INF/maven/ForestSurf/

      META-INF/maven/ForestSurf/ForestSurf-ear/

      META-INF/maven/ForestSurf/ForestSurf-ear/pom.xml

      META-INF/maven/ForestSurf/ForestSurf-ear/pom.properties

       

       

       

      Any suggestion is very appreciated.

      Thanks

      Sam

        • 1. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
          Sam W Expert

          I noticed that the jar file contains :

          ib/hibernate-commons-annotations-3.2.0.Final.jar

          lib/hibernate-commons-annotations-4.0.1.Final.jar

           

          But I have added 4.1.9.Final in my pom.xml file.

           

           

          Is there any way I I upgrade hibernate core libraries for jboss?

          Thanks

          Sam

          • 2. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
            Nicklas Karlsson Master

            You could upgrade the libraries in the hibernate module on the AS (if the API is still compatible). I don't think you should have any hibernate jars in the application that are present in the as-hibernate module as well.

            • 3. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
              Sam W Expert

              Hi Nick,

              Thank you for your suggestion. I would think so. But not sure if changing /removing some of the lucene libaries from my pom.xml file would fix the problem?

              I removed lucene-core 4.0 jar file in the pom.xml file, and then re-deploy the ear file, jboss thrown the following exception:

               

               

              22:10:21,184 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": Failed to start service

                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]

                      at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

              Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents

                      at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.6.0_07]

                      at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [rt.jar:1.6.0_07]

                      at java.lang.Class.getConstructor0(Class.java:2699) [rt.jar:1.6.0_07]

                      at java.lang.Class.getConstructor(Class.java:1657) [rt.jar:1.6.0_07]

                      at org.hibernate.search.util.impl.ClassLoaderHelper.analyzerInstanceFromClass(ClassLoaderHelper.java:170)

                      at org.hibernate.search.impl.ConfigContext.initAnalyzer(ConfigContext.java:189)

                      at org.hibernate.search.impl.ConfigContext.<init>(ConfigContext.java:105)

                      at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:365)

                      at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:222)

                      at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:146)

                      at org.hibernate.search.event.impl.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:130)

                      at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:83)

                      at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294)

                      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)

                      at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)

                      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)

                      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)

                      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

                      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

                      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      ... 3 more

              Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer$TokenStreamComponents from [Module "deployment.ForestSurf-ear-1.0.ear:main" from Service Module Loader]

                      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

                      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [rt.jar:1.6.0_07]

               

               

              Here is the pom.xml file:

               

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

              <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                  <modelVersion>4.0.0</modelVersion>

                  <parent>

                  <artifactId>ForestSurf</artifactId>

                  <groupId>ForestSurf</groupId>

                  <version>1.0</version>

                </parent>

               

               

                  <groupId>ForestSurf</groupId>

                  <artifactId>ForestSurf-ejb</artifactId>

                  <version>1.0</version>

                  <packaging>ejb</packaging>

               

               

                  <name>ForestSurf-ejb</name>

               

               

                  <properties>

                      <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>

                      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                      <log4j.version>1.2.14</log4j.version>

                      <hibernate.version>4.1.7.Final</hibernate.version>

                      <org.springframework-version>3.0.7.RELEASE</org.springframework-version>

                  </properties>

               

               

                  <dependencies>

                      <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-core</artifactId>

                          <version>4.1.9.Final</version>

                      </dependency>

                      <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-annotations</artifactId>

                          <version>3.5.6-Final</version>

                      </dependency>

                      <dependency>

                              <groupId>org.hibernate</groupId>

                              <artifactId>hibernate-infinispan</artifactId>

                              <version>4.1.9.Final</version>

                      </dependency>

                      <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-search</artifactId>

                          <version>4.2.0.Final</version>

                      </dependency>

                      <dependency>

                          <groupId>org.springframework</groupId>

                          <artifactId>spring-orm</artifactId>

                          <version>3.2.0.RELEASE</version>

                      </dependency>

                      <dependency>

                          <groupId>javax</groupId>

                          <artifactId>javaee-api</artifactId>

                          <version>6.0</version>

                          <scope>provided</scope>

                      </dependency>

               

               

                      <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-envers</artifactId>

                          <version>4.1.9.Final</version>

               

               

                          <exclusions>

                              <exclusion>

                                  <groupId>dom4j</groupId>

                                  <artifactId>dom4j</artifactId>

                              </exclusion>

                          </exclusions>

                      </dependency>

                     

                      <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-entitymanager</artifactId>

                          <version>4.1.9.Final</version>

                          <type>jar</type>

               

               

                      </dependency>

                      <dependency>

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

                              <artifactId>lucene-snowball</artifactId>

                              <version>3.0.3</version>

                      </dependency>

              <!--        <dependency>

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

                          <artifactId>lucene-core</artifactId>

                          <version>4.0.0</version>

                      </dependency>-->

                      <dependency>

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

                              <artifactId>lucene-analyzers-common</artifactId>

                              <version>4.0.0</version>

                      </dependency>

              <!--        <dependency>

                              <groupId>org.hibernate</groupId>

                              <artifactId>hibernate-search-engine</artifactId>

                              <version>4.1.1.Final</version>

                      </dependency>-->

                      <dependency>

                          <groupId>commons-lang</groupId>

                          <artifactId>commons-lang</artifactId>

                          <version>2.6</version>

                      </dependency>

                      <dependency>

                          <groupId>joda-time</groupId>

                          <artifactId>joda-time</artifactId>

                          <version>2.1</version>

                      </dependency>

                      <dependency>

                          <groupId>org.slf4j</groupId>

                          <artifactId>slf4j-log4j12</artifactId>

                          <version>1.7.2</version>

                          <type>jar</type>

                      </dependency>

                      <dependency>

                          <groupId>junit</groupId>

                          <artifactId>junit</artifactId>

                          <version>4.8.1</version>

                          <scope>test</scope>

                      </dependency>

                  </dependencies>

               

               

                  <build>

                      <plugins>

                          <plugin>

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

                              <artifactId>maven-compiler-plugin</artifactId>

                              <version>2.3.2</version>

                              <configuration>

                                  <source>1.6</source>

                                  <target>1.6</target>

                                  <compilerArguments>

                                      <endorseddirs>${endorsed.dir}</endorseddirs>

                                  </compilerArguments>

                              </configuration>

                          </plugin>

                          <plugin>

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

                              <artifactId>maven-ejb-plugin</artifactId>

                              <version>2.3</version>

                              <configuration>

                                  <ejbVersion>3.1</ejbVersion>

                              </configuration>

                          </plugin>

                          <plugin>

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

                              <artifactId>maven-dependency-plugin</artifactId>

                              <version>2.1</version>

                              <executions>

                                  <execution>

                                      <phase>validate</phase>

                                      <goals>

                                          <goal>copy</goal>

                                      </goals>

                                      <configuration>

                                          <outputDirectory>${endorsed.dir}</outputDirectory>

                                          <silent>true</silent>

                                          <artifactItems>

                                              <artifactItem>

                                                  <groupId>javax</groupId>

                                                  <artifactId>javaee-endorsed-api</artifactId>

                                                  <version>6.0</version>

                                                  <type>jar</type>

                                              </artifactItem>

                                          </artifactItems>

                                      </configuration>

                                  </execution>

                              </executions>

                          </plugin>

                      </plugins>

                  </build>

               

               

              </project>

               

              • 4. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                Nicklas Karlsson Master

                Well if you use lucene the jar:s have to be somewhere. They're not on the AS per default so they can be either bundled in the EAR or in an AS module. I would probably go for dropping the hibernate and lucene jars from the application and move the lucene jars to an AS module and declare a dependency from the hibernate module to the lucene one. Just guessing, I've never used lucene...

                1 of 1 people found this helpful
                • 5. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                  Sam W Expert

                  Thank you for the suggestion, this is a better solution.

                  In the ~/jboss711Final/modules/org/hibernate/main folder, I noticed there are some *.index files.

                  How to generate those index files?

                   

                  Thanks

                  Sam

                  • 6. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                    Nicklas Karlsson Master

                    They are generated automatically by JBoss Modules (Jandex?). If you remove it, it will be re-generated.

                    1 of 1 people found this helpful
                    • 7. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                      Sam W Expert

                      Thanks, I got the index file generated by jboss when I restarted the server.

                      When I redeploy the ejb module, it still thrown this exception:

                       

                       

                      23:08:38,879 FINE  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-2) Server is starting.

                      23:08:38,879 FINE  [org.apache.cxf.transport.servlet.ServletDestination] (MSC service thread 1-2) registering incoming observer: org.apache.cxf.transport.ChainInitiationObserver@49dc730d

                      23:08:38,879 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": o

                      rg.jboss.msc.service.StartException in service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": Failed to start service

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]

                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]

                              at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

                      Caused by: java.lang.NoClassDefFoundError: org/hibernate/search/util/impl/DelegateNamedAnalyzer

                              at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:365)

                              at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:222)

                              at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:146)

                              at org.hibernate.search.event.impl.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:130)

                              at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:83)

                              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:303)

                              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)

                              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)

                              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)

                              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)

                              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)

                              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

                              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                              ... 3 more

                      Caused by: java.lang.ClassNotFoundException: org.hibernate.search.util.impl.DelegateNamedAnalyzer from [Module "deployment.ForestSurf-ear-1.0.ear:main" from Service Module Loader]

                              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

                              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

                              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

                              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]

                              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]

                              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

                              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

                              at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [rt.jar:1.6.0_07]

                       

                       

                      Here is the jar files:

                      -rw-r--r--  1 jboss  jboss    81271 Jan 22 22:52 hibernate-commons-annotations-4.0.1.Final.jar

                      -rw-r--r--  1 jboss  jboss      487 Jan 22 23:06 hibernate-commons-annotations-4.0.1.Final.jar.index

                      -rw-r--r--  1 jboss  jboss  4507245 Jan 22 22:52 hibernate-core-4.1.9.Final.jar

                      -rw-r--r--  1 jboss  jboss     6159 Jan 22 23:06 hibernate-core-4.1.9.Final.jar.index

                      -rw-r--r--  1 jboss  jboss   479539 Jan 22 22:53 hibernate-entitymanager-4.1.9.Final.jar

                      -rw-r--r--  1 jboss  jboss      527 Jan 22 23:06 hibernate-entitymanager-4.1.9.Final.jar.index

                      -rw-r--r--  1 jboss  jboss    62411 Jan 22 22:53 hibernate-infinispan-4.1.9.Final.jar

                      -rw-r--r--  1 jboss  jboss      479 Jan 22 23:06 hibernate-infinispan-4.1.9.Final.jar.index

                      -rw-r--r--  1 jboss  jboss     2277 Jan 22 22:54 hibernate-search-4.2.0.Final.jar

                      -rw-r--r--  1 jboss  jboss      100 Jan 22 23:06 hibernate-search-4.2.0.Final.jar.index

                       

                       

                      There is one problem I still could not resolve, that is when I compiled the module in Netbeans under Windows, it uses the old libs. I don't know how to add all new libs to netbeans configuration.

                      Thanks

                      Sam

                      • 8. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                        Nicklas Karlsson Master

                        What does your hibernate core module.xml look like?

                        • 9. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                          Sam W Expert

                          Here is the ~/jboss711Final/modules/org/hibernate/main/module.xml file:

                           

                           

                          cat module.xml

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

                           

                          <!-- Represents the Hibernate 4.0.x module-->

                          <module xmlns="urn:jboss:module:1.1" name="org.hibernate">

                              <resources>

                                  <resource-root path="hibernate-core-4.1.9.Final.jar"/>

                                  <resource-root path="hibernate-commons-annotations-4.0.1.Final.jar"/>

                                  <resource-root path="hibernate-entitymanager-4.1.9.Final.jar"/>

                                  <resource-root path="hibernate-infinispan-4.1.9.Final.jar"/>

                                  <resource-root path="hibernate-search-4.2.0.Final.jar"/>

                                  <!-- Insert resources here -->

                              </resources>

                           

                           

                              <dependencies>

                                  <module name="asm.asm"/>

                                  <module name="javax.api"/>

                                  <module name="javax.persistence.api"/>

                                  <module name="javax.transaction.api"/>

                                  <module name="javax.validation.api"/>

                                  <module name="org.antlr"/>

                                  <module name="org.apache.commons.collections"/>

                                  <module name="org.dom4j"/>

                                  <module name="org.infinispan" optional="true"/>

                                  <module name="org.javassist"/>

                                  <module name="org.jboss.as.jpa.hibernate" slot="4" optional="true"/>

                                  <module name="org.jboss.logging"/>

                                  <module name="org.hibernate.envers" services="import" optional="true"/>

                              </dependencies>

                          </module>

                           

                          • 10. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                            Nicklas Karlsson Master

                            And you no longer have hibernate bundled, right?

                            • 11. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                              Sam W Expert

                              Hi Nick,

                              Which hibernate bundled is missing from the module folder?

                              Thanks

                              Sam

                              • 12. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                                Nicklas Karlsson Master

                                You should examine the WAR file and make sure you have no hibernate modules there in the lib folder.

                                • 13. Re: NoClassDefFoundError: DelegateNamedAnalyzer - Hibernate Search 4.2.0
                                  Sam W Expert

                                  Thank you very much for the help. It works after removed all hibernate* from the lib/ folder.

                                  Now I need to search a way how to do this automatically during compile-time in netbeans.

                                  Thanks a lot.

                                  Sam