java - Error when adding "spring-boot-starter-data-jpa" dependency to Spring project -
i'm practising spring spring tool suite. i've been trying connect project database.
however, whenever add "spring-boot-starter-data-jpa" dependency pom.xml project won't start , following errors. error doesn't occur once remove dependency. have no idea why happening. here following errors:
org.springframework.context.applicationcontextexception: unable start embedded container; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'tomcatembeddedservletcontainerfactory' defined in class path resource [org/springframework/boot/autoconfigure/web/embeddedservletcontainerautoconfiguration$embeddedtomcat.class]: initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'serverproperties' defined in class path resource [org/springframework/boot/autoconfigure/web/serverpropertiesautoconfiguration.class]: initialization of bean failed; nested exception java.lang.noclassdeffounderror: org/hibernate/hibernateexception @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.onrefresh(embeddedwebapplicationcontext.java:137) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:535) ~[spring-context-4.3.3.release.jar:4.3.3.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:761) [spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:371) [spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.springapplication.run(springapplication.java:315) [spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.springapplication.run(springapplication.java:1186) [spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.springapplication.run(springapplication.java:1175) [spring-boot-1.4.1.release.jar:1.4.1.release] @ com.goodvideotutorials.spring.application.main(application.java:27) [classes/:na] caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'tomcatembeddedservletcontainerfactory' defined in class path resource [org/springframework/boot/autoconfigure/web/embeddedservletcontainerautoconfiguration$embeddedtomcat.class]: initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'serverproperties' defined in class path resource [org/springframework/boot/autoconfigure/web/serverpropertiesautoconfiguration.class]: initialization of bean failed; nested exception java.lang.noclassdeffounderror: org/hibernate/hibernateexception @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:553) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:202) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.getembeddedservletcontainerfactory(embeddedwebapplicationcontext.java:199) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.createembeddedservletcontainer(embeddedwebapplicationcontext.java:162) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.onrefresh(embeddedwebapplicationcontext.java:134) ~[spring-boot-1.4.1.release.jar:1.4.1.release] ... 8 common frames omitted caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'serverproperties' defined in class path resource [org/springframework/boot/autoconfigure/web/serverpropertiesautoconfiguration.class]: initialization of bean failed; nested exception java.lang.noclassdeffounderror: org/hibernate/hibernateexception @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:553) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:202) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbeansoftype(defaultlistablebeanfactory.java:509) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.context.support.abstractapplicationcontext.getbeansoftype(abstractapplicationcontext.java:1192) ~[spring-context-4.3.3.release.jar:4.3.3.release] @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.getcustomizers(embeddedservletcontainercustomizerbeanpostprocessor.java:77) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedservletcontainercustomizerbeanpostprocessor.java:67) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedservletcontainercustomizerbeanpostprocessor.java:54) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applybeanpostprocessorsbeforeinitialization(abstractautowirecapablebeanfactory.java:408) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1575) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:545) ~[spring-beans-4.3.3.release.jar:4.3.3.release] ... 16 common frames omitted caused by: java.lang.noclassdeffounderror: org/hibernate/hibernateexception @ java.lang.classloader.defineclass1(native method) ~[na:1.8.0_91] @ java.lang.classloader.defineclass(unknown source) ~[na:1.8.0_91] @ java.security.secureclassloader.defineclass(unknown source) ~[na:1.8.0_91] @ java.net.urlclassloader.defineclass(unknown source) ~[na:1.8.0_91] @ java.net.urlclassloader.access$100(unknown source) ~[na:1.8.0_91] @ java.net.urlclassloader$1.run(unknown source) ~[na:1.8.0_91] @ java.net.urlclassloader$1.run(unknown source) ~[na:1.8.0_91] @ java.security.accesscontroller.doprivileged(native method) ~[na:1.8.0_91] @ java.net.urlclassloader.findclass(unknown source) ~[na:1.8.0_91] @ java.lang.classloader.loadclass(unknown source) ~[na:1.8.0_91] @ sun.misc.launcher$appclassloader.loadclass(unknown source) ~[na:1.8.0_91] @ java.lang.classloader.loadclass(unknown source) ~[na:1.8.0_91] @ org.hibernate.jpa.hibernatepersistenceprovider$1.isloadedwithoutreference(hibernatepersistenceprovider.java:171) ~[hibernate-entitymanager-5.0.11.final.jar:5.0.11.final] @ javax.persistence.persistence$1.isloaded(persistence.java:111) ~[hibernate-jpa-2.1-api-1.0.0.final.jar:1.0.0.final] @ org.hibernate.validator.internal.engine.resolver.jpatraversableresolver.isreachable(jpatraversableresolver.java:46) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.resolver.defaulttraversableresolver.isreachable(defaulttraversableresolver.java:128) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.resolver.cachingtraversableresolverforsinglevalidation.isreachable(cachingtraversableresolverforsinglevalidation.java:36) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.isreachable(validatorimpl.java:1612) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.isvalidationrequired(validatorimpl.java:1597) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.validatemetaconstraint(validatorimpl.java:609) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.validateconstraint(validatorimpl.java:580) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.validateconstraintsforsingledefaultgroupelement(validatorimpl.java:524) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.validateconstraintsfordefaultgroup(validatorimpl.java:492) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.validateconstraintsforcurrentgroup(validatorimpl.java:457) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.validateincontext(validatorimpl.java:407) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.hibernate.validator.internal.engine.validatorimpl.validate(validatorimpl.java:205) ~[hibernate-validator-5.2.4.final.jar:5.2.4.final] @ org.springframework.validation.beanvalidation.springvalidatoradapter.validate(springvalidatoradapter.java:93) ~[spring-context-4.3.3.release.jar:4.3.3.release] @ org.springframework.validation.databinder.validate(databinder.java:852) ~[spring-context-4.3.3.release.jar:4.3.3.release] @ org.springframework.boot.bind.propertiesconfigurationfactory.validate(propertiesconfigurationfactory.java:367) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.bind.propertiesconfigurationfactory.dobindpropertiestotarget(propertiesconfigurationfactory.java:287) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.bind.propertiesconfigurationfactory.bindpropertiestotarget(propertiesconfigurationfactory.java:256) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.context.properties.configurationpropertiesbindingpostprocessor.postprocessbeforeinitialization(configurationpropertiesbindingpostprocessor.java:346) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.boot.context.properties.configurationpropertiesbindingpostprocessor.postprocessbeforeinitialization(configurationpropertiesbindingpostprocessor.java:302) ~[spring-boot-1.4.1.release.jar:1.4.1.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applybeanpostprocessorsbeforeinitialization(abstractautowirecapablebeanfactory.java:408) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1575) ~[spring-beans-4.3.3.release.jar:4.3.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:545) ~[spring-beans-4.3.3.release.jar:4.3.3.release] ... 29 common frames omitted caused by: java.lang.classnotfoundexception: org.hibernate.hibernateexception @ java.net.urlclassloader.findclass(unknown source) ~[na:1.8.0_91] @ java.lang.classloader.loadclass(unknown source) ~[na:1.8.0_91] @ sun.misc.launcher$appclassloader.loadclass(unknown source) ~[na:1.8.0_91] @ java.lang.classloader.loadclass(unknown source) ~[na:1.8.0_91] ... 65 common frames omitted
here 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> <groupid>com.goodvideotutorials</groupid> <artifactid>spring</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>goodvideotutorials.spring</name> <description>spring 4and spring boot starter</description> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.4.1.release</version> <relativepath/> <!-- lookup parent repository --> </parent> <properties> <start-class>com.goodvideotutorials.spring.application</start-class> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputencoding>utf-8</project.reporting.outputencoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-actuator</artifactid> </dependency> <!-- mail --> <dependency> <groupid>com.sun.mail</groupid> <artifactid>javax.mail</artifactid> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context-support</artifactid> </dependency> <!-- mail ends --> <!-- using jsp --> <dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-jasper</artifactid> <scope>provided</scope> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> </dependency> <!-- using jsp ends --> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> </dependency> <!-- data access --> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-jpa</artifactid> </dependency> <!-- data access ends--> </dependencies> <build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> </plugin> </plugins> </build> </project>
i tried updating maven , validating project error persists.
even encountered same error. process followed below, let try , check whether works out..
just remove below lines pom.xml
org.springframework.boot spring-boot-starter-data-jpa
just downloaded jar link below , added build path of project. http://www.java2s.com/code/jardownload/eclipselink/eclipselink-javax.persistence-2.0.jar.zip
now run maven build. should work out.
Comments
Post a Comment