当前位置: 首页 > 知识库问答 >
问题:

将spring boot 1.5.10迁移到spring boot 2.0.3

蓬威
2023-03-14

我正在将一个项目从spring Boot1.5.10迁移到spring Boot2.0.3,我安装了依赖项“spring-boot-properties-migrator”,它告诉我属性改变了,一切都很好,但现在我出现了这个错误,我不知道如何修复它,我尝试了所有的方法。

上下文初始化过程中遇到异常-取消刷新尝试:org.springframework.beans.factory.beanCreationException:创建类路径资源[org/springframework/boot/autocconfigure/orm/jpa/hibernatejpaconfiguration.class]中定义的名为“Entity ManagerFactory”的bean时出错:调用init方法失败;嵌套异常为java.lang.NoSuchMethoderRror:org.hibernate.engine.spi.sessionFactoryImplementor.getProperties()ljava/util/properties;

org.springframework.beans.factory.beanCreationException:创建类路径资源[org/springframework/boot/autocconfigure/orm/jpa/hibernatejpaconfiguration.class]中定义的名为“Entity ManagerFactory”的bean时出错:调用init方法失败;嵌套异常为java.lang.NoSuchMethoderRror:org.hibernate.engine.spi.sessionFactoryImplementor.getProperties()ljava/util/properties;

原因:java.lang.nosuchmethoderror:org.hibernate.engine.spi.sessionFactoryImplementor.getProperties()ljava/util/properties;

config.properties
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=test
spring.datasource.password=test
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy

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.example</groupId>
    <artifactId>hello</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>hello</name>
    <description>hello website</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <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-properties-migrator</artifactId>
            <scope>runtime</scope>
        </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-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!-- hot swapping, disable cache for template, enable live reload -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time-jsptags</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time-hibernate</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.jadira.usertype</groupId>
            <artifactId>usertype.core</artifactId>
            <version>5.0.0.GA</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity4</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox</artifactId>
            <version>2.0.9</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-tools</artifactId>
            <version>2.0.9</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.bytedeco.javacpp-presets</groupId>
            <artifactId>tesseract-platform</artifactId>
            <version>3.05.01-1.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>com.mailjet</groupId>
            <artifactId>mailjet-client</artifactId>
            <version>4.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.5</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

[INFO] com.example:hello:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-properties-migrator:jar:2.0.3.RELEASE:runtime
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.0.3.RELEASE:compile
[INFO] |  \- org.springframework.boot:spring-boot-configuration-metadata:jar:2.0.3.RELEASE:runtime
[INFO] |     \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.0.3.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.0.3.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.3.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.19:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.3.RELEASE:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:2.7.9:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:5.0.7.RELEASE:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.2.17.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.2.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.22.0-GA:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.0.3.Final:compile
[INFO] |  |  +- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.0.8.RELEASE:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:2.0.8.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-orm:jar:5.0.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-tx:jar:5.0.7.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.0.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.0.3.RELEASE:compile
[INFO] |  +- org.thymeleaf:thymeleaf-spring5:jar:3.0.9.RELEASE:compile
[INFO] |  |  \- org.thymeleaf:thymeleaf:jar:3.0.9.RELEASE:compile
[INFO] |  |     +- org.attoparser:attoparser:jar:2.0.4.RELEASE:compile
[INFO] |  |     \- org.unbescape:unbescape:jar:1.1.5.RELEASE:compile
[INFO] |  \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.0.7.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:5.0.6.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-core:jar:5.0.6.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-web:jar:5.0.6.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.0.3.RELEASE:compile (optional) 
[INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.0.3.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.0.3.RELEASE:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.6:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.6:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.3.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.31:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.31:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.31:compile
[INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.10.Final:compile
[INFO] |  |  \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  +- org.springframework:spring-web:jar:5.0.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:5.0.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:5.0.7.RELEASE:compile
[INFO] |  \- com.sun.mail:javax.mail:jar:1.6.1:compile
[INFO] |     \- javax.activation:activation:jar:1.1:compile
[INFO] +- joda-time:joda-time:jar:2.9.9:compile
[INFO] +- joda-time:joda-time-jsptags:jar:1.1.1:compile
[INFO] +- joda-time:joda-time-hibernate:jar:1.4:compile
[INFO] +- org.jadira.usertype:usertype.core:jar:5.0.0.GA:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:5.2.17.Final:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.7.11:compile
[INFO] |  |  \- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.1.Final:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] |  \- org.jadira.usertype:usertype.spi:jar:5.0.0.GA:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.46:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.3.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.0.3.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.3.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] |  +- junit:junit:jar:4.12:compile
[INFO] |  +- org.assertj:assertj-core:jar:3.9.1:test
[INFO] |  +- org.mockito:mockito-core:jar:2.15.0:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.7.11:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.6:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  +- org.springframework:spring-core:jar:5.0.7.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.0.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-test:jar:5.0.7.RELEASE:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.5.1:test
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity4:jar:3.0.2.RELEASE:compile
[INFO] +- org.apache.pdfbox:pdfbox:jar:2.0.9:compile
[INFO] |  +- org.apache.pdfbox:fontbox:jar:2.0.9:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.apache.pdfbox:pdfbox-tools:jar:2.0.9:compile
[INFO] |  \- org.apache.pdfbox:pdfbox-debugger:jar:2.0.9:compile
[INFO] +- commons-io:commons-io:jar:2.6:compile
[INFO] +- org.bytedeco.javacpp-presets:tesseract-platform:jar:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:leptonica-platform:jar:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:android-arm:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:android-arm64:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:android-x86:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:android-x86_64:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:linux-x86:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:linux-x86_64:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:linux-armhf:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:linux-ppc64le:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:macosx-x86_64:1.75.3-1.4.1:compile
[INFO] |  |  +- org.bytedeco.javacpp-presets:leptonica:jar:windows-x86:1.75.3-1.4.1:compile
[INFO] |  |  \- org.bytedeco.javacpp-presets:leptonica:jar:windows-x86_64:1.75.3-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:3.05.01-1.4.1:compile
[INFO] |  |  \- org.bytedeco:javacpp:jar:1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:android-arm:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:android-arm64:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:android-x86:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:android-x86_64:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:linux-x86:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:linux-x86_64:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:linux-armhf:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:linux-ppc64le:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:macosx-x86_64:3.05.01-1.4.1:compile
[INFO] |  +- org.bytedeco.javacpp-presets:tesseract:jar:windows-x86:3.05.01-1.4.1:compile
[INFO] |  \- org.bytedeco.javacpp-presets:tesseract:jar:windows-x86_64:3.05.01-1.4.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-aop:jar:2.0.3.RELEASE:compile
[INFO] |  \- org.aspectj:aspectjweaver:jar:1.8.13:compile
[INFO] +- com.mailjet:mailjet-client:jar:4.1.1:compile
[INFO] |  +- com.turbomanage.basic-http-client:http-client-java:jar:0.89:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] |  \- org.json:json:jar:20140107:compile
[INFO] +- org.springframework.boot:spring-boot-starter-amqp:jar:2.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-messaging:jar:5.0.7.RELEASE:compile
[INFO] |  \- org.springframework.amqp:spring-rabbit:jar:2.0.4.RELEASE:compile
[INFO] |     +- org.springframework.amqp:spring-amqp:jar:2.0.4.RELEASE:compile
[INFO] |     +- com.rabbitmq:amqp-client:jar:5.1.2:compile
[INFO] |     \- org.springframework.retry:spring-retry:jar:1.2.2.RELEASE:compile
[INFO] \- com.google.code.gson:gson:jar:2.8.5:compile

共有1个答案

常海
2023-03-14

我使用的是Jadira5.0,但它只支持Hibernate5.0。Boot2.0需要Hibernate 5.2。

 类似资料:
  • 我正在使用OpenJDK 12中的Nashorn JS引擎。纳肖恩似乎遭到了反对。我正在寻找可用的替代方案。我找到了GraalVM,但我不确定这是不是最好的。如何从Java执行GraalVM JavaScript?你有什么例子吗? Nashorn用的是Java: 在Nashorn中,我创建了一个WrappedMongoDatabase,它扩展了AbstractJSObject。在那里,我添加了一些

  • 问题内容: 将Express.js从版本2更新到了版本3,以下调用中断了,因为它不再存在于V3中: 有一个迁移指南说: (使用中间件+ res.locals) 但是我很困惑如何做到这一点。是否有一个更具体的示例说明如何进行迁移? 相关的SO post: Node.js Express3.0 问题答案: 我有同样的问题 session.user ,只是通过了解该app.use功能必须是固定的, 在

  • 我正试图从maven迁移到gradle,但CheckStyle出现了一个奇怪的错误。 这是我得到的错误 如何让gradle使用最新版本的CheckStyle?值得注意的是,我的使用了maven checkstyle 6.10.1和6.8

  • 我要迁移一个JavaApplet通过JNLP启动,作为一个Java的Web Start应用程序,并遇到一些麻烦/误解... 我得到的资源之一是这样的:6迁移JavaAppletJavaWeb Start和JNLP: 让我们开始吧,但是: 目前,该应用程序是一个小程序(),过去是通过将小程序标记嵌入到HTML中来启动的,小程序标记指的是JNLP。 现在,由于所有浏览器都放弃了对小程序的支持,我应该将

  • Angular 是使用 TypeScript 构建的,并且支持向 Angular 提供元信息的装饰器。 TypeScript 的装饰器会让语法感觉更加“自然”,尽管有可能使用 Angular 没有的功能。

  • 我需要将phpBB3用户迁移到Drupal7。用户必须能够使用他们的phpBB用户名/密码组合在Drupal中进行身份验证。 有没有办法把密码翻译成Drupal7格式?

  • Redux 不是一个单一的框架,而是一系列的约定和一些让他们协同工作的函数。你的 Redux 项目的主体代码甚至不需要使用 Redux 的 API,大部分时间你其实是在编写函数。 这让到 Redux 的双向迁移都非常的容易。 我们可不想把你限制得死死的! 从 Flux 项目迁移 Reducer 抓住了 Flux Store 的本质,因此,将一个 Flux 项目逐步到 Redux 是可行的,无论你使