Приложение Spring Boot запускается не из Docker, а из IntellijJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Приложение Spring Boot запускается не из Docker, а из Intellij

Сообщение Anonymous »

У меня есть приложение весенней загрузки, которое обычно также успешно запускается с помощью функций установки intellj mvn. Но когда я запускаю свое приложение с помощью Docker Compose, я получаю следующую ошибку:

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

dsodp_selenium  | 2024-11-11T00:27:13.001Z  WARN 1 --- [seleniummelenium] [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gherkinRunner' defined in URL [jar:nested:/app/app.jar/!BOOT-INF/classes/!/rwe/eon/it/selenium/gherkin/GherkinRunner.class]: Failed to instantiate [rwe.eon.it.selenium.gherkin.GherkinRunner]: Constructor threw exception
dsodp_selenium  | 2024-11-11T00:27:13.003Z  INFO 1 --- [seleniummelenium] [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
dsodp_selenium  | 2024-11-11T00:27:13.010Z  INFO 1 --- [seleniummelenium] [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
dsodp_selenium  | 2024-11-11T00:27:13.028Z  INFO 1 --- [seleniummelenium] [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
dsodp_selenium  | 2024-11-11T00:27:13.032Z  INFO 1 --- [seleniummelenium] [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
dsodp_selenium  | 2024-11-11T00:27:13.072Z DEBUG 1 --- [seleniummelenium] [           main] .s.b.a.l.ConditionEvaluationReportLogger :
dsodp_selenium  |
dsodp_selenium  |
dsodp_selenium  | ============================
dsodp_selenium  | CONDITIONS EVALUATION REPORT
dsodp_selenium  | ============================
dsodp_selenium  |
dsodp_selenium  |
dsodp_selenium  | Positive matches:
dsodp_selenium  | -----------------
dsodp_selenium  |
dsodp_selenium  |    ActiveMQAutoConfiguration matched:
dsodp_selenium  |       - @ConditionalOnClass found required classes 'jakarta.jms.ConnectionFactory', 'org.apache.activemq.ActiveMQConnectionFactory' (OnClassCondition)
dsodp_selenium  |       - @ConditionalOnMissingBean (types: jakarta.jms.ConnectionFactory; SearchStrategy: all) did not find any beans (OnBeanCondition)
dsodp_selenium  |
dsodp_selenium  |    ActiveMQAutoConfiguration#activemqConnectionDetails matched:
dsodp_selenium  |       - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.jms.activemq.ActiveMQConnectionDetails; SearchStrategy: all) did not find any beans (OnBeanCondition)
dsodp_selenium  |
dsodp_selenium  |    ActiveMQConnectionFactoryConfiguration matched:
dsodp_selenium  |       - @ConditionalOnMissingBean (types: jakarta.jms.ConnectionFactory;  SearchStrategy: all) did not find any beans (OnBeanCondition)
dsodp_selenium  |
dsodp_selenium  |    ActiveMQConnectionFactoryConfiguration.SimpleConnectionFactoryConfiguration matched:
dsodp_selenium  |       - @ConditionalOnProperty (spring.activemq.pool.enabled=false) matched (OnPropertyCondition)
dsodp_selenium  |
dsodp_selenium  |    ActiveMQConnectionFactoryConfiguration.SimpleConnectionFactoryConfiguration.CachingConnectionFactoryConfiguration matched:
dsodp_selenium  |       - @ConditionalOnClass found required class 'org.springframework.jms.connection.CachingConnectionFactory' (OnClassCondition)
dsodp_selenium  |       - @ConditionalOnProperty (spring.jms.cache.enabled=true) matched (OnPropertyCondition)
dsodp_selenium  |
dsodp_selenium  |    AopAutoConfiguration matched:
dsodp_selenium  |       - @ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)
dsodp_selenium  |
dsodp_selenium  |    AopAutoConfiguration.AspectJAutoProxyingConfiguration matched:
dsodp_selenium  |       - @ConditionalOnClass found required class 'org.aspectj.weaver.Advice' (OnClassCondition)
dsodp_selenium  |
dsodp_selenium  |    AopAutoConfiguration.AspectJAutoProxyingConfiguration.CglibAutoProxyConfiguration matched:
dsodp_selenium  |       - @ConditionalOnProperty (spring.aop.proxy-target-class=true) matched (OnPropertyCondition)
dsodp_selenium  |
dsodp_selenium  |    ApplicationAvailabilityAutoConfiguration#applicationAvailability matched:
dsodp_selenium  |       - @ConditionalOnMissingBean (types: org.springframework.boot.availability.ApplicationAvailability;  SearchStrategy: all) did not find any beans (OnBeanCondition)
dsodp_selenium  |
dsodp_selenium  |
Мне не удалось ввести все данные из журнала из-за ограничения, но это продолжается
GherkinRunner не может быть инициализирован с ошибкой компонента. Но обычно это работает при обычном запуске, вот мой класс корнишона, а также моя композиция докера и мой файл докера. Я новичок в докере, поэтому, должно быть, я что-то делаю неправильно.
GherkinRunner:

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

        public WebDriver initializeDriver() {

FirefoxOptions options = new FirefoxOptions();


Configure to accept insecure certificates

options.setAcceptInsecureCerts(true);


try {
          // Connect to the
Selenium Hub running in Docker
URL
seleniumRemoteUrl = new URL("http://selenium-hub:4444/wd/hub");


return new RemoteWebDriver(seleniumRemoteUrl, options);

}
catch (Exception e) {

e.printStackTrace();

throw new RuntimeException("Error initializing RemoteWebDriver", e)
;}


}

docker compose и docker file:
file:

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

    # Stage 1: Create the image

FROM openjdk:17.0.2-slim

WORKDIR /app
COPY
target/dsodp-0.0.1-SNAPSHOT.jar app.jar

COPY src ./src
COPY qmpzwcn5.Selenium-
./qmpzwcn5.Selenium-COPY start.sh /app/start.sh


ENTRYPOINT ["java", "-jar", "app.jar"]
составить:

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

  backend:

container_name: dsodp_selenium

build:

context: ./

ports:

- "8080:8080"

environment:

-SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/testdatengenerator

-SPRING_DATASOURCE_USERNAME=root

-SPRING_DATASOURCE_PASSWORD=
- SPRING_DATASOURCE_ROOTPASSWORD=
- DEBUG=true  # Debugging
depends_on:

- mysql

networks:

- my-network

selenium-hub:

image: selenium/hub:latest

container_name: selenium-hub

ports:

- "4444:4444"

environment:

- GRID_PASSWORD=test123

- SE_VNC_NO_PASSWORD=1

- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317

networks:

- my-network

depends_on:

- otel-collector

restart: on-failure

healthcheck:

test: ["CMD", "curl", "-f", "http://localhost:4444"]

interval: 30s

timeout: 10s

retries: 5
Если нужна дополнительная информация, я могу отредактировать вопрос

Подробнее здесь: https://stackoverflow.com/questions/791 ... ut-intellj
Ответить

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

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

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

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

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