ejb 3.1 - java.lang.NoClassDefFoundError: org/hibernate/service/ServiceRegistry -


i using hibernate-search 5.5.4.final hibernate-entitymanager 5.0.9 (matched hibernate-core 5.0.9). when deployed ejb maven module on glassfish 4.1. obtained following exception:

grave:   java.lang.noclassdeffounderror: org/hibernate/service/serviceregistry     @ org.hibernate.jpa.boot.spi.bootstrap.getentitymanagerfactorybuilder(bootstrap.java:34)     @ org.hibernate.jpa.hibernatepersistenceprovider.getentitymanagerfactorybuilder(hibernatepersistenceprovider.java:165)     @ org.hibernate.jpa.hibernatepersistenceprovider.getentitymanagerfactorybuilder(hibernatepersistenceprovider.java:160)     @ org.hibernate.jpa.hibernatepersistenceprovider.createcontainerentitymanagerfactory(hibernatepersistenceprovider.java:135)     @ org.glassfish.persistence.jpa.persistenceunitloader.loadpu(persistenceunitloader.java:199)     @ org.glassfish.persistence.jpa.persistenceunitloader.<init>(persistenceunitloader.java:107)     @ org.glassfish.persistence.jpa.jpadeployer$1.visitpud(jpadeployer.java:223)     @ org.glassfish.persistence.jpa.jpadeployer$persistenceunitdescriptoriterator.iteratepuds(jpadeployer.java:510)     @ org.glassfish.persistence.jpa.jpadeployer.createemfs(jpadeployer.java:230)     @ org.glassfish.persistence.jpa.jpadeployer.prepare(jpadeployer.java:168)     @ com.sun.enterprise.v3.server.applicationlifecycle.preparemodule(applicationlifecycle.java:925)     @ com.sun.enterprise.v3.server.applicationlifecycle.deploy(applicationlifecycle.java:434)     @ com.sun.enterprise.v3.server.applicationlifecycle.deploy(applicationlifecycle.java:219)     @ org.glassfish.deployment.admin.deploycommand.execute(deploycommand.java:491)     @ com.sun.enterprise.v3.admin.commandrunnerimpl$2$1.run(commandrunnerimpl.java:539)     @ com.sun.enterprise.v3.admin.commandrunnerimpl$2$1.run(commandrunnerimpl.java:535)     @ java.security.accesscontroller.doprivileged(native method)     @ javax.security.auth.subject.doas(subject.java:360)     @ com.sun.enterprise.v3.admin.commandrunnerimpl$2.execute(commandrunnerimpl.java:534)     @ com.sun.enterprise.v3.admin.commandrunnerimpl$3.run(commandrunnerimpl.java:565)     @ com.sun.enterprise.v3.admin.commandrunnerimpl$3.run(commandrunnerimpl.java:557)     @ java.security.accesscontroller.doprivileged(native method)     @ javax.security.auth.subject.doas(subject.java:360)     @ com.sun.enterprise.v3.admin.commandrunnerimpl.docommand(commandrunnerimpl.java:556)     @ com.sun.enterprise.v3.admin.commandrunnerimpl.docommand(commandrunnerimpl.java:1464)     @ com.sun.enterprise.v3.admin.commandrunnerimpl.access$1300(commandrunnerimpl.java:109)     @ com.sun.enterprise.v3.admin.commandrunnerimpl$executioncontext.execute(commandrunnerimpl.java:1846)     @ com.sun.enterprise.v3.admin.commandrunnerimpl$executioncontext.execute(commandrunnerimpl.java:1722)     @ com.sun.enterprise.v3.admin.adminadapter.docommand(adminadapter.java:534)     @ com.sun.enterprise.v3.admin.adminadapter.onmissingresource(adminadapter.java:224)     @ org.glassfish.grizzly.http.server.statichttphandlerbase.service(statichttphandlerbase.java:189)     @ com.sun.enterprise.v3.services.impl.containermapper$httphandlercallable.call(containermapper.java:459)     @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:167)     @ org.glassfish.grizzly.http.server.httphandler.runservice(httphandler.java:201)     @ org.glassfish.grizzly.http.server.httphandler.dohandle(httphandler.java:175)     @ org.glassfish.grizzly.http.server.httpserverfilter.handleread(httpserverfilter.java:235)     @ org.glassfish.grizzly.filterchain.executorresolver$9.execute(executorresolver.java:119)     @ org.glassfish.grizzly.filterchain.defaultfilterchain.executefilter(defaultfilterchain.java:284)     @ org.glassfish.grizzly.filterchain.defaultfilterchain.executechainpart(defaultfilterchain.java:201)     @ org.glassfish.grizzly.filterchain.defaultfilterchain.execute(defaultfilterchain.java:133)     @ org.glassfish.grizzly.filterchain.defaultfilterchain.process(defaultfilterchain.java:112)     @ org.glassfish.grizzly.processorexecutor.execute(processorexecutor.java:77)     @ org.glassfish.grizzly.nio.transport.tcpniotransport.fireioevent(tcpniotransport.java:561)     @ org.glassfish.grizzly.strategies.abstractiostrategy.fireioevent(abstractiostrategy.java:112)     @ org.glassfish.grizzly.strategies.workerthreadiostrategy.run0(workerthreadiostrategy.java:117)     @ org.glassfish.grizzly.strategies.workerthreadiostrategy.access$100(workerthreadiostrategy.java:56)     @ org.glassfish.grizzly.strategies.workerthreadiostrategy$workerthreadrunnable.run(workerthreadiostrategy.java:137)     @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.dowork(abstractthreadpool.java:565)     @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.run(abstractthreadpool.java:545)     @ java.lang.thread.run(thread.java:745) caused by: java.lang.classnotfoundexception: org.hibernate.service.serviceregistry     @ java.net.urlclassloader.findclass(urlclassloader.java:381)     @ com.sun.enterprise.v3.server.applibclassloaderserviceimpl$urlclassfinder.findclass(applibclassloaderserviceimpl.java:168)     @ java.lang.classloader.loadclass(classloader.java:424)     @ java.lang.classloader.loadclass(classloader.java:357) 

i checked class exists on hibernate core. pom file has correct configuration according official website hibernate search started

the pom configuration following

<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>      <groupid>com.sergio.sanchez</groupid>     <artifactid>ejercicio4mb-ejb</artifactid>     <version>1.0-snapshot</version>     <packaging>ejb</packaging>      <name>ejercicio4mb-ejb</name>      <properties>         <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>         <project.build.sourceencoding>utf-8</project.build.sourceencoding>         <hibernate.version>5.0.9.final</hibernate.version>         <hibernate.search.version>5.5.4.final</hibernate.search.version>     </properties>      <dependencies>         <dependency>             <groupid>javax</groupid>             <artifactid>javaee-api</artifactid>             <version>7.0</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-search-orm</artifactid>             <version>${hibernate.search.version}</version>         </dependency>         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-entitymanager</artifactid>             <version>${hibernate.version}</version>         </dependency>     </dependencies>      <build>         <plugins>             <plugin>                 <artifactid>maven-assembly-plugin</artifactid>                 <executions>                   <execution>                     <phase>package</phase>                     <goals>                       <goal>single</goal>                     </goals>                   </execution>                 </executions>                 <configuration>                   <descriptorrefs>                     <descriptorref>jar-with-dependencies</descriptorref>                   </descriptorrefs>                 </configuration>              </plugin>             <plugin>                 <groupid>org.apache.maven.plugins</groupid>                 <artifactid>maven-compiler-plugin</artifactid>                 <version>3.1</version>                 <configuration>                     <source>1.7</source>                     <target>1.7</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.6</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>7.0</version>                                     <type>jar</type>                                 </artifactitem>                             </artifactitems>                         </configuration>                     </execution>                 </executions>             </plugin>         </plugins>     </build> </project> 

dependencies tree

it means class org.hibernate.service not found in web-inf\lib folder of war of web application. miss out on hibernate-core add inside pom.xml

<dependency>     <groupid>org.hibernate</groupid>     <artifactid>hibernate-core</artifactid>     <version>5.2.2.final</version> </dependency> 

Comments