I try to upgrade my springboot project from 2.2.7.RELEASE to 2.5.6. But got this error when try to start up project:

Exception in thread "main" java.lang.VerifyError: StackMapTable error: bad offset
Exception Details:
  Location:
    org/apache/commons/logging/LogAdapter.<clinit>()V @0: aconst_null
  Reason:
    Invalid stackmap specification.
  Current Frame:
    bci: @33
    flags: { }
    locals: { }
    stack: { }
  Bytecode:
    0x0000000: 0112 7612 78b8 007e 120d b800 0e99 0025
    0x0000010: 120f b800 0e99 0014 1210 b800 0e99 000c
    0x0000020: b200 11b3 0003 a700 34b2 0012 b300 03a7
    0x0000030: 002b 1210 b800 0e99 000c b200 11b3 0003
    0x0000040: a700 1a12 13b8 000e 9900 0cb2 0014 b300
    0x0000050: 03a7 0009 b200 15b3 0003 b1            
  Stackmap Table:
    same_frame(@33)
    same_frame(@42)
    same_frame(@59)
    same_frame(@76)
    same_frame(@82)

    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
    at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:201)
    at com.xxxx.tdp.WebApp.main(WebApp.java:31)

It seems something wrong related to log4j2, can anyone help?

The following 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 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.6</version>
        <relativePath/>
    </parent>

    <groupId>com.xx.xxx</groupId>
    <artifactId>web-service</artifactId>
    <version>1.0</version>
    <name>web-service</name>

    <properties>
        <maven.test.skip>true</maven.test.skip>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <swagger.version>3.0.0</swagger.version>
        <spring-boot.version>2.5.6</spring-boot.version>
        <mybatis.spring.boot.version>2.2.0</mybatis.spring.boot.version>
        <pagehelper.spring.boot.version>1.4.1</pagehelper.spring.boot.version>
        <es.version>7.14.0</es.version>
        <guava.version>30.1-jre</guava.version>
        <jackson.version>2.12.4</jackson.version>
        <junit.version>4.13.1</junit.version>
    </properties>

    <dependencies>
        <!-- test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- spring boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>${spring-boot.version}</version>
            <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-web</artifactId>
            <version>${spring-boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>${spring-boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
            <version>${spring-boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${spring-boot.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- spring boot mybatis -->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>${mybatis.spring.boot.version}</version>
        </dependency>
        <!-- spring boot mybatis pagehelper -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>${pagehelper.spring.boot.version}</version>
        </dependency>

        <!-- HikariCP -->
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>3.4.5</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.16</version>
        </dependency>

        <!-- swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>${swagger.version}</version>
        </dependency>

        <!-- elasticsearch -->
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>${es.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>${es.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client-sniffer</artifactId>
            <version>${es.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>${es.version}</version>
        </dependency>

        <!-- jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.16</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.6</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.5.6</version>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

Comment From: wilkinsona

An app with the same dependencies as you are using works fine for me.

Your problem looks to be caused either by a JVM bug or the corruption of the class file for org.apache.commons.logging.LogAdapter. I think the latter is the more likely. Both are out of Spring Boot's control so there's not much more we can do to help you here.

You could identify the jar from which LogAdapter is being loaded (I suspect it'll be spring-jcl) and verify its contents or even just delete it and rebuild to force Maven to download it again. You may also want to upgrade to Spring Boot 2.5.7. This will upgrade to Spring Framework 5.3.13, triggering a download of a new version of spring-jcl.

Comment From: luxiaoxun

@wilkinsona After I delete spring-jcl from my maven repo and download it again, it works now. Thanks.