vaadin / bakery-app-starter-flow-spring

Internal repository for Bakery App Starter for Flow and Spring
The Unlicense
6 stars 13 forks source link

ClassNotFoundException: javax.servlet.ServletContext when running Application.main() from Intellij #924

Open mvysny opened 5 years ago

mvysny commented 5 years ago

Hi, I can't seem to run this project in Intellij, it always fails on me. Java openjdk 1.8.0_222, Intellij 2019.2.1.

Steps to reproduce:

  1. Checkout platform-14
  2. Right-click on the Application class in Intellij and select "Run Application.main()"
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -javaagent:/snap/intellij-idea-ultimate/165/lib/idea_rt.jar=36761:/snap/intellij-idea-ultimate/165/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/icedtea-sound.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/home/mavi/work/vaadin/starters-10+/bakery-app-starter-flow-spring/target/classes:/home/mavi/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/mavi/.m2/repository/com/h2database/h2/1.4.199/h2-1.4.199.jar:/home/mavi/.m2/repository/com/vaadin/vaadin/14.0.2/vaadin-14.0.2.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-core/14.0.2/vaadin-core-14.0.2.jar:/home/mavi/.m2/repository/com/vaadin/flow-html-components/2.0.8/flow-html-components-2.0.8.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-lumo-theme/2.0.8/vaadin-lumo-theme-2.0.8.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-material-theme/2.0.8/vaadin-material-theme-2.0.8.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-accordion-flow/2.0.0/vaadin-accordion-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-button-flow/2.0.1/vaadin-button-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-checkbox-flow/2.0.0/vaadin-checkbox-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-combo-box-flow/3.0.2/vaadin-combo-box-flow-3.0.2.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-custom-field-flow/3.0.1/vaadin-custom-field-flow-3.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-date-picker-flow/2.0.2/vaadin-date-picker-flow-2.0.2.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-details-flow/2.0.0/vaadin-details-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-time-picker-flow/2.0.1/vaadin-time-picker-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-select-flow/2.0.1/vaadin-select-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-dialog-flow/2.0.0/vaadin-dialog-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-form-layout-flow/2.0.1/vaadin-form-layout-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-grid-flow/4.0.5/vaadin-grid-flow-4.0.5.jar:/home/mavi/.m2/repository/org/webjars/npm/vaadin__vaadin-mobile-drag-drop/1.0.0/vaadin__vaadin-mobile-drag-drop-1.0.0.jar:/home/mavi/.m2/repository/org/webjars/npm/mobile-drag-drop/2.3.0-rc.1/mobile-drag-drop-2.3.0-rc.1.jar:/home/mavi/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-icons-flow/2.0.0/vaadin-icons-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-iron-list-flow/2.0.0/vaadin-iron-list-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-list-box-flow/2.0.0/vaadin-list-box-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-login-flow/2.0.0/vaadin-login-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-ordered-layout-flow/2.0.0/vaadin-ordered-layout-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-progress-bar-flow/2.0.1/vaadin-progress-bar-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-radio-button-flow/2.0.0/vaadin-radio-button-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-split-layout-flow/2.0.1/vaadin-split-layout-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-tabs-flow/2.0.2/vaadin-tabs-flow-2.0.2.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-text-field-flow/2.0.3/vaadin-text-field-flow-2.0.3.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-upload-flow/2.0.0/vaadin-upload-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-notification-flow/2.0.0/vaadin-notification-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-app-layout-flow/2.0.2/vaadin-app-layout-flow-2.0.2.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-context-menu-flow/3.0.2/vaadin-context-menu-flow-3.0.2.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-menu-bar-flow/1.0.1/vaadin-menu-bar-flow-1.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-board-flow/3.0.0/vaadin-board-flow-3.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-charts-flow/7.0.1/vaadin-charts-flow-7.0.1.jar:/home/mavi/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.9/jackson-databind-2.9.9.jar:/home/mavi/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/home/mavi/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-confirm-dialog-flow/2.0.1/vaadin-confirm-dialog-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-cookie-consent-flow/2.0.0/vaadin-cookie-consent-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-crud-flow/2.0.1/vaadin-crud-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-grid-pro-flow/2.0.1/vaadin-grid-pro-flow-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-rich-text-editor-flow/2.0.0/vaadin-rich-text-editor-flow-2.0.0.jar:/home/mavi/.m2/repository/com/vaadin/vaadin-spring/12.0.3/vaadin-spring-12.0.3.jar:/home/mavi/.m2/repository/com/vaadin/flow-server/2.0.8/flow-server-2.0.8.jar:/home/mavi/.m2/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar:/home/mavi/.m2/repository/com/vaadin/external/gwt/gwt-elemental/2.8.2.vaadin2/gwt-elemental-2.8.2.vaadin2.jar:/home/mavi/.m2/repository/commons-fileupload/commons-fileupload/1.3.3/commons-fileupload-1.3.3.jar:/home/mavi/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar:/home/mavi/.m2/repository/org/jsoup/jsoup/1.11.3/jsoup-1.11.3.jar:/home/mavi/.m2/repository/com/helger/ph-css/6.1.1/ph-css-6.1.1.jar:/home/mavi/.m2/repository/com/helger/ph-commons/9.1.2/ph-commons-9.1.2.jar:/home/mavi/.m2/repository/net/bytebuddy/byte-buddy/1.9.16/byte-buddy-1.9.16.jar:/home/mavi/.m2/repository/com/vaadin/external/gentyref/1.2.0.vaadin1/gentyref-1.2.0.vaadin1.jar:/home/mavi/.m2/repository/com/vaadin/flow-push/2.0.8/flow-push-2.0.8.jar:/home/mavi/.m2/repository/com/vaadin/external/atmosphere/atmosphere-runtime/2.4.30.slf4jvaadin1/atmosphere-runtime-2.4.30.slf4jvaadin1.jar:/home/mavi/.m2/repository/com/vaadin/flow-client/2.0.8/flow-client-2.0.8.jar:/home/mavi/.m2/repository/org/springframework/spring-webmvc/5.1.9.RELEASE/spring-webmvc-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-websocket/5.1.9.RELEASE/spring-websocket-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/vaadin/artur/spring-data-provider/2.0.1/spring-data-provider-2.0.1.jar:/home/mavi/.m2/repository/com/vaadin/flow-data/2.0.8/flow-data-2.0.8.jar:/home/mavi/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot/2.1.7.RELEASE/spring-boot-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-core/5.1.9.RELEASE/spring-core-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-jcl/5.1.9.RELEASE/spring-jcl-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-context/5.1.9.RELEASE/spring-context-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.7.RELEASE/spring-boot-autoconfigure-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/2.1.7.RELEASE/spring-boot-starter-data-jpa-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.1.7.RELEASE/spring-boot-starter-aop-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/org/aspectj/aspectjweaver/1.9.4/aspectjweaver-1.9.4.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.1.7.RELEASE/spring-boot-starter-jdbc-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/com/zaxxer/HikariCP/3.2.0/HikariCP-3.2.0.jar:/home/mavi/.m2/repository/org/springframework/spring-jdbc/5.1.9.RELEASE/spring-jdbc-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/javax/transaction/javax.transaction-api/1.3/javax.transaction-api-1.3.jar:/home/mavi/.m2/repository/org/hibernate/hibernate-core/5.3.10.Final/hibernate-core-5.3.10.Final.jar:/home/mavi/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/home/mavi/.m2/repository/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2.jar:/home/mavi/.m2/repository/org/javassist/javassist/3.23.2-GA/javassist-3.23.2-GA.jar:/home/mavi/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/home/mavi/.m2/repository/org/jboss/jandex/2.0.5.Final/jandex-2.0.5.Final.jar:/home/mavi/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/home/mavi/.m2/repository/org/dom4j/dom4j/2.1.1/dom4j-2.1.1.jar:/home/mavi/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.0.4.Final/hibernate-commons-annotations-5.0.4.Final.jar:/home/mavi/.m2/repository/org/springframework/data/spring-data-jpa/2.1.10.RELEASE/spring-data-jpa-2.1.10.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/data/spring-data-commons/2.1.10.RELEASE/spring-data-commons-2.1.10.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-orm/5.1.9.RELEASE/spring-orm-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-tx/5.1.9.RELEASE/spring-tx-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-aspects/5.1.9.RELEASE/spring-aspects-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-web/5.1.9.RELEASE/spring-web-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-beans/5.1.9.RELEASE/spring-beans-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/home/mavi/.m2/repository/org/springframework/security/spring-security-web/5.1.6.RELEASE/spring-security-web-5.1.6.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/security/spring-security-core/5.1.6.RELEASE/spring-security-core-5.1.6.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-aop/5.1.9.RELEASE/spring-aop-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/spring-expression/5.1.9.RELEASE/spring-expression-5.1.9.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/security/spring-security-config/5.1.6.RELEASE/spring-security-config-5.1.6.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.7.RELEASE/spring-boot-starter-web-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.7.RELEASE/spring-boot-starter-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.7.RELEASE/spring-boot-starter-logging-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/home/mavi/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/home/mavi/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar:/home/mavi/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar:/home/mavi/.m2/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar:/home/mavi/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/home/mavi/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.7.RELEASE/spring-boot-starter-json-2.1.7.RELEASE.jar:/home/mavi/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.9/jackson-datatype-jdk8-2.9.9.jar:/home/mavi/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.9/jackson-datatype-jsr310-2.9.9.jar:/home/mavi/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.9/jackson-module-parameter-names-2.9.9.jar:/home/mavi/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.17.Final/hibernate-validator-6.0.17.Final.jar:/home/mavi/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar:/home/mavi/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/home/mavi/.m2/repository/org/reactivestreams/reactive-streams/1.0.2/reactive-streams-1.0.2.jar com.vaadin.starter.bakery.Application
                       _
 __   ____ _  __ _  __| (_)_ __
 \ \ / / _` |/ _` |/ _` | | '_ \
  \ V / (_| | (_| | (_| | | | | |
   \_/ \__,_|\__,_|\__,_|_|_| |_|

2019-08-29 12:10:34.761  INFO 16307 --- [           main] com.vaadin.starter.bakery.Application    : Starting Application on mavi-vaadin with PID 16307 (/home/mavi/work/vaadin/starters-10+/bakery-app-starter-flow-spring/target/classes started by mavi in /home/mavi/work/vaadin/starters-10+/bakery-app-starter-flow-spring)
2019-08-29 12:10:34.766  INFO 16307 --- [           main] com.vaadin.starter.bakery.Application    : No active profile set, falling back to default profiles: default
2019-08-29 12:10:35.223  WARN 16307 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.vaadin.starter.bakery.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
2019-08-29 12:10:35.233 ERROR 16307 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.vaadin.starter.bakery.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at com.vaadin.starter.bakery.Application.main(Application.java:27) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
    at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:169) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.java:392) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:317) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 12 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_222]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_222]
    at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_222]
    at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:158) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 17 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_222]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_222]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_222]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_222]
    ... 21 common frames omitted

Process finished with exit code 1
mvysny commented 5 years ago

Note that I do not have Spring plugin installed in my Intellij 2019.2.1 - could this be the problem?

mvysny commented 5 years ago

I've installed the Spring Boot plugin, did not help.

mvysny commented 5 years ago

After I comment out the <scope>provided</scope> for javax.servlet-api in pom.xml, a different exception pops out:

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) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at com.vaadin.starter.bakery.Application.main(Application.java:27) [classes/:na]
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) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    ... 8 common frames omitted

I wonder if Intellij somehow computes a different classpath than Maven when running Spring Boot...

mvysny commented 5 years ago

Removing also the <scope>provided</scope> for spring-boot-starter-tomcat helped. I guess the Spring Boot Maven plugin provides those artifacts.

Anyway, could be useful to have instructions for this in the README - if you want to run this as main() method, you need to modify the pom.xml.