'Failed to process import candidates for configuration class inorder to use log4j2.17.1 while migrating SpringBoot from 1.3.6 to 2.6.3 using maven
I want my project to use log4j2.17.1 for which I need to upgrade the spring-boot version from 1.x to the latest one i.e. 2.6.3. After adding dependencies the build is running fine But while running server I am getting the error:-
ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [my_spring_project_name]; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.integration.config.IntegrationRegistrar]: Unresolvable class definition; nested exception is java.lang.ExceptionInInitializerError
This is my POM.xml file
<?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>My_Project_Name</groupId>
<artifactId>Application_Name</artifactId>
<version>1.7.0-SNAPSHOT</version>
<!-- <packaging>jar</packaging> -->
<packaging>war</packaging>
<name>Application_Name</name>
<description>Application_Description</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
<maven-surefire-plugin.version>3.0.0-M3</maven-surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<dbunit.version>2.5.0</dbunit.version>
<spring-test-dbunit.version>1.2.1</spring-test-dbunit.version>
<assertj-core.version>3.3.0</assertj-core.version>
<assertj-db.version>1.0.1</assertj-db.version>
<jtds.version>1.3.1</jtds.version>
<tomcat7-plugin.version>2.2</tomcat7-plugin.version>
<assertj-assertions-generator-plugin.version>2.0.0</assertj-assertions-generator-plugin.version>
<start-class>My_Project_Name_With_Path</start-class>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-log4j2 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> </dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</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-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.7.0-4</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-java-dsl</artifactId>
<version>1.1.3.RELEASE</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-starter-web</artifactId> -->
<!-- </dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>${jtds.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.github.springtestdbunit</groupId>
<artifactId>spring-test-dbunit</artifactId>
<version>${spring-test-dbunit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>${dbunit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-db</artifactId>
<version>${assertj-db.version}</version>
<scope>test</scope>
</dependency>
<!-- http://mvnrepository.com/artifact/org.mockito/mockito-core -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<scm>
<connection>*My_Project_Name*</connection>
</scm>
<build>
<plugins>
<plugin>
<!-- tomcat7:redeploy -->
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat7-plugin.version}</version>
<configuration>
<!-- dev-eyb -->
<url>http://10.218.184.1/manager</url>
<server>tomcat-server-dev-eyb</server>
<!-- client-eyb -->
<url>http://10.218.184.170/manager</url>
<server>tomcat-server-client-eyb</server>
<!-- prod-eyb -->
<url>http://10.218.184.171/manager</url>
<server>tomcat-server-prod-eyb</server>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- <dependencies> <dependency> <groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId> <version>1.2.6.RELEASE</version> </dependency>
</dependencies> -->
</plugin>
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
<configuration>
<!-- Enable this to push to origin using SSH keys -->
<enableSshAgent>true</enableSshAgent>
<!-- Pusing in-development features to origin allows all devs to see
what each other are working on -->
<pushFeatures>true</pushFeatures>
<!-- This allows the CI server (e.g. Jenkins) to automatically push
new releases to origin; you can then either manually deploy them or, if you
are doing Continuous Deployments, auto-deploy them to prod -->
<pushReleases>true</pushReleases>
<!-- Hot Fixes should be pushed to origin as well so that any dev can
pick them up -->
<pushHotfixes>true</pushHotfixes>
<!-- Prevents deployments from dev workstations so that they can be
done by a CI server -->
<noDeploy>true</noDeploy>
<useReleaseProfile>false</useReleaseProfile>
<!-- <flowInitContext> <masterBranchName>master</masterBranchName> <developBranchName>develop</developBranchName>
<featureBranchPrefix>feature-</featureBranchPrefix> <releaseBranchPrefix>release-</releaseBranchPrefix>
<hotfixBranchPrefix>hotfix-</hotfixBranchPrefix> <versionTagPrefix>blither-</versionTagPrefix>
</flowInitContext> -->
</configuration>
</plugin>
</plugins>
</build>
</project>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
