Adding maven dependency gives a specific error during my spring batch -


i working on batch , face problem. have identified cause of issue not able solve it.

as add dependency in pom start error

the maven dependency

<dependency>     <groupid>org.springframework.data</groupid>     <artifactid>spring-data-jpa</artifactid> </dependency> 

my pom shown below

    <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.edf.fr.batch</groupid>   <artifactid>edf-batch</artifactid>   <version>0.0.1-snapshot</version>    <parent>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-parent</artifactid>         <version>1.5.6.release</version>    </parent>      <properties>         <java.version>1.8</java.version>     </properties>      <dependencies>         <dependency>             <groupid>org.springframework.boot</groupid>             <artifactid>spring-boot-starter-batch</artifactid>         </dependency>         <dependency>             <groupid>org.hsqldb</groupid>             <artifactid>hsqldb</artifactid>         </dependency>         <dependency>             <groupid>postgresql</groupid>             <artifactid>postgresql</artifactid>             <version>9.1-901-1.jdbc4</version>         </dependency>         <dependency>             <groupid>org.springframework.data</groupid>             <artifactid>spring-data-jpa</artifactid>         </dependency>      </dependencies>      <build>         <plugins>             <plugin>                 <groupid>org.springframework.boot</groupid>                 <artifactid>spring-boot-maven-plugin</artifactid>             </plugin>         </plugins>     </build>  </project> 

error

java.lang.noclassdeffounderror: javax/persistence/entitymanagerfactory @ org.springframework.data.jpa.util.beandefinitionutils.(beandefinitionutils.java:53) ~[spring-data-jpa-1.11.6.release.jar:na] @ org.springframework.data.jpa.repository.support.entitymanagerbeandefinitionregistrarpostprocessor.postprocessbeanfactory(entitymanagerbeandefinitionregistrarpostprocessor.java:54) ~[spring-data-jpa-1.11.6.release.jar:na] @ org.springframework.context.support.postprocessorregistrationdelegate.invokebeanfactorypostprocessors(postprocessorregistrationdelegate.java:281) ~[spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.postprocessorregistrationdelegate.invokebeanfactorypostprocessors(postprocessorregistrationdelegate.java:176) ~[spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.abstractapplicationcontext.invokebeanfactorypostprocessors(abstractapplicationcontext.java:687) ~[spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:525) ~[spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:693) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:360) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:303) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:1118) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:1107) [spring-boot-1.5.6.release.jar:1.5.6.release] @ com.edf.fr.batch.marchebatchapplication.main(marchebatchapplication.java:10) [classes/:na] caused by: java.lang.classnotfoundexception: javax.persistence.entitymanagerfactory @ java.net.urlclassloader.findclass(urlclassloader.java:381) ~[na:1.8.0_60] @ java.lang.classloader.loadclass(classloader.java:424) ~[na:1.8.0_60] @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331) ~[na:1.8.0_60] @ java.lang.classloader.loadclass(classloader.java:357) ~[na:1.8.0_60] ... 12 common frames omitted

2017-08-14 16:18:43.676 info 11676 --- [ main] s.c.a.annotationconfigapplicationcontext : closing org.springframework.context.annotation.annotationconfigapplicationcontext@48a242ce: startup date [mon aug 14 16:18:42 cest 2017]; root of context hierarchy 2017-08-14 16:18:43.677 warn 11676 --- [ main] s.c.a.annotationconfigapplicationcontext : exception thrown lifecycleprocessor on context close

java.lang.illegalstateexception: lifecycleprocessor not initialized - call 'refresh' before invoking lifecycle methods via context: org.springframework.context.annotation.annotationconfigapplicationcontext@48a242ce: startup date [mon aug 14 16:18:42 cest 2017]; root of context hierarchy @ org.springframework.context.support.abstractapplicationcontext.getlifecycleprocessor(abstractapplicationcontext.java:427) [spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.abstractapplicationcontext.doclose(abstractapplicationcontext.java:999) [spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.abstractapplicationcontext.close(abstractapplicationcontext.java:958) [spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.boot.springapplication.handlerunfailure(springapplication.java:750) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:314) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:1118) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:1107) [spring-boot-1.5.6.release.jar:1.5.6.release] @ com.edf.fr.batch.marchebatchapplication.main(marchebatchapplication.java:10) [classes/:na]

2017-08-14 16:18:43.678 error 11676 --- [ main] o.s.b.f.s.defaultlistablebeanfactory : destroy method on bean name 'org.springframework.boot.autoconfigure.internalcachingmetadatareaderfactory' threw exception

java.lang.illegalstateexception: applicationeventmulticaster not initialized - call 'refresh' before multicasting events via context: org.springframework.context.annotation.annotationconfigapplicationcontext@48a242ce: startup date [mon aug 14 16:18:42 cest 2017]; root of context hierarchy @ org.springframework.context.support.abstractapplicationcontext.getapplicationeventmulticaster(abstractapplicationcontext.java:414) [spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.applicationlistenerdetector.postprocessbeforedestruction(applicationlistenerdetector.java:97) ~[spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.beans.factory.support.disposablebeanadapter.destroy(disposablebeanadapter.java:253) ~[spring-beans-4.3.10.release.jar:4.3.10.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroybean(defaultsingletonbeanregistry.java:578) [spring-beans-4.3.10.release.jar:4.3.10.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingleton(defaultsingletonbeanregistry.java:554) [spring-beans-4.3.10.release.jar:4.3.10.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingleton(defaultlistablebeanfactory.java:961) [spring-beans-4.3.10.release.jar:4.3.10.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingletons(defaultsingletonbeanregistry.java:523) [spring-beans-4.3.10.release.jar:4.3.10.release] @ org.springframework.beans.factory.support.factorybeanregistrysupport.destroysingletons(factorybeanregistrysupport.java:230) [spring-beans-4.3.10.release.jar:4.3.10.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingletons(defaultlistablebeanfactory.java:968) [spring-beans-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:1030) [spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.abstractapplicationcontext.doclose(abstractapplicationcontext.java:1006) [spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.context.support.abstractapplicationcontext.close(abstractapplicationcontext.java:958) [spring-context-4.3.10.release.jar:4.3.10.release] @ org.springframework.boot.springapplication.handlerunfailure(springapplication.java:750) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:314) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:1118) [spring-boot-1.5.6.release.jar:1.5.6.release] @ org.springframework.boot.springapplication.run(springapplication.java:1107) [spring-boot-1.5.6.release.jar:1.5.6.release] @ com.edf.fr.batch.marchebatchapplication.main(marchebatchapplication.java:10) [classes/:na]

from given stacktrace can see classes not found, since using spring boot, spring boot uses meta dependencies contains several dependencies, mentioned in spring-boot-cookbook

spring boot aims simplify process of getting started application creation. spring boot starters bootstrap libraries contain collection of relevant transitive dependencies needed start particular functionality

spring-data-jpa not enough, there other dependencies need, use spring-boot-starter-data-jpa

<dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-data-jpa</artifactid> </dependency> 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -