Ошибка Spring Boot в действиях GitHub: IllegalState не удалось загрузить ApplicationContextJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Ошибка Spring Boot в действиях GitHub: IllegalState не удалось загрузить ApplicationContext

Сообщение Anonymous »

Я выполняю задание для университета, используя Spring Boot, Junit и GitHub. У меня возникает ошибка при отправке в репозиторий, который запускает сборку и тестирование действий GitHub.
Вот трассировка стека полученной ошибки:

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

 :: Spring Boot ::                (v3.5.7)

2026-02-16T16:21:58.958Z  INFO 2340 --- [api-project-pmt] [           main] c.i.a.controllers.UserControllerTest     : Starting UserControllerTest using Java 21.0.10 with PID 2340 (started by runner in /home/runner/work/api-project-pmt/api-project-pmt)
2026-02-16T16:21:58.958Z  INFO 2340 --- [api-project-pmt] [           main] c.i.a.controllers.UserControllerTest     : No active profile set, falling back to 1 default profile: "default"
2026-02-16T16:21:59.066Z  INFO 2340 --- [api-project-pmt] [           main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet ''
2026-02-16T16:21:59.066Z  INFO 2340 --- [api-project-pmt] [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2026-02-16T16:21:59.067Z  INFO 2340 --- [api-project-pmt] [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 1 ms
2026-02-16T16:21:59.070Z  INFO 2340 --- [api-project-pmt] [           main] c.i.a.controllers.UserControllerTest     : Started UserControllerTest in 0.125 seconds (process running for 7.913)
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.326 s -- in com.iscod.api_project_pmt.controllers.UserControllerTest
[INFO]
[INFO] Results:
[INFO]
Error:  Errors:
Error:    ApiProjectPmtApplicationTests.contextLoads » IllegalState Failed to load ApplicationContext for [WebMergedContextConfiguration@629fe84 testClass = com.iscod.api_project_pmt.ApiProjectPmtApplicationTests, locations = [], classes = [com.iscod.api_project_pmt.ApiProjectPmtApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@59d2400d, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@9ef8eb7, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@52066604, org.springframework.boot.test.web.reactor.netty.DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory$DisableReactorResourceFactoryGlobalResourcesContextCustomizerCustomizer@3bcbb589, org.springframework.boot.test.autoconfigure.OnFailureConditionReportContextCustomizerFactory$OnFailureConditionReportContextCustomizer@35d08e6c, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@6ff65192, org.springframework.test.context.support.DynamicPropertiesContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestAnnotation@360abf33], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
[INFO]
Error:  Tests run: 84, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  25.100 s
[INFO] Finished at: 2026-02-16T16:21:59Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.4:test (default-test) on project api-project-pmt:
Error:
Error:  See /home/runner/work/api-project-pmt/api-project-pmt/target/surefire-reports for the individual test results.
Error:  See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
Error:  -> [Help 1]
Error:
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Error: Process completed with exit code 1.
Вот pom.xml:

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


4.0.0

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

Подробнее здесь: [url]https://stackoverflow.com/questions/79891567/spring-boot-error-in-github-actions-illegalstate-failed-to-load-applicationcon[/url]
Ответить

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

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

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

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

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