Spring启动启动:“创建名称为‘entityManagerFactory’的bean时出错,NoSuchFieldError BEFORE_TRANSACTION_COMPLETION”
好吧,我有一个正在运行的 Spring Boot 项目,但后来我做了......一些事情,现在它不再起作用了。当我尝试启动它时,出现错误:org.springframework.beans.factory.BeanCreationException:创建类路径资源中定义的名称为“entityManagerFactory”的bean时出错[org/springframework/boot/autoconfigure/orm/ jpa/HibernateJpaConfiguration.class]: 调用 init 方法失败;嵌套异常是 java.lang.NoSuchFieldError: BEFORE_TRANSACTION_COMPLETION
通过谷歌搜索“BEFORE_TRANSACTION_COMPLETION”,我发现
这是错误消息的较长版本:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: BEFORE_TRANSACTION_COMPLETION
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.5.jar:2.5.5]
at com.OURCOMPANY.scheduler.SchedulerApplication.main(SchedulerApplication.java:19) [classes/:na]
Caused by: java.lang.NoSuchFieldError: BEFORE_TRANSACTION_COMPLETION
at org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode.<clinit>(PhysicalConnectionHandlingMode.java:48) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.buildJpaPropertyMap(HibernateJpaVendorAdapter.java:160) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.getJpaPropertyMap(HibernateJpaVendorAdapter.java:130) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.10.jar:5.3.10]
... 16 common frames omitted
这是我的 POM,其中显示了我尝试过的内容。
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.OURCOMPANY</groupId>
<artifactId>scheduler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>scheduler</name>
<description>scheduler</description>
<properties>
<java.version>1.8</java.version>
<repackage.classifier/>
<spring-native.version>0.10.4</spring-native.version>
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jdbc</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.oracle.database.jdbc</groupId>-->
<!-- <artifactId>ojdbc8</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-client</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-javaee</artifactId> <!--jboss-javaee.jar-->
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-spi</artifactId> <!--jboss-logging-spi.jar-->
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-remoting</artifactId> <!-- jboss-remoting.jar-->
<version>jboss-5.1.0</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-security-spi</artifactId> <!--jboss-security-spi.jar -->
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-serialization</artifactId> <!--jboss-serialization.jar -->
<version>jboss-5.1.0</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-common-core</artifactId> <!--jboss-common-core.jar-->
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbosssx-client</artifactId> <!--jbosssx-client.jar-->
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jnp-client</artifactId>
<version>4.2.2.GA</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>${repackage.classifier}</classifier>
<image>
<builder>paketobuildpacks/builder:tiny</builder>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
</env>
</image>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.springframework.experimental</groupId>-->
<!-- <artifactId>spring-aot-maven-plugin</artifactId>-->
<!-- <version>${spring-native.version}</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>test-generate</id>-->
<!-- <goals>-->
<!-- <goal>test-generate</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>generate</id>-->
<!-- <goals>-->
<!-- <goal>generate</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.hibernate.orm.tooling</groupId>-->
<!-- <artifactId>hibernate-enhance-maven-plugin</artifactId>-->
<!-- <version>${hibernate.version}</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>enhance</id>-->
<!-- <goals>-->
<!-- <goal>enhance</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <failOnError>true</failOnError>-->
<!-- <enableLazyInitialization>true</enableLazyInitialization>-->
<!-- <enableDirtyTracking>true</enableDirtyTracking>-->
<!-- <enableAssociationManagement>true</enableAssociationManagement>-->
<!-- <enableExtendedEnhancement>false</enableExtendedEnhancement>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
正如您在上面看到的,我注释掉了与 JDBC 或 JPA 或 Hibernate 相关的部分。通过 IntelliJ 我做了 Maven >每次更改后重新加载项目。那么它到底在坚持什么呢?
这个项目甚至根本不需要数据库连接。它只是一个连接到不同项目的调度程序。我最初是通过 IntelliJ 中的某种新的 Spring Boot 项目向导设置了该项目,我认为错误地包含了一些数据库插件或其他东西。但现在我无法让该项目停止寻找数据库的东西。
我想这可能与类路径有关?这是我第一次从头开始创建 Spring Boot 应用程序。
最后,IntelliJ 会弹出这个弹出窗口,推荐一个依赖项 Hibernate Core 插件,我什至不知道我是否包含了该插件。
Okay so I have this Spring Boot project that was working, but then I did.... something and now it won't work any more. When I try to start it up, I get the error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: BEFORE_TRANSACTION_COMPLETION
By googling just "BEFORE_TRANSACTION_COMPLETION", I found this answer elsewhere on this site, but it is not helpful. The only answer says "Incompatible versions of SpringORM and Hibernate, Upgrade your hibernate or downgrade your Spring version." But I can't figure out how to DO that.
Here's the longer version of the error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: BEFORE_TRANSACTION_COMPLETION
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.5.jar:2.5.5]
at com.OURCOMPANY.scheduler.SchedulerApplication.main(SchedulerApplication.java:19) [classes/:na]
Caused by: java.lang.NoSuchFieldError: BEFORE_TRANSACTION_COMPLETION
at org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode.<clinit>(PhysicalConnectionHandlingMode.java:48) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.buildJpaPropertyMap(HibernateJpaVendorAdapter.java:160) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.getJpaPropertyMap(HibernateJpaVendorAdapter.java:130) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.10.jar:5.3.10]
... 16 common frames omitted
Here is my POM which shows a what I've tried.
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.OURCOMPANY</groupId>
<artifactId>scheduler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>scheduler</name>
<description>scheduler</description>
<properties>
<java.version>1.8</java.version>
<repackage.classifier/>
<spring-native.version>0.10.4</spring-native.version>
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jdbc</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.oracle.database.jdbc</groupId>-->
<!-- <artifactId>ojdbc8</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-client</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-javaee</artifactId> <!--jboss-javaee.jar-->
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-spi</artifactId> <!--jboss-logging-spi.jar-->
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-remoting</artifactId> <!-- jboss-remoting.jar-->
<version>jboss-5.1.0</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-security-spi</artifactId> <!--jboss-security-spi.jar -->
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-serialization</artifactId> <!--jboss-serialization.jar -->
<version>jboss-5.1.0</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-common-core</artifactId> <!--jboss-common-core.jar-->
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbosssx-client</artifactId> <!--jbosssx-client.jar-->
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jnp-client</artifactId>
<version>4.2.2.GA</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>${repackage.classifier}</classifier>
<image>
<builder>paketobuildpacks/builder:tiny</builder>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
</env>
</image>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.springframework.experimental</groupId>-->
<!-- <artifactId>spring-aot-maven-plugin</artifactId>-->
<!-- <version>${spring-native.version}</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>test-generate</id>-->
<!-- <goals>-->
<!-- <goal>test-generate</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>generate</id>-->
<!-- <goals>-->
<!-- <goal>generate</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.hibernate.orm.tooling</groupId>-->
<!-- <artifactId>hibernate-enhance-maven-plugin</artifactId>-->
<!-- <version>${hibernate.version}</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>enhance</id>-->
<!-- <goals>-->
<!-- <goal>enhance</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <failOnError>true</failOnError>-->
<!-- <enableLazyInitialization>true</enableLazyInitialization>-->
<!-- <enableDirtyTracking>true</enableDirtyTracking>-->
<!-- <enableAssociationManagement>true</enableAssociationManagement>-->
<!-- <enableExtendedEnhancement>false</enableExtendedEnhancement>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
As you can see above, I commented out portions related to JDBC or JPA or Hibernate. Through IntelliJ I did Maven > Reload Project after each change. So what the heck is it holding on to?
This project doesn't even NEED database connections at all. It's just a scheduler that connects to a different project. I initially set up the project from some kind of new Spring Boot project wizard in IntelliJ and I think mistakenly included some database plugins or something. But now I can't get the project to stop looking for database stuff.
I guess maybe this has something to do with classpath? It's the first time I created a Spring Boot application from scratch.
Lastly, IntelliJ is bringing up this popup, recommending a plugin for a dependency, Hibernate Core, which I'm not aware that I even included.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我想通了。我不敢相信我错过了这个。
我的项目需要一些中央 Maven 存储库中不可用的依赖项,因此我将 JAR 文件从其他项目之一复制到我的 Scheduler 项目的 LIB 文件夹中。我的错误是我对它进行了猛烈攻击,基本上复制了一大堆我不需要的 JAR 文件。我认为,其中大多数只是占用了空间,并没有造成任何真正的伤害。然而,复制 hibernate-core.jar 确实导致了这个问题。我删除了那个 JAR 文件,调度程序开始工作。
我很确定其中还有一些不必要的 JAR 文件,所以我将继续清理。
Okay I figured it out. I can't believe I missed this.
My project required some dependencies that weren't available in central Maven repositories, so I copied the JAR files over from one of our other projects, into the LIB folder of my Scheduler project. My mistake was that I shotgunned it, and basically copied a whole bunch of JAR files I didn't need. Most of these, I think, just took up space and didn't cause any real harm. However, copying hibernate-core.jar DID cause this problem. I got rid of that JAR file and the scheduler started to work.
I'm pretty sure I have some more unnecessary JAR files in there too, so I'm going to continue the cleanup.