ClassNotFoundException while JedisClient initialization in Spring Boot 2.5.4 application - java

I have a Spring Boot 2.5.4 application in which I would like to add Redis and access it via Spring Data Redis. My current configuration looks like this:
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath/>
</parent>
<groupId>com.application</groupId>
<artifactId>ApiGateway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ApiGateway</name>
<description>ApiGateway</description>
<properties>
<java.version>15</java.version>
<spring-boot-starter-redis.version>2.5.0</spring-boot-starter-redis.version>
<redis.version>3.1.0</redis.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</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-data-redis</artifactId>
<version>${spring-boot-starter-redis.version}</version>
</dependency>
<!-- OTHER DEPENDENCIES -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${redis.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-cognitoidp</artifactId>
<version>${aws.sdk.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws.sdk.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>${aws.sdk.version}</version>
</dependency>
<!-- OTHER DEPENDENCIES -->
</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>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
RedisConfiguration.java
#Configuration
#PropertySource("classpath:redis.properties")
public class RedisConfiguration {
#Value("${redis.host}")
private String host;
#Value("${redis.port}")
private int port;
#Value("${redis.database}")
private int database;
#Value("${redis.password}")
private String password;
#Value("${redis.timeout}")
private String timeout;
#Bean
public JedisConnectionFactory jedisConnectionFactory() {
RedisStandaloneConfiguration redisConfiguration = new RedisStandaloneConfiguration();
redisConfiguration.setHostName(host);
redisConfiguration.setPort(port);
redisConfiguration.setDatabase(database);
redisConfiguration.setPassword(RedisPassword.of(password));
JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder();
jedisClientConfiguration.connectTimeout(Duration.ofMillis(Long.parseLong(timeout)));
return new JedisConnectionFactory(redisConfiguration, jedisClientConfiguration.build());
}
#Bean
public RedisTemplate<String, Object> redisTemplate() {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(jedisConnectionFactory());
return template;
}
}
for current configuration while application start I am receiving
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.core.RedisTemplate]: Factory method 'redisTemplate' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisConnectionFactory' defined in class path resource [com/application/apigateway/intrastructure/cache/RedisConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'jedisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: redis/clients/jedis/DefaultJedisClientConfig
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 33 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisConnectionFactory' defined in class path resource [com/application/apigateway/intrastructure/cache/RedisConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'jedisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: redis/clients/jedis/DefaultJedisClientConfig
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:362)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334)
at com.application.apigateway.intrastructure.cache.RedisConfiguration$$EnhancerBySpringCGLIB$$63c8a244.jedisConnectionFactory(<generated>)
at com.application.apigateway.intrastructure.cache.RedisConfiguration.redisTemplate(RedisConfiguration.java:51)
at com.application.apigateway.intrastructure.cache.RedisConfiguration$$EnhancerBySpringCGLIB$$63c8a244.CGLIB$redisTemplate$0(<generated>)
at com.application.apigateway.intrastructure.cache.RedisConfiguration$$EnhancerBySpringCGLIB$$63c8a244$$FastClassBySpringCGLIB$$c9ce6595.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.application.apigateway.intrastructure.cache.RedisConfiguration$$EnhancerBySpringCGLIB$$63c8a244.redisTemplate(<generated>)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 34 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'jedisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: redis/clients/jedis/DefaultJedisClientConfig
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 57 common frames omitted
Caused by: java.lang.NoClassDefFoundError: redis/clients/jedis/DefaultJedisClientConfig
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.<init>(JedisConnectionFactory.java:97)
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.<init>(JedisConnectionFactory.java:232)
at com.application.apigateway.intrastructure.cache.RedisConfiguration.jedisConnectionFactory(RedisConfiguration.java:45)
at com.application.apigateway.intrastructure.cache.RedisConfiguration$$EnhancerBySpringCGLIB$$63c8a244.CGLIB$jedisConnectionFactory$1(<generated>)
at com.application.apigateway.intrastructure.cache.RedisConfiguration$$EnhancerBySpringCGLIB$$63c8a244$$FastClassBySpringCGLIB$$c9ce6595.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.application.apigateway.intrastructure.cache.RedisConfiguration$$EnhancerBySpringCGLIB$$63c8a244.jedisConnectionFactory(<generated>)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 58 common frames omitted
Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.DefaultJedisClientConfig
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 71 common frames omitted
So far I have tried manipulating the redis.clients and spring-boot-starter-data-redis versions by decreasing and increasing it but always problems with initialization occur. Every single tutorial which I found doesn't contain configuration for the new Spring Boot application version. I Will be grateful for suggestions on how to manipulate the pom.xml version of redis.clients and spring-boot-starter-data-redis to make the application starts again.

spring-boot-starter-data-redis already includes jedis as a dependency so you shouldn't add it to your pom.xml with a version that might not be compatible with your spring-boot-starter-data-redis.
In the case of spring-boot-starter-data-redis version 2.5.0, it includes jedis version 3.6.3 but you override this with version 3.1.0, which might not be compatible with spring-boot-starter-data-redis version 2.5.0.
Always check the dependencies already included in the Spring Boot Starters because incompatibilities are exactly what they try to avoid.
Having said all that, I am not completely sure that this will solve the issue, but it is a good place to start.
Update 26/01/2022
The spring-boot-starter-data-redis dependency pom.xml includes the following dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.5.1</version>
<scope>compile</scope>
</dependency>
This spring-data-redis dependency pom.xml already includes jedis version:
<properties>
(...)
<jedis>3.6.0</jedis>
(...)
</properties>
And the dependency itself:
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${jedis}</version>
<optional>true</optional>
</dependency>
This means that you should only add the dependency to your pom.xml but set no version so that the one set in spring-data-redis is used as follows:
<dependencies>
(...)
<!-- OTHER DEPENDENCIES -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
(...)
<!-- OTHER DEPENDENCIES -->
</dependencies>

Spent several hours, so posting for spring boot versions 2.7.3 to be helpful for others.
spring-boot-starter-data-redis uses lettuce by default instead of jedis client. You would have to exclude lettuce and include jedis instead.
implementation ('org.springframework.boot:spring-boot-starter-data-redis') {
exclude group: 'io.lettuce.lettuce-core'
}
implementation 'com.github.houbb:redis-client-jedis:0.0.3'```

Related

Error when configuring the Sql server 2019 database in Spring boot 2

file Application.properties
spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=pim
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.jpa.hibernate.ddl-auto = create
file 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.pimunip</groupId>
<artifactId>unipPim</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>unipPim</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.5.Final</version>
</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.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
ERROR
ror starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-04 13:23:07.752 ERROR 8876 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instantiateDatabase' defined in class path resource [com/pimunip/lucas/config/DevConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [boolean]: Factory method 'instantiateDatabase' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoriaRepository' defined in com.pimunip.lucas.repositories.CategoriaRepository defined in #EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:483) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
at com.pimunip.lucas.UnipPimApplication.main(UnipPimApplication.java:13) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.3.4.RELEASE.jar:2.3.4.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [boolean]: Factory method 'instantiateDatabase' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoriaRepository' defined in com.pimunip.lucas.repositories.CategoriaRepository defined in #EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
... 25 common frames omitted
Open SQL Server Configuration Manager(Search from windows toolbar search), and then expand SQL Server 2019 Network Configuration.
Click Protocols for InstanceName, and
then make sure TCP/IP is enabled in the right panel and double-click
TCP/IP and also notice the value of the Listen All item.
Click the IP Addresses tab:
If the value of Listen All is yes,
the TCP/IP port number for this instance of SQL Server 2019 should be 1433.
Click OK
Restart the MS SQL Instance from service.

Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' on Heroku Server

Environment
Java : 11
Spring Boot : 2.4.0
MyBatis:2.1.3
redis:2.4.0
I try to use redis.
It works successful in a development environment.
but when I deployed it in the Heroku Server, It fails to start.
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</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-aop</artifactId>
</dependency>
<!-- パスワードハッシュ化 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- orika-core -->
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>1.5.4</version>
</dependency>
<!-- commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- Java Mail API -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<!-- postgres -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- flyway -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>6.5.0</version>
</dependency>
<!-- Thyemeleaf拡張(セキュリティ) -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<!-- webjars-locator -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.40</version>
</dependency>
<!-- marked -->
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>marked</artifactId>
<version>1.1.0</version>
</dependency>
<!-- highlightjs -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>highlightjs</artifactId>
<version>9.15.10</version>
</dependency>
<!-- vue -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>vue</artifactId>
<version>2.6.11</version>
</dependency>
<!-- element ui -->
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>element-ui</artifactId>
<version>2.13.2</version>
</dependency>
<!-- vue-chartjs -->
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>github-com-apertureless-vue-chartjs</artifactId>
<version>3.3.2</version>
</dependency>
<!-- chartjs -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>chartjs</artifactId>
<version>2.8.0</version>
</dependency>
<!-- bootstrap -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>4.5.0</version>
</dependency>
<!-- jquery -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.5.1</version>
</dependency>
<!-- exclude junit 4 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.terasoluna.gfw</groupId>
<artifactId>terasoluna-gfw-jodatime</artifactId>
<version>5.6.0.RELEASE</version>
</dependency>
<!-- junit 5 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
</dependency>
<!-- NoSQL Redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
</dependencies>
import javax.sql.DataSource;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.boot.autoconfigure.MybatisProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;
import jp.co.code_reminder.app.question.QuestionReviewCategoryForm;
import jp.co.code_reminder.domain.model.question.ReviewHistory;
import lombok.val;
#Configuration
#EnableTransactionManagement
public class SqlConfig implements TransactionManagementConfigurer {
#Autowired
private RedisConnectionFactory redisConnectionFactory;
#Autowired
private DataSource dataSource;
#Bean
public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(this.dataSource);
}
#Bean
public SqlSessionFactoryBean sqlSessionFactoryBean(final MybatisProperties mybatisProperties) {
val sqlSessionFactoryBean = new SqlSessionFactoryBean();
val resolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setConfigLocation(resolver.getResource(mybatisProperties.getConfigLocation()));
sqlSessionFactoryBean.setDataSource(this.dataSource);
return sqlSessionFactoryBean;
}
#Bean(name = "redisQrcTemplate")
public RedisTemplate<String, QuestionReviewCategoryForm> redisQrcTemplate() {
val redisTemplate = new RedisTemplate<String, QuestionReviewCategoryForm>();
redisTemplate.setConnectionFactory(this.redisConnectionFactory);
return redisTemplate;
}
#Bean(name = "redisReviewHistoryTemplate")
public RedisTemplate<String, ReviewHistory> redisReviewHistoryTemplate() {
val redisTemplate = new RedisTemplate<String, ReviewHistory>();
redisTemplate.setConnectionFactory(this.redisConnectionFactory);
return redisTemplate;
}
#Override
public PlatformTransactionManager annotationDrivenTransactionManager() {
return transactionManager();
}
}
#Only written dataSource and redis configuration.
#DataSource
spring.jpa.database=POSTGRESQL
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url = ${DATABASE_JDBC_URL}
spring.datasource.username = ${DATABASE_USER}
spring.datasource.password = ${DATABASE_PASSWORD}
#redis
spring.session.store-type=redis
spring.redis.url=${REDIS_URL}
spring.redis.host=${REDIS_HOST}
spring.redis.user=${REDIS_USER}
spring.redis.password=${REDIS_PASSWORD}
spring.redis.port=${REDIS_PORT}
spring.redis.ssl=true
spring.redis.database=0
spring.redis.pool.max-active=8
spring.redis.pool.max-wait=-1
spring.redis.pool.max-idle=8
spring.redis.pool.min-idle=0
spring.redis.timeout=0
Error message as below.
Exception in thread "main" org.apache.catalina.LifecycleException: A child container failed during start
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
: at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
: at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
: at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
: at org.apache.catalina.startup.Tomcat.start(Tomcat.java:459)
: at webapp.runner.launch.Main.main(Main.java:289)
: Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
: at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
: at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
: ... 8 more
: Caused by: org.apache.catalina.LifecycleException: A child container failed during start
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928)
: at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
: at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
: at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
: at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
: ... 8 more
: Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
: at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
: at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
: ... 16 more
: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
: at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
: at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
: at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
: at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
: ... 16 more
: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' defined in class path resource [org/springframework/data/web/config/ProjectingArgumentResolverRegistrar.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: Unsatisfied dependency expressed through method 'transactionAdvisor' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionInterceptor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.TransactionInterceptor]: Factory method 'transactionInterceptor' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method 'io.reactivex.Flowable io.reactivex.Flowable.fromPublisher(org.reactivestreams.Publisher)' the class loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c of the current class, org/springframework/core/ReactiveAdapterRegistry$RxJava2Registrar, and the class loader 'app' for the method's defining class, io/reactivex/Flowable, have different Class objects for the type org/reactivestreams/Publisher used in the signature (org.springframework.core.ReactiveAdapterRegistry$RxJava2Registrar is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c, parent loader 'app'; io.reactivex.Flowable is in unnamed module of loader 'app')
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:526)
: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
: at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:244)
: at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:767)
: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:572)
: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:751)
: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:410)
: at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:173)
: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:153)
: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:95)
: at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
: ... 22 more
: Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: Unsatisfied dependency expressed through method 'transactionAdvisor' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionInterceptor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.TransactionInterceptor]: Factory method 'transactionInterceptor' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method 'io.reactivex.Flowable io.reactivex.Flowable.fromPublisher(org.reactivestreams.Publisher)' the class loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c of the current class, org/springframework/core/ReactiveAdapterRegistry$RxJava2Registrar, and the class loader 'app' for the method's defining class, io/reactivex/Flowable, have different Class objects for the type org/reactivestreams/Publisher used in the signature (org.springframework.core.ReactiveAdapterRegistry$RxJava2Registrar is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c, parent loader 'app'; io.reactivex.Flowable is in unnamed module of loader 'app')
: at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798)
: at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
: at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91)
: at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:111)
: at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors(AnnotationAwareAspectJAutoProxyCreator.java:92)
: at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:101)
: at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:251)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1144)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1119)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
: ... 40 more
: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionInterceptor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.TransactionInterceptor]: Factory method 'transactionInterceptor' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method 'io.reactivex.Flowable io.reactivex.Flowable.fromPublisher(org.reactivestreams.Publisher)' the class loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c of the current class, org/springframework/core/ReactiveAdapterRegistry$RxJava2Registrar, and the class loader 'app' for the method's defining class, io/reactivex/Flowable, have different Class objects for the type org/reactivestreams/Publisher used in the signature (org.springframework.core.ReactiveAdapterRegistry$RxJava2Registrar is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c, parent loader 'app'; io.reactivex.Flowable is in unnamed module of loader 'app')
: at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
: at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
: at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1367)
: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1287)
: at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)
: at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
: ... 57 more
: Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.TransactionInterceptor]: Factory method 'transactionInterceptor' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method 'io.reactivex.Flowable io.reactivex.Flowable.fromPublisher(org.reactivestreams.Publisher)' the class loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c of the current class, org/springframework/core/ReactiveAdapterRegistry$RxJava2Registrar, and the class loader 'app' for the method's defining class, io/reactivex/Flowable, have different Class objects for the type org/reactivestreams/Publisher used in the signature (org.springframework.core.ReactiveAdapterRegistry$RxJava2Registrar is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c, parent loader 'app'; io.reactivex.Flowable is in unnamed module of loader 'app')
: at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
: at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
: ... 71 more
: Caused by: java.lang.LinkageError: loader constraint violation: when resolving method 'io.reactivex.Flowable io.reactivex.Flowable.fromPublisher(org.reactivestreams.Publisher)' the class loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c of the current class, org/springframework/core/ReactiveAdapterRegistry$RxJava2Registrar, and the class loader 'app' for the method's defining class, io/reactivex/Flowable, have different Class objects for the type org/reactivestreams/Publisher used in the signature (org.springframework.core.ReactiveAdapterRegistry$RxJava2Registrar is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader #340da44c, parent loader 'app'; io.reactivex.Flowable is in unnamed module of loader 'app')
: at org.springframework.core.ReactiveAdapterRegistry$RxJava2Registrar.registerAdapters(ReactiveAdapterRegistry.java:260)
: at org.springframework.core.ReactiveAdapterRegistry.<init>(ReactiveAdapterRegistry.java:91)
: at org.springframework.core.ReactiveAdapterRegistry.getSharedInstance(ReactiveAdapterRegistry.java:195)
: at org.springframework.transaction.interceptor.TransactionAspectSupport.<init>(TransactionAspectSupport.java:185)
: at org.springframework.transaction.interceptor.TransactionInterceptor.<init>(TransactionInterceptor.java:63)
: at org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration.transactionInterceptor(ProxyTransactionManagementConfiguration.java:65)
: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
: at java.base/java.lang.reflect.Method.invoke(Method.java:566)
: at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
: ... 72 more
I defined transactionInterceptor in SqlConfig.java.
but It's not change.
Checklist:
・Is redis defined way right?
・Is #EnableTransactionManagement defined way right?
→I hadn't defined #EnableTransactionManagement that until now.
but I can use #Transactional annotation.
I look forward to your answer.
Thank you.

ClassNotFoundException: com.netflix.config.CachedDynamicIntProperty for SpringBoot 2 ribbon starter

There is SpringBoot 2.1.4.RELEASE application with spring-cloud-starter-netflix-ribbon 2.1.1.RELEASE dependency.
Trying to run spring integration test (using #SpringBootTest) during test application startup such an exception is thrown:
Caused by: java.lang.ClassNotFoundException:com.netflix.config.CachedDynamicIntProperty
Maven cloud dependencies used in project:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
</parent>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
Test property file:
feign.hystrix.enabled=true
eureka.client.enabled=false
ribbon.eureka.enabled=false
some-my-mocked-service.ribbon.listOfServers=localhost:${mocked.port}
Exception:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.loadbalancer.ILoadBalancer]: Factory method 'ribbonLoadBalancer' threw exception; nested exception is java.lang.NoClassDefFoundError: Lcom/netflix/config/CachedDynamicIntProperty;
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622)
Run mvn dependency:tree -Dverbose and check the tree for versions conflict - looks like spring-cloud-starter-openfeign and spring-cloud-starter-netflix-ribbon artifacts use different versions of archaius-core.

Spring boot with JOOQ got a message "required a bean of type 'org.jooq.DSLContext' that could not be found"

I created a simple project with spring boot and JOOQ, added dependency "spring-boot-starter-jooq". The application failed to start when I compiled.
Here 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.bingo</groupId>
<artifactId>api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>api</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jooq</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hashids</groupId>
<artifactId>hashids</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<configuration>
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://123.123.123.123:3306/dbname</url>
<user>root</user>
<password>password</password>
</jdbc>
<generator>
<database>
<name>org.jooq.util.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>dbname</inputSchema>
<forcedTypes>
<forcedType>
<name>CustomUUID</name>
<types>binary.*</types>
</forcedType>
<forcedType>
<name>Geometry</name>
<types>(geometry|GEOMETRY)</types>
</forcedType>
</forcedTypes>
<properties>
<property>
<key>packages</key>
<value>com.bingo.api.entity</value>
</property>
</properties>
</database>
<generate>
<pojos>true</pojos>
</generate>
</generator>
</configuration>
</plugin>
</plugins>
</build>
</project>
This is where I want to inject DSLContext:
#Service
public class GameDao {
private final DSLContext create;
#Autowired
public GameDao(DSLContext dslContext) {
this.create = dslContext;
}
}
Error Message:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gameDao' defined in file [/Users/yangzhiwei/Downloads/BingoApi/target/classes/com/bingo/api/dao/GameDao.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.jooq.DSLContext' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
/***************************
APPLICATION FAILED TO START
/***************************
Description: Parameter 0 of constructor in com.bingo.api.dao.GameDao required a bean of type 'org.jooq.DSLContext' that could not be found.
Action: Consider defining a bean of type 'org.jooq.DSLContext' in your configuration.
Any help please?
Update:
1.I added properties in application.properties file like this:
spring.datasource.url==jdbc:mysql://123.123.123.123:3306/bingo
spring.datasource.user=username
spring.datasource.password=password
2.I added jooqConfiguration class.
Now got another error message:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jooqConfiguration': Unsatisfied dependency expressed through field 'dataSource'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
***************************
APPLICATION FAILED TO START
***************************
Description:
Field dataSource in com.bingo.api.config.JooqConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
- Bean method 'dataSource' not loaded because #ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
- Bean method 'dataSource' not loaded because #ConditionalOnClass did not find required class 'javax.transaction.TransactionManager'
One reason why people using Spring Boot 2.4 or 2.5 with jOOQ 3.15+ may run into this message:
No qualifying bean of type 'org.jooq.DSLContext' available: expected at least 1 bean which qualifies as autowire candidate.
... is because jOOQ 3.15 has a new R2DBC dependency, and Spring Boot 2.4 / 2.5 isn't ready yet for third parties that work with both JDBC and R2DBC, see also How to fix "Consider defining a bean of type 'org.jooq.DSLContext' in your configuration." after update to jOOQ 3.15.0
Most users aren't using R2DBC, so you can just exclude the R2dbcAutoConfiguration (watch out for typos. It's not R2dbcDataAutoConfiguration):
#SpringBootApplication(exclude = { R2dbcAutoConfiguration.class })
You need to instantiate the DSLContext.
First add the properties:
spring.datasource.url=jdbc:h2:~/jooq
spring.datasource.username=sa
spring.datasource.password=xxx
EDIT: As per jhyot's comment... adding the configuration should be good enough, since the DSLContext will be created for you by JooqAutoConfiguration.
Optional: Add the configuration to create the DSLContext bean. Here is an example.
#Configuration
public class JooqConfiguration {
#Autowired
private DataSource dataSource;
#Bean
public DataSourceConnectionProvider connectionProvider() {
return new DataSourceConnectionProvider
(new TransactionAwareDataSourceProxy(dataSource));
}
#Bean
public DefaultDSLContext dsl() {
return new DefaultDSLContext(configuration());
}
public DefaultConfiguration configuration() {
DefaultConfiguration jooqConfiguration = new DefaultConfiguration();
jooqConfiguration.set(connectionProvider());
jooqConfiguration
.set(new DefaultExecuteListenerProvider(exceptionTransformer()));
return jooqConfiguration;
}
}
Reference: http://www.baeldung.com/spring-boot-support-for-jooq
Just exclude R2dbc
#SpringBootApplication(exclude = { R2dbcAutoConfiguration.class })
I've reproduced the same issue as:
Caused by: java.lang.ClassNotFoundException: org.jooq.DSLContext
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
... 11 common frames omitted
And it was fixed after adding in POM:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jooq</artifactId>
<version>2.7.1</version>
</dependency>
even without the usage of:
#SpringBootApplication(exclude = { R2dbcAutoConfiguration.class })
and any additional configurations.

how to run a war file in maven application?

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

Categories

Resources