I am trying to create a gateway service integrated with auth service.
api-gateway/pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.16.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.project</groupId>
<artifactId>api-gateway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>api-gateway</name>
<description>Zuul Gateway</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>Hoxton.SR9</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
To this project i have added a application called "Common" in the build path.
Had 3 files in common application.
JwtAuthenticationConfig
JwtTokenAuthenticationFilter
JwtUsernamePasswordAuthenticationFilter
Source for my work is this.
After running my gateway application i am facing following error.
19:09:27.281 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/F:/eclipse-jee-2018-09-win32-x86_64/eclipse-workspace/Project/api-gateway/api-gateway/target/classes/, file:/F:/eclipse-jee-2018-09-win32-x86_64/eclipse-workspace/Project/common/common/target/classes/, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-security/2.4.0/spring-boot-starter-security-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter/2.4.0/spring-boot-starter-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot/2.4.0/spring-boot-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.4.0/spring-boot-autoconfigure-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.4.0/spring-boot-starter-logging-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/C:/Users/Sreenivas/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.13.3/log4j-to-slf4j-2.13.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/logging/log4j/log4j-api/2.13.3/log4j-api-2.13.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar, file:/C:/Users/Sreenivas/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar, file:/C:/Users/Sreenivas/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-aop/5.3.1/spring-aop-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-beans/5.3.1/spring-beans-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-config/5.4.1/spring-security-config-5.4.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-context/5.3.1/spring-context-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-web/5.4.1/spring-security-web-5.4.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-expression/5.3.1/spring-expression-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.4.0/spring-boot-starter-web-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.4.0/spring-boot-starter-json-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.11.3/jackson-datatype-jdk8-2.11.3.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.11.3/jackson-datatype-jsr310-2.11.3.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.11.3/jackson-module-parameter-names-2.11.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.4.0/spring-boot-starter-tomcat-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.39/tomcat-embed-core-9.0.39.jar, file:/C:/Users/Sreenivas/.m2/repository/org/glassfish/jakarta.el/3.0.3/jakarta.el-3.0.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.39/tomcat-embed-websocket-9.0.39.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-web/5.3.1/spring-web-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-webmvc/5.3.1/spring-webmvc-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/io/jsonwebtoken/jjwt/0.9.1/jjwt-0.9.1.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.11.3/jackson-databind-2.11.3.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.11.3/jackson-annotations-2.11.3.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.11.3/jackson-core-2.11.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/projectlombok/lombok/1.18.16/lombok-1.18.16.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-test/2.4.0/spring-boot-starter-test-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-test/2.4.0/spring-boot-test-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-test-autoconfigure/2.4.0/spring-boot-test-autoconfigure-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/jayway/jsonpath/json-path/2.4.0/json-path-2.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/net/minidev/json-smart/2.3/json-smart-2.3.jar, file:/C:/Users/Sreenivas/.m2/repository/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar, file:/C:/Users/Sreenivas/.m2/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar, file:/C:/Users/Sreenivas/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar, file:/C:/Users/Sreenivas/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar, file:/C:/Users/Sreenivas/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar, file:/C:/Users/Sreenivas/.m2/repository/org/assertj/assertj-core/3.18.1/assertj-core-3.18.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar, file:/C:/Users/Sreenivas/.m2/repository/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/mockito/mockito-core/3.6.0/mockito-core-3.6.0.jar, file:/C:/Users/Sreenivas/.m2/repository/net/bytebuddy/byte-buddy/1.10.18/byte-buddy-1.10.18.jar, file:/C:/Users/Sreenivas/.m2/repository/net/bytebuddy/byte-buddy-agent/1.10.18/byte-buddy-agent-1.10.18.jar, file:/C:/Users/Sreenivas/.m2/repository/org/objenesis/objenesis/3.1/objenesis-3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/mockito/mockito-junit-jupiter/3.6.0/mockito-junit-jupiter-3.6.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/skyscreamer/jsonassert/1.5.0/jsonassert-1.5.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-core/5.3.1/spring-core-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-jcl/5.3.1/spring-jcl-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-test/5.3.1/spring-test-5.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/xmlunit/xmlunit-core/2.7.0/xmlunit-core-2.7.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-test/5.4.1/spring-security-test-5.4.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-core/5.4.1/spring-security-core-5.4.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-security/2.1.16.RELEASE/spring-boot-starter-security-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.16.RELEASE/spring-boot-starter-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot/2.1.16.RELEASE/spring-boot-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.16.RELEASE/spring-boot-autoconfigure-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.16.RELEASE/spring-boot-starter-logging-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar, file:/C:/Users/Sreenivas/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar, file:/C:/Users/Sreenivas/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-aop/5.1.17.RELEASE/spring-aop-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-beans/5.1.17.RELEASE/spring-beans-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-config/5.1.11.RELEASE/spring-security-config-5.1.11.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-context/5.1.17.RELEASE/spring-context-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-web/5.1.11.RELEASE/spring-security-web-5.1.11.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-expression/5.1.17.RELEASE/spring-expression-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-web/5.1.17.RELEASE/spring-web-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-eureka-client/2.2.6.RELEASE/spring-cloud-starter-netflix-eureka-client-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-starter/2.2.6.RELEASE/spring-cloud-starter-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-context/2.2.6.RELEASE/spring-cloud-context-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-crypto/5.1.11.RELEASE/spring-security-crypto-5.1.11.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-commons/2.2.6.RELEASE/spring-cloud-commons-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar, file:/C:/Users/Sreenivas/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-netflix-hystrix/2.2.6.RELEASE/spring-cloud-netflix-hystrix-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.1.16.RELEASE/spring-boot-starter-aop-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/aspectj/aspectjweaver/1.9.6/aspectjweaver-1.9.6.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-netflix-eureka-client/2.2.6.RELEASE/spring-cloud-netflix-eureka-client-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/eureka/eureka-client/1.10.7/eureka-client-1.10.7.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/netflix-commons/netflix-eventbus/0.3.0/netflix-eventbus-0.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/netflix-commons/netflix-infix/0.3.0/netflix-infix-0.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar, file:/C:/Users/Sreenivas/.m2/repository/joda-time/joda-time/2.10.6/joda-time-2.10.6.jar, file:/C:/Users/Sreenivas/.m2/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar, file:/C:/Users/Sreenivas/.m2/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar, file:/C:/Users/Sreenivas/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/C:/Users/Sreenivas/.m2/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/archaius/archaius-core/0.7.6/archaius-core-0.7.6.jar, file:/C:/Users/Sreenivas/.m2/repository/com/google/guava/guava/29.0-jre/guava-29.0-jre.jar, file:/C:/Users/Sreenivas/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar, file:/C:/Users/Sreenivas/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar, file:/C:/Users/Sreenivas/.m2/repository/org/checkerframework/checker-qual/2.11.1/checker-qual-2.11.1.jar, file:/C:/Users/Sreenivas/.m2/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar, file:/C:/Users/Sreenivas/.m2/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar, file:/C:/Users/Sreenivas/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/servo/servo-core/0.12.21/servo-core-0.12.21.jar, file:/C:/Users/Sreenivas/.m2/repository/com/sun/jersey/jersey-core/1.19.1/jersey-core-1.19.1.jar, file:/C:/Users/Sreenivas/.m2/repository/com/sun/jersey/jersey-client/1.19.1/jersey-client-1.19.1.jar, file:/C:/Users/Sreenivas/.m2/repository/com/sun/jersey/contribs/jersey-apache-client4/1.19.1/jersey-apache-client4-1.19.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/httpcomponents/httpclient/4.5.12/httpclient-4.5.12.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar, file:/C:/Users/Sreenivas/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar, file:/C:/Users/Sreenivas/.m2/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar, file:/C:/Users/Sreenivas/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/C:/Users/Sreenivas/.m2/repository/com/google/inject/guice/4.1.0/guice-4.1.0.jar, file:/C:/Users/Sreenivas/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/C:/Users/Sreenivas/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.10/jackson-annotations-2.9.10.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.10/jackson-core-2.9.10.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.10.5/jackson-databind-2.9.10.5.jar, file:/C:/Users/Sreenivas/.m2/repository/org/codehaus/jettison/jettison/1.3.7/jettison-1.3.7.jar, file:/C:/Users/Sreenivas/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/eureka/eureka-core/1.10.7/eureka-core-1.10.7.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/woodstox/woodstox-core/5.0.3/woodstox-core-5.0.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-archaius/2.2.6.RELEASE/spring-cloud-starter-netflix-archaius-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-netflix-ribbon/2.2.6.RELEASE/spring-cloud-netflix-ribbon-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-netflix-archaius/2.2.6.RELEASE/spring-cloud-netflix-archaius-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-ribbon/2.2.6.RELEASE/spring-cloud-starter-netflix-ribbon-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/ribbon/ribbon/2.3.0/ribbon-2.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/ribbon/ribbon-transport/2.3.0/ribbon-transport-2.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar, file:/C:/Users/Sreenivas/.m2/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar, file:/C:/Users/Sreenivas/.m2/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/ribbon/ribbon-core/2.3.0/ribbon-core-2.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/ribbon/ribbon-httpclient/2.3.0/ribbon-httpclient-2.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/ribbon/ribbon-loadbalancer/2.3.0/ribbon-loadbalancer-2.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar, file:/C:/Users/Sreenivas/.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-starter-loadbalancer/2.2.6.RELEASE/spring-cloud-starter-loadbalancer-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-loadbalancer/2.2.6.RELEASE/spring-cloud-loadbalancer-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-validation/2.1.16.RELEASE/spring-boot-starter-validation-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/io/projectreactor/reactor-core/3.2.19.RELEASE/reactor-core-3.2.19.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/io/projectreactor/addons/reactor-extra/3.2.4.RELEASE/reactor-extra-3.2.4.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-cache/2.1.16.RELEASE/spring-boot-starter-cache-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-context-support/5.1.17.RELEASE/spring-context-support-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/com/stoyanr/evictor/1.0.0/evictor-1.0.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/ribbon/ribbon-eureka/2.3.0/ribbon-eureka-2.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/com/thoughtworks/xstream/xstream/1.4.13/xstream-1.4.13.jar, file:/C:/Users/Sreenivas/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-zuul/2.2.6.RELEASE/spring-cloud-starter-netflix-zuul-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-netflix-zuul/2.2.6.RELEASE/spring-cloud-netflix-zuul-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/netflix-commons/netflix-commons-util/0.3.0/netflix-commons-util-0.3.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.16.RELEASE/spring-boot-starter-web-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.16.RELEASE/spring-boot-starter-json-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.10/jackson-datatype-jdk8-2.9.10.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.10/jackson-datatype-jsr310-2.9.10.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.10/jackson-module-parameter-names-2.9.10.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.16.RELEASE/spring-boot-starter-tomcat-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.37/tomcat-embed-core-9.0.37.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.37/tomcat-embed-el-9.0.37.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.37/tomcat-embed-websocket-9.0.37.jar, file:/C:/Users/Sreenivas/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.20.Final/hibernate-validator-6.0.20.Final.jar, file:/C:/Users/Sreenivas/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar, file:/C:/Users/Sreenivas/.m2/repository/org/jboss/logging/jboss-logging/3.3.3.Final/jboss-logging-3.3.3.Final.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-webmvc/5.1.17.RELEASE/spring-webmvc-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.1.16.RELEASE/spring-boot-starter-actuator-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.1.16.RELEASE/spring-boot-actuator-autoconfigure-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/boot/spring-boot-actuator/2.1.16.RELEASE/spring-boot-actuator-2.1.16.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/io/micrometer/micrometer-core/1.1.16/micrometer-core-1.1.16.jar, file:/C:/Users/Sreenivas/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar, file:/C:/Users/Sreenivas/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-hystrix/2.2.6.RELEASE/spring-cloud-starter-netflix-hystrix-2.2.6.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/hystrix/hystrix-core/1.5.18/hystrix-core-1.5.18.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/hystrix/hystrix-serialization/1.5.18/hystrix-serialization-1.5.18.jar, file:/C:/Users/Sreenivas/.m2/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.9.10/jackson-module-afterburner-2.9.10.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/hystrix/hystrix-metrics-event-stream/1.5.18/hystrix-metrics-event-stream-1.5.18.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/hystrix/hystrix-javanica/1.5.18/hystrix-javanica-1.5.18.jar, file:/C:/Users/Sreenivas/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar, file:/C:/Users/Sreenivas/.m2/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar, file:/C:/Users/Sreenivas/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar, file:/C:/Users/Sreenivas/.m2/repository/com/netflix/zuul/zuul-core/1.3.1/zuul-core-1.3.1.jar, file:/C:/Users/Sreenivas/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-core/5.1.17.RELEASE/spring-core-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/spring-jcl/5.1.17.RELEASE/spring-jcl-5.1.17.RELEASE.jar, file:/C:/Users/Sreenivas/.m2/repository/org/springframework/security/spring-security-core/5.1.11.RELEASE/spring-security-core-5.1.11.RELEASE.jar]
19:09:27.297 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: ConfigFileApplicationListener [org.springframework.boot.context.config.ConfigFileApplicationListener] is deprecated and can only be used as an EnvironmentPostProcessor
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:198)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
at com.project.apigateway.ApiGatewayApplication.main(ApiGatewayApplication.java:12)
Help me in solving this.
Problem Resolved.
Actually common application and Api-gateway application are in different spring versions.
After changing version of common and correctly including it in api-gateway application solved my issue.
Thanks.
I am trying to refactor a Java program I wrote last year to use Spring Boot. The front end uses JavaFX, and so I am trying to use FxWeaver.
However, when I run my program, I get the following error on startup:
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'net.rgielen.fxweaver.core.FxWeaver' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:351)
...
From rgielen's website, it shouldn't be necessary to provide an RxWeaver "... when using the Spring Boot Starter, since it provides auto-configuration for a FxWeaver instance."
So I'm stumped as to why I'm getting this error. Would anyone be able to take a look please?
Main Application
package application;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import javafx.application.Application;
#SpringBootApplication
public class MainApplication {
public static void main(String[] args) {
Application.launch(SpringbootJavaFxApplication.class, args);
}
}
SpringBootJavaFxApplication
package application;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import net.rgielen.fxweaver.core.FxWeaver;
public class SpringbootJavaFxApplication extends Application {
private ConfigurableApplicationContext applicationContext;
#Override
public void init() throws Exception {
this.applicationContext = new SpringApplicationBuilder()
.sources(MainApplication.class)
.run(getParameters().getRaw().toArray(new String[0]));
}
#Override
public void start(Stage stage) {
FxWeaver fxWeaver = applicationContext.getBean(FxWeaver.class);
Parent root = fxWeaver.loadView(Controller.class);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
#Override
public void stop() {
this.applicationContext.close();
Platform.exit();
}
}
pom
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xxxxx</groupId>
<artifactId>xxxxx</artifactId>
<version>1.0</version>
<name>xxxxx</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.rgielen</groupId>
<artifactId>javafx-weaver-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>application.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
(Obviously the pom contains things not specifically related to this issue, but I'm including the whole file in case anything else present is causing this issue.)
Please can you let me know if you have worked out what is causing the problem? I'm tearing my hair out with this now!
Also, apologies if I've not included the right/sufficient information. This is my first post on here. I am using eclipse.
Thank you!
Maybe I'm too late to help, but:
I re-created an example based on a minimal pom and your Java code. I could not re-produce your issue, though.
Here is my pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.rgielen.sample</groupId>
<artifactId>fxweaver-springboot-starter-sample</artifactId>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.rgielen</groupId>
<artifactId>javafx-weaver-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
What concerns me with your pom
it adds a dependency on OpenJFX 12 (targeted at JDK 12), but compiles with target 1.8 - which in a Spring Boot application would be easier to define with the java.version property. When using a 1.8 JRE with embedded JavaFX (Oracle, Liberica) you would not need OpenJFX deps at all
You don't need javafx-maven-plugin when packaging as Spring Boot application.
That said, I fail to see this as root cause.
If you want to compare in detail, here's the code:
https://github.com/rgielen/fxweaver-springboot-stripped-demo
Just a brief update for anybody who finds this in future. I was unable to resolve the problem in the end, so instead went for a full refactor of the code, without the use of FxWeaver.
More labour-intensive, but the resulting code is arguably much better as a result.
I had the same problem.
I checked Spring conditions evaluation report and found this:
FxWeaverAutoConfiguration:
Did not match:
- #ConditionalOnClass did not find required class 'javafx.fxml.FXMLLoader' (OnClassCondition)
So I put dependency on javafx-fxml
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>12.0.2</version>
</dependency>
And the condition was satisfied.
This worked for me.
I'm trying to run a war file in a maven aplication.
Since I need the oauth2 b2c from azure I found this usefull code
I've never tried Spring before so I'm new about it
I tried to compile with mvn compile and JDK 1.7 as it says in github
but I got an error instead:
Cannot find symbol : Base64
Searching on internet I found it was supported by Jdk 1.8 + and by importing error so I did the import and that did the trick.
After that I did mvn package and it also did the package generating the war files and target folder.
I ran the war file java -jar azure-b2c-oauth2.war
But got this error:
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
... 1 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is org.springframework.security.config.annotation.AlreadyBuiltException: This object has already been built
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.dogjaw.services.authentication.AzureB2CApplication.main(AzureB2CApplication.java:37)
... 6 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is org.springframework.security.config.annotation.AlreadyBuiltException: This object has already been built
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 26 more
Caused by: org.springframework.security.config.annotation.AlreadyBuiltException: This object has already been built
at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:44)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:105)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$e0fe7e73.CGLIB$springSecurityFilterChain$5(<generated>)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$e0fe7e73$$FastClassBySpringCGLIB$$6961afff.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$e0fe7e73.springSecurityFilterChain(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 27 more
This is the pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dogjaw.services.authentication</groupId>
<artifactId>azure-b2c-oauth2</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Oauth2-PRoxy-Authenticator</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.artifactId}</finalName>
<executable>false</executable>
</configuration>
</plugin>
<!-- By naming the war file in each plugin (boot and war), it ensures
that only one war file will be produced. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>${project.artifactId}</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
Any help would be apreciate thanks!
below Command is not correct to run.
java -jar azure-b2c-oauth2.war
This only works for jar based packaging, If you choose to package your application as a war file you should refer to your server and IDE documentation.
Refer : http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-running-your-application.html
refer for server deployment: https://www.mkyong.com/spring-boot/spring-boot-deploy-war-file-to-tomcat/
OR
you can build package spring boot as jar using below ,
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- ... -->
<packaging>jar</packaging>
<!-- ... -->
</project>
and then use java -jar azure-b2c-oauth2.jar
Your POM.xml says WAR, either change that to Jar or use this code as is and package war and then use a server such as tomcat to unpack and run it.
You can only run jar files with java -jar filename but since your POM is set to war package, you create .war file
I have a spring project and try to make it use spring boot and to run at embadded tomcat following :
https://spring.io/guides/gs/rest-service/
This is my Application
//#Configuration
//#EnableAspectJAutoProxy
#SpringBootApplication
#ComponentScan(basePackages = "gux.prome")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
If I use maven command: mvn spring-boot:run, the project starts fine, but I need to debug , so I run this main method at InteliJ, exception occurs:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.logging.ClasspathLoggingApplicationListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:414)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:394)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:385)
at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:263)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at gux.prome.config.Application.main(Application.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/event/GenericApplicationListener
....
This is the pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gux</groupId>
<artifactId>prome-data</artifactId>
<version>1.0-SNAPSHOT</version>
<name>prome-data Maven Webapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<!-- end of guava -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
</properties>
<build>
<finalName>prome-data</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--<plugin>-->
<!-- use java 7 -->
<!--<artifactId> maven-compiler-plugin</artifactId>-->
<!--<version>3.1</version>-->
<!--<configuration>-->
<!--<source> 1.7</source> -->
<!--<target> 1.7</target>-->
<!--</configuration>-->
<!--</plugin>-->
</plugins>
</build>
<!--<repositories>-->
<!--<repository>-->
<!--<id>spring-releases</id>-->
<!--<url>http://repo.spring.io/libs-release</url>-->
<!--</repository>-->
<!--</repositories>-->
<!--<pluginRepositories>-->
<!--<pluginRepository>-->
<!--<id>spring-releases</id>-->
<!--<url>http://repo.spring.io/libs-release</url>-->
<!--</pluginRepository>-->
<!--</pluginRepositories>-->
</project>
This is a symptom of a version mismatch somewhere in your Spring dependencies, but not necessarily just Spring Boot and Spring itself. I had this between my Spring Boot parent:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath></relativePath>
</parent>
and my Spring Cloud Config dependency:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
<version>1.0.4.RELEASE</version>
</dependency>
For some reason, I am not able to define the spring-cloud-config-client dependency without an explicit version declaration.
Updating both to the latest release version (1.3.5.RELEASE and 1.1.1.RELEASE) solved it.
Conclusion
Update your dependencies to the latest correct ones
For ones using Gradle, I solved this issue setting the version of the Spring Boot Gradle Plugin in my library and in my main project to the same value:
plugins {
id("org.springframework.boot") version "2.2.2.RELEASE"
}
i had the same error , i just changed the release version of the spring boot parent and now everything works right