Home > Net >  ASM ClassReader failed to parse class file - Migration from 2.1.8.RELEASE to 2.7.7
ASM ClassReader failed to parse class file - Migration from 2.1.8.RELEASE to 2.7.7

Time:01-28

After migration from 2.1.8.RELEASE to 2.7.7, I get this error: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet. Unsupported class file major version 61

I checked java 17 is used.

The piece of code causing this error is :

public class ApplicationWebXml extends SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    /**
     * set a default to use when no profile is configured.
     */
    DefaultProfileUtil.addDefaultProfile(application.application());
    return application.sources(MyApp.class);
    }
  }

CodePudding user response:

This is probably due to an outdated Spring Framework version on your classpath. ASM's ClassReader is shaded in the spring-core module and the corresponding spring-core module with Spring Boot 2.7.x should support Java 17.

Running into this type of problems means that your application should probably apply the Spring Boot dependency management with Maven or Gradle.

  • Related