2

I was trying to rearrange my pom.xml to resolve some problem in my application and a new error appeared when in run a Maven Install :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [com/bloombooking/spring/PersistenceJPAConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/tool/schema/spi/DelayedDropRegistry 

I don't know how i've messed up with it to create that and i can't find help anywhere... Here is my pom.xml :

<?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.bloombooking</groupId> <artifactId>bloombookingapi</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>bloombookingapi</name> <description></description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.8</java.version> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.2.RELEASE</version> </parent> <dependencies> <!-- Servlet api --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> </dependency> <!-- Spring context --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.3.3.RELEASE</version> </dependency> <!-- Spring orm --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>4.3.3.RELEASE</version> </dependency> <!-- Spring boot web--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- Spring boot test--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- Spring boot jpa--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!-- Spring jersey --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jersey</artifactId> </dependency> <!-- Hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>5.1.0.Final</version> </dependency> <!-- PostgreSQL --> <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.1-901.jdbc4</version> </dependency> <!-- Log4j --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <!-- Junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <!-- Gson --> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.3.1</version> </dependency> <!-- JavaMail --> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.7</version> </dependency> <!-- Jersey Java WS RS --> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.19.2</version> </dependency> <!-- Apache commons codec (for easy SHA256 parsing) --> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.4</version> </dependency> </dependencies> <build> <plugins> <!-- Maven compiler with java 1.8 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> 

Can someone give me some help ? Thanks

6
  • If you're using Spring Boot, is there a particular reason for doing all of that configuration manually instead of just using the JPA starter? Commented Nov 12, 2016 at 22:22
  • What do you mean by "all of that configuration manually" ? Using PersistenceJPAConfig.java ? Commented Nov 12, 2016 at 22:27
  • Yes. That entire class can be replaced by four lines in application.properties, which will also make it easier to inject JDBC connection information at runtime. Commented Nov 12, 2016 at 22:32
  • Ok thanks for the advice, i've done it but the error remain the same. (I've also deleted the class from the first post) Commented Nov 12, 2016 at 22:37
  • Have you done a complete clean and rebuild? Commented Nov 12, 2016 at 22:40

1 Answer 1

2

You don't have to specify dependencies for spring-context,spring-orm and hibernate-entitymanager in you pom.xml as you are using Spring Boot starter web and jpa dependencies which will pull the required jar files. Please cleanup your pom file. Class DelayedDropRegistry for which you are getting NoClassDefFoundError is available in hibernate-core jar file since 5.1 release. Check your local maven repository for the hibernate-core jar files and versions. You can use maven > update project to update dependencies and clean build your project. Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

Thx @abaghel you resolved my problem and even explain what was wrong :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.