# Упаковка приложения Spring Boot Camunda BPM в jar-файл

**URL:** <https://forum.reunico.com/t/upakovka-prilozheniya-spring-boot-camunda-bpm-v-jar-fajl/44>\
**Category:** Camunda 7\
**Created:** [06.Февраль.2021 14:49:29 UTC](https://forum.reunico.com/t/upakovka-prilozheniya-spring-boot-camunda-bpm-v-jar-fajl/44 "2021-02-06T14:49:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VicTri](https://forum.reunico.com/letter_avatar_proxy/v4/letter/v/6de8d8/32.png) [@VicTri](https://forum.reunico.com/u/VicTri)\
**Post date:** [06.Февраль.2021 14:49:29 UTC](https://forum.reunico.com/t/upakovka-prilozheniya-spring-boot-camunda-bpm-v-jar-fajl/44/1 "2021-02-06T14:49:29Z")

</div>

У меня возникла проблема с выполнением jar-файла, собранного в IntelliJ (v. 2020.3):

Oracle JDK 15.0.1 / Spring Boot 2.4.1  
08:02:57.544 [main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

Open JDK 11 / Spring Boot 2.4.2  
ERROR org.springframework.boot.SpringApplication - Application run failed java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.

При этом запуск приложения из IntelliJ происходил нормально.

Проект создавался по материалам обучающего видео Мстислава Мартынюка: [https://www.reunico.com/camunda-dlya-razrabotchika-chast-4.html](https://www.reunico.com/camunda-dlya-razrabotchika-chast-4.html)

* * *

Комментарии Мстислава Мартынюка:  
Касательно Вашей проблемы. Выглядит так, будто не удается запустить встроенный в Spring Boot сервер приложений Tomcat (возможно проблема в отсутствующих зависимостях или несовместимых версиях библиотек).

Проверьте:

1. Каким образом формировали проект? Через [http://start.camunda.com](http://start.camunda.com/) или Spring Boot Initialzr?

2. Совпадают ли версии Camunda и Spring Boot. (На сайте Camunda есть страничка, описывающая совместимые версии Spring Boot и Camunda)

3. Проверьте, установлена ли аннотация @SpringBootApplication на main-классе.

* * *

1. Проект создавал через Spring Boot Initializr
2. Зависимости загружались для Camunda 7.14.0 (для нее как выяснилось нужно использовать Spring Boot 2.3.x.RELEASE: [https://docs.camunda.org/manual/latest/user-guide/spring-boot-integration/version-compatibility/](https://docs.camunda.org/manual/latest/user-guide/spring-boot-integration/version-compatibility/))
3. Аннотация автоконфигурации и создания компонентов с внедрением зависимостей была установлена.  
Также был подключен плагин spring-boot-maven-plugin в pom.xml  
Настройки артефактов для jar-файла в структуре проекта в IntelliJ оставил по умолчанию.

Причина ошибки пока непонятна (тестировать с Spring Boot 2.3 не пробовал, т.к. на момент написания этого поста проблему уже решил, см. ниже). Судя по темам на форумах ошибка распространенная, при этом не одно из решений мне не помогло:  
[https://stackoverflow.com/questions/50231736/applicationcontextexception-unable-to-start-servletwebserverapplicationcontext](https://stackoverflow.com/questions/50231736/applicationcontextexception-unable-to-start-servletwebserverapplicationcontext)

> <https://github.com/aws/serverless-java-container/issues/326>
>
> \* Framework version: aws-cli/2.0.0dev4 Python/3.7.4 Darwin/19.2.0 botocore/2.0.0…dev3
> \* Implementations: Spring Boot
> 
> \## Scenario
> Run the spring-boot2 app locally
> 
> \## Expected behavior
> the app starts without exceptions
> 
> \## Actual behavior
> error happens:
> 
> !\[image\](https://user-images.githubusercontent.com/13794896/75352475-78a93700-58b2-11ea-924c-92aaa85d3e55.png)
> 
> 
> \## Steps to reproduce
> 1. Download the repo
> 2. cd samples/springboot2/pet-store
> 3. Run com.amazonaws.serverless.sample.springboot2.Application from your IDE as a simple spring-boot app.
> 
> \## Full log output
> 2020-02-26 15:57:01.303 INFO 59255 --- \[main\] c.a.s.sample.springboot2.Application : Starting Application on Bogdans-MBP.mate.academy with PID 59255 (/Users/bchupika/IdeaProjects/Study/aws-serverless-java-container/samples/springboot2/pet-store/target/classes started by bchupika in /Users/bchupika/IdeaProjects/Study/aws-serverless-java-container)
> 2020-02-26 15:57:01.312 INFO 59255 --- \[main\] c.a.s.sample.springboot2.Application : No active profile set, falling back to default profiles: default
> 2020-02-26 15:57:02.082 ERROR 59255 --- \[main\] o.s.boot.SpringApplication : Application run failed
> 
> org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
> at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156)
> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
> at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
> at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
> at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
> at com.amazonaws.serverless.sample.springboot2.Application.main(Application.java:47)
> Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
> at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:203)
> at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179)
> at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153)
> ... 8 common frames omitted
> 
> 
> Process finished with exit code 1

…

РЕШЕНИЕ:  
Сборку jar-файла сделал с помощью Maven на прямую, т.е. через командную строку: mvn package  
при этом использовал apache-maven-3.6.3

---

<div class="post-metadata">

**Author:** ![VicTri](https://forum.reunico.com/letter_avatar_proxy/v4/letter/v/6de8d8/32.png) [@VicTri](https://forum.reunico.com/u/VicTri)\
**Post date:** [13.Февраль.2021 17:47:59 UTC](https://forum.reunico.com/t/upakovka-prilozheniya-spring-boot-camunda-bpm-v-jar-fajl/44/2 "2021-02-13T17:47:59Z")

</div>

Проблема решена…
