深入JVM分析spring-boot应用hibernate-validator

本文解析了一个Spring Boot应用中出现的Hibernate Validator NoClassDefFoundError异常,揭示了异常背后的原因及解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题

最近排查一个spring boot应用抛出hibernate.validator NoClassDefFoundError的问题,异常信息如下:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
    at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:33) ~[hibernate-validator-5.3.5.Final.jar:5.3.5.Final]
    at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:276) ~[validation-api-1.1.0.Final.jar:na]
    at org.springframework.boot.validation.MessageInterpolatorFactory.getObject(MessageInterpolatorFactory.java:53) ~[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.autoconfigure.validation.DefaultValidatorConfiguration.defaultValidator(DefaultValidatorConfiguration.java:43) ~[spring-boot-autoconfigure-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    ... 32 common frames omitted

 

 
 

这个错误信息表面上是NoClassDefFoundError,但是实际上ConfigurationImpl这个类是在hibernate-validator-5.3.5.Final.jar里的,不应该出现找不到类的情况。

那为什么应用里抛出这个NoClassDefFoundError ?

有经验的开发人员从Could not initialize class 这个信息就可以知道,实际上是一个类在初始化时抛出的异常,比如static的静态代码块,或者static字段初始化的异常。

谁初始化了 org.hibernate.validator.internal.engine.ConfigurationImpl

但是当我们在HibernateValidator 这个类,创建ConfigurationImpl的代码块里打断点时,发现有两个线程触发了断点:

public class HibernateValidator implements ValidationProvider<HibernateValidatorConfiguration> {
    @Override
    public Configuration<?> createGenericConfiguration(BootstrapState state) {
        return new ConfigurationImpl( state );
    }
 
 

其中一个线程的调用栈是:

Thread [background-preinit] (Class load: ConfigurationImpl)
    HibernateValidator.createGenericConfiguration(BootstrapState) line: 33
    Validation$GenericBootstrapImpl.configure() line: 276
    BackgroundPreinitializer$ValidationInitializer.run() line: 107
    BackgroundPreinitializer$1.runSafely(Runnable) line: 59
    BackgroundPreinitializer$1.run() line: 52
    Thread.run() line: 745

 

 
 

另外一个线程调用栈是:

Thread [main] (Suspended (breakpoint at line 33 in HibernateValidator))
    owns: ConcurrentHashMap<K,V>  (id=52)
    owns: Object  (id=53)
    HibernateValidator.createGenericConfiguration(BootstrapState) line: 33
    Validation$GenericBootstrapImpl.configure() line: 276
    MessageInterpolatorFactory.getObject() line: 53
    DefaultValidatorConfiguration.defaultValidator() line: 43
    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
    NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
    Method.invoke(Object, Object...) line: 498
    CglibSubclassingInstantiationStrategy(SimpleInstantiationStrategy).instantiate(RootBeanDefinition, String, BeanFactory, Object, Method, Object...) line: 162
    ConstructorResolver.instantiateUsingFactoryMethod(String, RootBeanDefinition, Object[]) line: 588
    DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).instantiateUsingFactoryMethod(String, RootBeanDefinition, Object[]) line: 1173
 
 

显然,这个线程的调用栈是常见的spring的初始化过程。

BackgroundPreinitializer 做了什么

那么重点来看下 BackgroundPreinitializer 线程做了哪些事情:

@Order(LoggingApplicationListener.DEFAULT_ORDER + 1)
public class BackgroundPreinitializer
        implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {

    @Override
    public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
        try {
            Thread thread = new Thread(new Runnable() {

                @Override
                public void run() {
                    runSafely(new MessageConverterInitializer());
                    runSafely(new MBeanFactoryInitializer());
                    runSafely(new ValidationInitializer());
                    runSafely(new JacksonInitializer());
                    runSafely(new ConversionServiceInitializer());
                }

                public void runSafely(Runnable runnable) {
                    try {
                        runnable.run();
                    }
                    catch (Throwable ex) {
                        // Ignore
                    }
                }

            }, "background-preinit");
            thread.start();
        }
 
 

可以看到BackgroundPreinitializer类是spring boot为了加速应用的初始化,以一个独立的线程来加载hibernate validator这些组件。

这个 background-preinit 线程会吞掉所有的异常。

显然ConfigurationImpl 初始化的异常也被吞掉了,那么如何才能获取到最原始的信息?

获取到最原始的异常信息

BackgroundPreinitializer的 run() 函数里打一个断点(注意是Suspend thread类型, 不是Suspend VM),让它先不要触发ConfigurationImpl的加载,让spring boot的正常流程去触发ConfigurationImpl的加载,就可以知道具体的信息了。

那么打出来的异常信息是:

Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
    at org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:19) ~[hibernate-validator-5.3.5.Final.jar:5.3.5.Final]
    at org.hibernate.validator.internal.util.Version.<clinit>(Version.java:22) ~[hibernate-validator-5.3.5.Final.jar:5.3.5.Final]
    at org.hibernate.validator.internal.engine.ConfigurationImpl.<clinit>(ConfigurationImpl.java:71) ~[hibernate-validator-5.3.5.Final.jar:5.3.5.Final]
    at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:33) ~[hibernate-validator-5.3.5.Final.jar:5.3.5.Final]
    at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:276) ~[validation-api-1.1.0.Final.jar:na]
    at org.springframework.boot.validation.MessageInterpolatorFactory.getObject(MessageInterpolatorFactory.java:53) ~[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]

 

 
 

那么可以看出是 org.jboss.logging.Logger 这个类不兼容,少了getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object 这个函数。

那么检查下应用的依赖,可以发现org.jboss.logging.Logger 在jboss-common-1.2.1.GA.jarjboss-logging-3.3.1.Final.jar里都有。

显然是jboss-common-1.2.1.GA.jar 这个依赖过时了,需要排除掉。

总结异常的发生流程

  1. 应用依赖了jboss-common-1.2.1.GA.jar,它里面的org.jboss.logging.Logger太老
  2. spring boot启动时,BackgroundPreinitializer里的线程去尝试加载ConfigurationImpl,然后触发了org.jboss.logging.Logger的函数执行问题
  3. BackgroundPreinitializer 吃掉了异常信息,jvm把ConfigurationImpl标记为不可用的
  4. spring boot正常的流程去加载ConfigurationImpl,jvm发现ConfigurationImpl类是不可用,直接抛出NoClassDefFoundError

    “` 
    Caused by: Java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl 
    ““

深入JVM

为什么第二次尝试加载ConfigurationImpl时,会直接抛出java.lang.NoClassDefFoundError: Could not initialize class ?

下面用一段简单的代码来重现这个问题:

try {
  org.hibernate.validator.internal.util.Version.touch();
} catch (Throwable e) {
  e.printStackTrace();
}
System.in.read();

try {
  org.hibernate.validator.internal.util.Version.touch();
} catch (Throwable e) {
  e.printStackTrace();
}
 
 

使用HSDB来确定类的状态

当抛出第一个异常时,尝试用HSDB来看下这个类的状态。

sudo java -classpath "$JAVA_HOME/lib/sa-jdi.jar" sun.jvm.hotspot.HSDB

 

然后在HSDB console里查找到Version的地址信息

hsdb> class org.hibernate.validator.internal.util.Version
org/hibernate/validator/internal/util/Version @0x00000007c0060218

 

然后在Inspector查找到这个地址,发现_init_state是5。

hsfdb-version-class.png

再看下hotspot代码,可以发现5对应的定义是initialization_error

// /hotspot/src/share/vm/oops/instanceKlass.hpp
// See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description
// of the class loading & initialization procedure, and the use of the states.
enum ClassState {
  allocated,                          // allocated (but not yet linked)
  loaded,                             // loaded and inserted in class hierarchy (but not linked yet)
  linked,                             // successfully linked/verified (but not initialized yet)
  being_initialized,                  // currently running class initializer
  fully_initialized,                  // initialized (successfull final state)
  initialization_error                // error happened during initialization
};
 
 

JVM规范里关于Initialization的内容

http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.5

从规范里可以看到初始一个类/接口有12步,比较重要的两步都用黑体标记出来了:

    1. If the Class object for C is in an erroneous state, then initialization is not possible. Release LC and throw a NoClassDefFoundError.
    1. Otherwise, the class or interface initialization method must have completed abruptly by throwing some exception E. If the class of E is not Error or one of its subclasses, then create a new instance of the class ExceptionInInitializerError with E as the argument, and use this object in place of E in the following step.

第一次尝试加载Version类时

当第一次尝试加载时,hotspot InterpreterRuntime在解析invokestatic指令时,尝试加载org.hibernate.validator.internal.util.Version类,InstanceKlass_init_state先是标记为being_initialized,然后当加载失败时,被标记为initialization_error

对应Initialization的11步。

// hotspot/src/share/vm/oops/instanceKlass.cpp
// Step 10 and 11
Handle e(THREAD, PENDING_EXCEPTION);
CLEAR_PENDING_EXCEPTION;
// JVMTI has already reported the pending exception
// JVMTI internal flag reset is needed in order to report ExceptionInInitializerError
JvmtiExport::clear_detected_exception((JavaThread*)THREAD);
{
  EXCEPTION_MARK;
  this_oop->set_initialization_state_and_notify(initialization_error, THREAD);
  CLEAR_PENDING_EXCEPTION;   // ignore any exception thrown, class initialization error is thrown below
  // JVMTI has already reported the pending exception
  // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError
  JvmtiExport::clear_detected_exception((JavaThread*)THREAD);
}
DTRACE_CLASSINIT_PROBE_WAIT(error, InstanceKlass::cast(this_oop()), -1,wait);
if (e->is_a(SystemDictionary::Error_klass())) {
  THROW_OOP(e());
} else {
  JavaCallArguments args(e);
  THROW_ARG(vmSymbols::java_lang_ExceptionInInitializerError(),
            vmSymbols::throwable_void_signature(),
            &args);
}
 
 

第二次尝试加载Version类时

当第二次尝试加载时,检查InstanceKlass_init_stateinitialization_error,则直接抛出NoClassDefFoundError: Could not initialize class.

对应Initialization的5步。

// hotspot/src/share/vm/oops/instanceKlass.cpp
void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) {
// ...
    // Step 5
    if (this_oop->is_in_error_state()) {
      DTRACE_CLASSINIT_PROBE_WAIT(erroneous, InstanceKlass::cast(this_oop()), -1,wait);
      ResourceMark rm(THREAD);
      const char* desc = "Could not initialize class ";
      const char* className = this_oop->external_name();
      size_t msglen = strlen(desc) + strlen(className) + 1;
      char* message = NEW_RESOURCE_ARRAY(char, msglen);
      if (NULL == message) {
        // Out of memory: can't create detailed error message
        THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);
      } else {
        jio_snprintf(message, msglen, "%s%s", desc, className);
        THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message);
      }
    }
 
 

总结

  • spring boot在BackgroundPreinitializer类里用一个独立的线程来加载validator,并吃掉了原始异常
  • 第一次加载失败的类,在jvm里会被标记为initialization_error,再次加载时会直接抛出NoClassDefFoundError: Could not initialize class
  • 当在代码里吞掉异常时要谨慎,否则排查问题带来很大的困难
  • http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.5

http://blog.youkuaiyun.com/hengyunabc/article/details/71513509

E:\jdk17\bin\java.exe -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:E:\Java Web\IntelliJ IDEA 2023.3.1\lib\idea_rt.jar=54988:E:\Java Web\IntelliJ IDEA 2023.3.1\bin" -Dfile.encoding=UTF-8 -classpath "E:\web projects\StuInfoSystem-master\target\classes;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\webjars\bootstrap\4.0.0\bootstrap-4.0.0.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\webjars\npm\popper.js\1.11.1\popper.js-1.11.1.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\webjars\jquery\3.3.1\jquery-3.3.1.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-jdbc\1.5.10.RELEASE\spring-boot-starter-jdbc-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\apache\tomcat\tomcat-jdbc\8.5.27\tomcat-jdbc-8.5.27.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\apache\tomcat\tomcat-juli\8.5.27\tomcat-juli-8.5.27.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-jdbc\4.3.14.RELEASE\spring-jdbc-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-tx\4.3.14.RELEASE\spring-tx-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\mysql\mysql-connector-java\8.0.11\mysql-connector-java-8.0.11.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\google\protobuf\protobuf-java\2.6.0\protobuf-java-2.6.0.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-thymeleaf\1.5.10.RELEASE\spring-boot-starter-thymeleaf-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\thymeleaf\thymeleaf-spring4\3.0.9.RELEASE\thymeleaf-spring4-3.0.9.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\thymeleaf\thymeleaf\3.0.9.RELEASE\thymeleaf-3.0.9.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\attoparser\attoparser\2.0.4.RELEASE\attoparser-2.0.4.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\unbescape\unbescape\1.1.5.RELEASE\unbescape-1.1.5.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\nz\net\ultraq\thymeleaf\thymeleaf-layout-dialect\2.2.2\thymeleaf-layout-dialect-2.2.2.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\nz\net\ultraq\thymeleaf\thymeleaf-expression-processor\1.1.3\thymeleaf-expression-processor-1.1.3.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\codehaus\groovy\groovy\2.4.13\groovy-2.4.13.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\alibaba\druid\1.1.8\druid-1.1.8.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.1\mybatis-spring-boot-starter-1.3.1.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.1\mybatis-spring-boot-autoconfigure-1.3.1.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\mybatis\mybatis\3.4.5\mybatis-3.4.5.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\mybatis\mybatis-spring\1.3.1\mybatis-spring-1.3.1.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\junit\junit\4.12\junit-4.12.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-configuration-processor\1.5.10.RELEASE\spring-boot-configuration-processor-1.5.10.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\apache\ibatis\ibatis-core\3.0\ibatis-core-3.0.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\org\springframework\spring-expression\4.3.16.RELEASE\spring-expression-4.3.16.RELEASE.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\github\pagehelper\pagehelper-spring-boot-starter\1.2.10\pagehelper-spring-boot-starter-1.2.10.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.2.10\pagehelper-spring-boot-autoconfigure-1.2.10.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\github\pagehelper\pagehelper\5.1.8\pagehelper-5.1.8.jar;E:\Java Web\javawebb\maven\apache-maven-3.9.9\maven-repo\com\github\jsqlparser\jsqlparser\1.2\jsqlparser-1.2.jar" com.lc.demo.DemoApplication . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.10.RELEASE) 2025-06-16 21:30:29.153 INFO 27400 --- [ main] com.lc.demo.DemoApplication : Starting DemoApplication on Cui with PID 27400 (started by 19811 in E:\web projects\StuInfoSystem-master) 2025-06-16 21:30:29.159 INFO 27400 --- [ main] com.lc.demo.DemoApplication : No active profile set, falling back to default profiles: default 2025-06-16 21:30:29.441 INFO 27400 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5a9f4771: startup date [Mon Jun 16 21:30:29 CST 2025]; root of context hierarchy 2025-06-16 21:30:30.143 ERROR 27400 --- [ main] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalStateException: Cannot load configuration class: com.lc.demo.DemoApplication at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:249) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:127) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at com.lc.demo.DemoApplication.main(DemoApplication.java:12) ~[classes/:na] Caused by: java.lang.ExceptionInInitializerError: null at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:122) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:393) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] ... 12 common frames omitted Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @59309333 at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na] at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:174) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:153) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] ... 15 common frames omitted Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @59309333 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na] at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na] at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[na:na] at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) ~[na:na] at org.springframework.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) ~[na:na] at org.springframework.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] ... 27 common frames omitted 2025-06-16 21:30:30.144 INFO 27400 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5a9f4771: startup date [Mon Jun 16 21:30:29 CST 2025]; root of context hierarchy 进程已结束,退出代码为 1
最新发布
06-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值