Ошибка Spring Boot/Java во время установки и запуска mvn после обновления до 3.3.4 и Java 21JAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Ошибка Spring Boot/Java во время установки и запуска mvn после обновления до 3.3.4 и Java 21

Сообщение Anonymous »

Я обновил свое серверное приложение до весенней загрузки версии 3.3.4 и Java 21 в POM.xml, и теперь оно даже не распознает мои классы компонентов или репозитории?
Что странно, приложение работает СОВЕРШЕННО нормально ЛОКАЛЬНО. Я могу запустить его и использовать интерфейс для подключения к нему. Но после обновления, когда я развертываю его в Heroku, он собирается нормально, но ничего не работает. Однажды я попытался установить mvn-clean-install и заметил, что он не распознает ни один из моих bean-компонентов. Я понятия не имею, что происходит.
Кроме того, каждый раз, когда я пытаюсь выполнить чистую установку mvn, а ЗАТЕМ пытаюсь запустить свое приложение, я получаю эту ошибку:

Код: Выделить всё

  Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-11-13T08:54:17.653-06:00 ERROR 23732 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cardController': Resolution of declared constructors on bean Class [com.church.churchrestservice.controller.CardController] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@5a07e868] failed
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:384) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1314) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1209) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.13.jar:6.1.13]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971) ~[spring-context-6.1.13.jar:6.1.13]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[spring-context-6.1.13.jar:6.1.13]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.3.4.jar:3.3.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.4.jar:3.3.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.4.jar:3.3.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.4.jar:3.3.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.4.jar:3.3.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.4.jar:3.3.4]
at com.church.churchrestservice.ChurchRestServiceApplication.main(ChurchRestServiceApplication.java:12) ~[classes/:na]
Caused by: java.lang.NoClassDefFoundError: com/church/churchrestservice/service/CardService
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:na]
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3621) ~[na:na]
at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2786) ~[na:na]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:379) ~[spring-beans-6.1.13.jar:6.1.13]
...  18 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.church.churchrestservice.service.CardService
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528) ~[na:na]
...  22 common frames omitted
Иначе, как только я обновлю POM.xml, приложение заработает? Я запутался.
Вот мои ошибки при попытке выполнить чистую установку mvn:

Код: Выделить всё

     [INFO] --- maven-compiler-plugin:3.13.0:compile (default-compile) @ church-rest-service ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 50 source files with javac [debug parameters release 21] to target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[102,80] cannot find symbol
symbol:   method getDisplayCards()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[103,36] cannot find symbol
symbol:   method getType()
location: variable displayCardResponse of type com.church.churchrestservice.beans.shared.DisplayCardResponse
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[106,36] cannot find symbol
symbol:   method getType()
location: variable displayCardResponse of type com.church.churchrestservice.beans.shared.DisplayCardResponse
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[109,36] cannot find symbol
symbol:   method getType()
location: variable displayCardResponse of type com.church.churchrestservice.beans.shared.DisplayCardResponse
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[112,36] cannot find symbol
symbol:   method getType()
location: variable displayCardResponse of type com.church.churchrestservice.beans.shared.DisplayCardResponse
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[116,54] cannot find symbol
symbol:   method getDisplayCards()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[117,54] cannot find symbol
symbol:   method getDisplayCards()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[126,69] cannot find symbol
symbol:   method getMinistriesWeSupportPage()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[127,74] cannot find symbol
symbol:   method getMinistriesWeSupportPage()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[128,33] cannot find symbol
symbol:   method setDisplayCards(java.util.ArrayList)
location: variable ministriesWeSupportModel of type com.church.churchrestservice.beans.shared.MinistriesWeSupportModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[132,60] cannot find symbol
symbol:   method getLeadershipPage()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[133,65] cannot find symbol
symbol:   method getLeadershipPage()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[134,24] cannot find symbol
symbol:   method setDisplayCards(java.util.ArrayList)
location: variable leadershipModel of type com.church.churchrestservice.beans.shared.LeadershipModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[138,63] cannot find symbol
symbol:   method getOurMinistriesPage()
location:  variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[139,68] cannot find symbol
symbol:   method getOurMinistriesPage()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[140,27] cannot find symbol
symbol:   method setDisplayCards(java.util.ArrayList)
location: variable ourMinistriesModel of type com.church.churchrestservice.beans.shared.OurMinistriesModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[145,58] cannot find symbol
symbol:   method getMissionsPage()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[146,63] cannot find symbol
symbol:   method getMissionsPage()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[147,22] cannot find symbol
symbol:   method setDisplayCards(java.util.ArrayList)
location: variable missionsModel of type com.church.churchrestservice.beans.shared.MissionsModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[150,35] cannot find symbol
symbol:   method setMinistriesWeSupportPage(com.church.churchrestservice.beans.shared.MinistriesWeSupportModel)
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[151,35] cannot find symbol
symbol:   method setLeadershipPage(com.church.churchrestservice.beans.shared.LeadershipModel)
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[152,35] cannot find symbol
symbol:   method setOurMinistriesPage(com.church.churchrestservice.beans.shared.OurMinistriesModel)
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[153,35] cannot find symbol
symbol:   method setMissionsPage(com.church.churchrestservice.beans.shared.MissionsModel)
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[158,60] cannot find symbol
symbol:   method getAllCalendarInformation()
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[162,72] cannot find symbol
symbol:   method getEvents()
location: variable calendarModel of type com.church.churchrestservice.beans.calendar.CalendarModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[163,63] cannot find symbol
symbol:   method getDate()
location: variable calendarModel of type com.church.churchrestservice.beans.calendar.CalendarModel
[ERROR] /D:/church-backend/src/main/java/com/church/churchrestservice/service/CardService.java:[176,35] cannot find symbol
symbol:   method setAllCalendarInformation(java.util.ArrayList)
location: variable allWebsiteInformationModel of type com.church.churchrestservice.beans.website.AllWebsiteInformationModel
[INFO] 27 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.565 s
[INFO] Finished at:  2024-11-13T08:38:07-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project church-rest-service: Compilation failure: Compilation failure:

Все эти ошибки — это мои классы компонентов, которые он по какой-то причине «не может найти», но работает локально? Я не знаю, чего мне не хватает. Я думаю, что-то напутало. Я попытался удалить папку .idea, папку .m2, но все равно ничего. Будем очень признательны за любую помощь.

Код: Выделить всё

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

org.springframework.boot
spring-boot-starter-parent
3.3.4
 

com.church
church-rest-service
0.0.1-SNAPSHOT
church-rest-service
Backend For Church Application
jar

21
23
23



org.springframework.boot
spring-boot-starter-data-mongodb-reactive


org.springframework.boot
spring-boot-starter-web



org.projectlombok
lombok
1.18.34
true


org.springframework.boot
spring-boot-starter-test
test


io.projectreactor
reactor-test
test






org.springframework.boot
spring-boot-maven-plugin



org.projectlombok
lombok






Вот структура моего проекта:
Изображение
Мой JAVA_HOME: C:\Program Files\Java\jdk-23

Подробнее здесь: https://stackoverflow.com/questions/791 ... g-to-3-3-4
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»