Синтаксическая ошибка SQL в модульных тестах, после обновления с Spring Boot 1.5.21 до 2.3.4

#java #postgresql #spring-boot #testing #database-migration

#java #postgresql #spring-boot #тестирование #база данных-миграция

Вопрос:

Существует приложение, написанное с Spring Boot 1.5.21. Меня попросили обновить его до версии Spring Boot 2.3.4 и исправить ошибки, вызванные обновлением. По-видимому, это пошло не очень хорошо, так как я всего лишь новичок во многих вещах. Я смог устранить некоторые ошибки из-за изменений зависимостей с помощью поиска в Google. Но то, о чем я собираюсь спросить, заняло у меня несколько часов, а я так и не увидел ни малейшего намека на это.

Непосредственно это сообщение об ошибке, отображаемое IntelliJ:

 Migration V1.0.0__20170401_Create_initial_tables.sql failed
-----------------------------------------------------------
SQL State  : 42000
Error Code : 42000
Message    : Syntax error in SQL statement "ALTER SEQUENCE ACCOUNT_ACCOUNT_ID_SEQ OWNED[*] BY ACCOUNT.ACCOUNT_ID"; SQL statement:
ALTER SEQUENCE account_account_id_seq OWNED BY account.account_id [42000-200]
Location   : db/migration/V1.0.0__20170401_Create_initial_tables.sql (/Users/pei/Documents/workspace/gmark-entry/gmark-entry-common/target/classes/db/migration/V1.0.0__20170401_Create_initial_tables.sql)
Line       : 56
Statement  : ALTER SEQUENCE account_account_id_seq OWNED BY account.account_id
  

Существует 180 тестов в нескольких тестовых классах. С Spring Boot 1.5.21 все они проходят без ошибок, и теперь 28 из них завершились с тем же сообщением об ошибке, что и выше, с Spring Boot 2.3.4.

Вот мое понимание на данный момент. Приложение использует PostgreSQL и src/main/resources/db.migration/V1.0.0__20170401_Create_initial_tables.sql написано с использованием синтаксиса PostgreSQL, особенно OWNED в строке

 ALTER SEQUENCE account_account_id_seq OWNED BY account.account_id
  

как указано в сообщении об ошибке. Похоже, что база данных — это не PostgreSQL, а H2, когда Spring Boot запускает тесты, и H2 не смог понять синтаксис PostgreSQL (диалект?).

Но почему эта ошибка не появляется при загрузке Spring Boot 1.5.21? И как мне это исправить?

Что-то еще, что я нашел до сих пор: ошибка не имеет ничего общего с каждым тестовым примером, но происходит до достижения тестового примера. Это подтверждается простой установкой точки останова в начале тестового примера и его отладкой. Более того, если я закомментирую @RunWith(SpringRunner.class) аннотацию тестового класса, синтаксическая ошибка при миграции больше не появляется, и тело тестового примера достигнуто, но, по-видимому, что-то не инициализировано правильно, и тест по-прежнему завершается ошибкой с другой ошибкой

 /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=51525:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/lib/tools.jar:/Users/pei/Documents/workspace/gmark-entry/gmark-entry-common/target/test-classes:/Users/pei/Documents/workspace/gmark-entry/gmark-entry-common/target/classes:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/2.3.4.RELEASE/spring-boot-starter-data-jpa-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.3.4.RELEASE/spring-boot-starter-aop-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/aspectj/aspectjweaver/1.9.6/aspectjweaver-1.9.6.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.3.4.RELEASE/spring-boot-starter-jdbc-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5.jar:/Users/pei/.m2/repository/org/springframework/spring-jdbc/5.2.9.RELEASE/spring-jdbc-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/Users/pei/.m2/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar:/Users/pei/.m2/repository/org/hibernate/hibernate-core/5.4.21.Final/hibernate-core-5.4.21.Final.jar:/Users/pei/.m2/repository/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA.jar:/Users/pei/.m2/repository/net/bytebuddy/byte-buddy/1.10.14/byte-buddy-1.10.14.jar:/Users/pei/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/pei/.m2/repository/org/jboss/jandex/2.1.3.Final/jandex-2.1.3.Final.jar:/Users/pei/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/Users/pei/.m2/repository/org/dom4j/dom4j/2.1.3/dom4j-2.1.3.jar:/Users/pei/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.1.0.Final/hibernate-commons-annotations-5.1.0.Final.jar:/Users/pei/.m2/repository/org/springframework/data/spring-data-jpa/2.3.4.RELEASE/spring-data-jpa-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/data/spring-data-commons/2.3.4.RELEASE/spring-data-commons-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-orm/5.2.9.RELEASE/spring-orm-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-tx/5.2.9.RELEASE/spring-tx-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/pei/.m2/repository/org/springframework/spring-aspects/5.2.9.RELEASE/spring-aspects-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter-data-redis/2.3.4.RELEASE/spring-boot-starter-data-redis-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter/2.3.4.RELEASE/spring-boot-starter-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot/2.3.4.RELEASE/spring-boot-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.3.4.RELEASE/spring-boot-autoconfigure-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.3.4.RELEASE/spring-boot-starter-logging-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/pei/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/pei/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.13.3/log4j-to-slf4j-2.13.3.jar:/Users/pei/.m2/repository/org/apache/logging/log4j/log4j-api/2.13.3/log4j-api-2.13.3.jar:/Users/pei/.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar:/Users/pei/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/pei/.m2/repository/org/yaml/snakeyaml/1.26/snakeyaml-1.26.jar:/Users/pei/.m2/repository/org/springframework/data/spring-data-redis/2.3.4.RELEASE/spring-data-redis-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/data/spring-data-keyvalue/2.3.4.RELEASE/spring-data-keyvalue-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-oxm/5.2.9.RELEASE/spring-oxm-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/io/lettuce/lettuce-core/5.3.4.RELEASE/lettuce-core-5.3.4.RELEASE.jar:/Users/pei/.m2/repository/io/netty/netty-common/4.1.52.Final/netty-common-4.1.52.Final.jar:/Users/pei/.m2/repository/io/netty/netty-handler/4.1.52.Final/netty-handler-4.1.52.Final.jar:/Users/pei/.m2/repository/io/netty/netty-resolver/4.1.52.Final/netty-resolver-4.1.52.Final.jar:/Users/pei/.m2/repository/io/netty/netty-buffer/4.1.52.Final/netty-buffer-4.1.52.Final.jar:/Users/pei/.m2/repository/io/netty/netty-codec/4.1.52.Final/netty-codec-4.1.52.Final.jar:/Users/pei/.m2/repository/io/netty/netty-transport/4.1.52.Final/netty-transport-4.1.52.Final.jar:/Users/pei/.m2/repository/io/projectreactor/reactor-core/3.3.10.RELEASE/reactor-core-3.3.10.RELEASE.jar:/Users/pei/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter-mail/2.3.4.RELEASE/spring-boot-starter-mail-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-context-support/5.2.9.RELEASE/spring-context-support-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/Users/pei/.m2/repository/com/sun/activation/jakarta.activation/1.2.2/jakarta.activation-1.2.2.jar:/Users/pei/.m2/repository/org/springframework/spring-webmvc/5.2.9.RELEASE/spring-webmvc-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-aop/5.2.9.RELEASE/spring-aop-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-beans/5.2.9.RELEASE/spring-beans-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-context/5.2.9.RELEASE/spring-context-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-core/5.2.9.RELEASE/spring-core-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-jcl/5.2.9.RELEASE/spring-jcl-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-expression/5.2.9.RELEASE/spring-expression-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/spring-web/5.2.9.RELEASE/spring-web-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/security/spring-security-core/5.3.4.RELEASE/spring-security-core-5.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/session/spring-session-data-redis/2.3.1.RELEASE/spring-session-data-redis-2.3.1.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/session/spring-session-core/2.3.1.RELEASE/spring-session-core-2.3.1.RELEASE.jar:/Users/pei/.m2/repository/org/hibernate/hibernate-java8/5.4.21.Final/hibernate-java8-5.4.21.Final.jar:/Users/pei/.m2/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar:/Users/pei/.m2/repository/org/hibernate/hibernate-jpamodelgen/5.4.21.Final/hibernate-jpamodelgen-5.4.21.Final.jar:/Users/pei/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar:/Users/pei/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/Users/pei/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3/jaxb-runtime-2.3.3.jar:/Users/pei/.m2/repository/org/glassfish/jaxb/txw2/2.3.3/txw2-2.3.3.jar:/Users/pei/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.11/istack-commons-runtime-3.0.11.jar:/Users/pei/.m2/repository/org/freemarker/freemarker/2.3.30/freemarker-2.3.30.jar:/Users/pei/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.11.2/jackson-databind-2.11.2.jar:/Users/pei/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.11.2/jackson-annotations-2.11.2.jar:/Users/pei/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.11.2/jackson-core-2.11.2.jar:/Users/pei/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-hibernate5/2.11.2/jackson-datatype-hibernate5-2.11.2.jar:/Users/pei/.m2/repository/javax/transaction/javax.transaction-api/1.3/javax.transaction-api-1.3.jar:/Users/pei/.m2/repository/joda-time/joda-time/2.10.6/joda-time-2.10.6.jar:/Users/pei/.m2/repository/com/mortennobel/java-image-scaling/0.8.6/java-image-scaling-0.8.6.jar:/Users/pei/.m2/repository/com/jhlabs/filters/2.0.235/filters-2.0.235.jar:/Users/pei/.m2/repository/org/bytedeco/javacv-platform/1.4/javacv-platform-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacv/1.4/javacv-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp/1.4/javacpp-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flycapture/2.11.3.121-1.4/flycapture-2.11.3.121-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect2/0.2.0-1.4/libfreenect2-0.2.0-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/librealsense/1.12.1-1.4/librealsense-1.12.1-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/videoinput/0.200-1.4/videoinput-0.200-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv-platform/3.4.0-1.4/opencv-platform-3.4.0-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-android-arm.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-android-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-linux-armhf.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-linux-ppc64le.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg-platform/3.4.1-1.4/ffmpeg-platform-3.4.1-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-android-arm.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-android-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-linux-armhf.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-linux-ppc64le.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flycapture-platform/2.11.3.121-1.4/flycapture-platform-2.11.3.121-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flycapture/2.11.3.121-1.4/flycapture-2.11.3.121-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flycapture/2.11.3.121-1.4/flycapture-2.11.3.121-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flycapture/2.11.3.121-1.4/flycapture-2.11.3.121-1.4-linux-armhf.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flycapture/2.11.3.121-1.4/flycapture-2.11.3.121-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flycapture/2.11.3.121-1.4/flycapture-2.11.3.121-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394-platform/2.2.5-1.4/libdc1394-platform-2.2.5-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4-linux-armhf.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4-linux-ppc64le.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libdc1394/2.2.5-1.4/libdc1394-2.2.5-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect-platform/0.5.3-1.4/libfreenect-platform-0.5.3-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4-linux-armhf.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4-linux-ppc64le.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect/0.5.3-1.4/libfreenect-0.5.3-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect2-platform/0.2.0-1.4/libfreenect2-platform-0.2.0-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect2/0.2.0-1.4/libfreenect2-0.2.0-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect2/0.2.0-1.4/libfreenect2-0.2.0-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect2/0.2.0-1.4/libfreenect2-0.2.0-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/libfreenect2/0.2.0-1.4/libfreenect2-0.2.0-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/librealsense-platform/1.12.1-1.4/librealsense-platform-1.12.1-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/librealsense/1.12.1-1.4/librealsense-1.12.1-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/librealsense/1.12.1-1.4/librealsense-1.12.1-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/librealsense/1.12.1-1.4/librealsense-1.12.1-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/librealsense/1.12.1-1.4/librealsense-1.12.1-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/librealsense/1.12.1-1.4/librealsense-1.12.1-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/videoinput-platform/0.200-1.4/videoinput-platform-0.200-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/videoinput/0.200-1.4/videoinput-0.200-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/videoinput/0.200-1.4/videoinput-0.200-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus-platform/2.3.1-1.4/artoolkitplus-platform-2.3.1-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-android-arm.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-android-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-linux-armhf.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-linux-ppc64le.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/artoolkitplus/2.3.1-1.4/artoolkitplus-2.3.1-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark-platform/1.07-1.4/flandmark-platform-1.07-1.4.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-android-arm.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-android-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-linux-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-linux-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-linux-armhf.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-linux-ppc64le.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-macosx-x86_64.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-windows-x86.jar:/Users/pei/.m2/repository/org/bytedeco/javacpp-presets/flandmark/1.07-1.4/flandmark-1.07-1.4-windows-x86_64.jar:/Users/pei/.m2/repository/org/flywaydb/flyway-core/6.4.4/flyway-core-6.4.4.jar:/Users/pei/.m2/repository/org/apache/pdfbox/pdfbox-tools/2.0.8/pdfbox-tools-2.0.8.jar:/Users/pei/.m2/repository/org/apache/pdfbox/pdfbox-debugger/2.0.8/pdfbox-debugger-2.0.8.jar:/Users/pei/.m2/repository/org/apache/pdfbox/pdfbox/2.0.8/pdfbox-2.0.8.jar:/Users/pei/.m2/repository/org/apache/pdfbox/fontbox/2.0.8/fontbox-2.0.8.jar:/Users/pei/.m2/repository/org/apache/httpcomponents/httpclient/4.5.12/httpclient-4.5.12.jar:/Users/pei/.m2/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar:/Users/pei/.m2/repository/commons-codec/commons-codec/1.14/commons-codec-1.14.jar:/Users/pei/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/Users/pei/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/Users/pei/.m2/repository/commons-validator/commons-validator/1.4.0/commons-validator-1.4.0.jar:/Users/pei/.m2/repository/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar:/Users/pei/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/Users/pei/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/pei/.m2/repository/org/postgresql/postgresql/9.4.1212/postgresql-9.4.1212.jar:/Users/pei/.m2/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar:/Users/pei/.m2/repository/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-starter-test/2.3.4.RELEASE/spring-boot-starter-test-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-test/2.3.4.RELEASE/spring-boot-test-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/org/springframework/boot/spring-boot-test-autoconfigure/2.3.4.RELEASE/spring-boot-test-autoconfigure-2.3.4.RELEASE.jar:/Users/pei/.m2/repository/com/jayway/jsonpath/json-path/2.4.0/json-path-2.4.0.jar:/Users/pei/.m2/repository/net/minidev/json-smart/2.3/json-smart-2.3.jar:/Users/pei/.m2/repository/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar:/Users/pei/.m2/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar:/Users/pei/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:/Users/pei/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar:/Users/pei/.m2/repository/org/assertj/assertj-core/3.16.1/assertj-core-3.16.1.jar:/Users/pei/.m2/repository/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar:/Users/pei/.m2/repository/org/junit/jupiter/junit-jupiter/5.6.2/junit-jupiter-5.6.2.jar:/Users/pei/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.6.2/junit-jupiter-api-5.6.2.jar:/Users/pei/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/Users/pei/.m2/repository/org/junit/platform/junit-platform-commons/1.6.2/junit-platform-commons-1.6.2.jar:/Users/pei/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.6.2/junit-jupiter-params-5.6.2.jar:/Users/pei/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.6.2/junit-jupiter-engine-5.6.2.jar:/Users/pei/.m2/repository/org/junit/vintage/junit-vintage-engine/5.6.2/junit-vintage-engine-5.6.2.jar:/Users/pei/.m2/repository/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar:/Users/pei/.m2/repository/org/junit/platform/junit-platform-engine/1.6.2/junit-platform-engine-1.6.2.jar:/Users/pei/.m2/repository/junit/junit/4.13/junit-4.13.jar:/Users/pei/.m2/repository/org/mockito/mockito-core/3.3.3/mockito-core-3.3.3.jar:/Users/pei/.m2/repository/net/bytebuddy/byte-buddy-agent/1.10.14/byte-buddy-agent-1.10.14.jar:/Users/pei/.m2/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar:/Users/pei/.m2/repository/org/mockito/mockito-junit-jupiter/3.3.3/mockito-junit-jupiter-3.3.3.jar:/Users/pei/.m2/repository/org/skyscreamer/jsonassert/1.5.0/jsonassert-1.5.0.jar:/Users/pei/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar:/Users/pei/.m2/repository/org/springframework/spring-test/5.2.9.RELEASE/spring-test-5.2.9.RELEASE.jar:/Users/pei/.m2/repository/org/xmlunit/xmlunit-core/2.7.0/xmlunit-core-2.7.0.jar:/Users/pei/.m2/repository/com/icegreen/greenmail-spring/1.5.10/greenmail-spring-1.5.10.jar:/Users/pei/.m2/repository/com/icegreen/greenmail/1.5.10/greenmail-1.5.10.jar:/Users/pei/.m2/repository/com/sun/mail/javax.mail/1.5.6/javax.mail-1.5.6.jar:/Users/pei/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/pei/.m2/repository/com/h2database/h2/1.4.200/h2-1.4.200.jar:/Users/pei/.m2/repository/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 org.g_mark.common.entity.AgreementTests,mapping

java.lang.NullPointerException
    at org.g_mark.common.entity.AgreementTests.mapping(AgreementTests.java:61)
    ...
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)


Process finished with exit code 255
  

Комментарии:

1. не связано, но вы должны обновить PDFBox до 2.0.21.

2. @Tilman Hausherr Спасибо за комментарий. Не могли бы вы привести вескую причину для его обновления? Поскольку я новичок, я хотел бы быть консервативным в отношении любых изменений (по крайней мере, я должен быть в состоянии убедить своих товарищей по команде, что мы должны его обновить)

3. Вам не следовало редактировать свой вопрос, я написал, что он не связан с вашей проблемой spring. Это низкий prio. В более новых версиях исправлены сотни ошибок, включая проблемы безопасности. Странно, что maven не может разрешить новую версию. У Maven central есть это.

4. @Tilman Hausherr Да, я отредактировал вопрос просто для использования формата кода, поскольку я обнаружил ошибку. Я обновил свои репозитории maven, и ошибка теперь исчезла.

Ответ №1:

Решение простое, а также действительно глупое, ИМХО.

В src/test/resources/application.yml , ранее это было

 spring:
  ...
flyway:
  enabled: false
  

Проблема решена после изменения этого на

 spring:
  ...
  flyway:
    enabled: false
  

Изменение формата с Spring Boot 1 на 2, я полагаю?