SpringApplication.run(DemoApp.class,args)发生了BeanCreationException,但它没有打印日志。为什么? (我可以让它运行,但为什么没有日志)
以下是我在调试时复制的异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [dao/spring-dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [dao/spring-dao.xml]: Cannot create inner bean 'com.github.pagehelper.PageHelper#654c1a54' of type [com.github.pagehelper.PageHelper] while setting bean property 'plugins' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.github.pagehelper.PageHelper] for bean with name 'com.github.pagehelper.PageHelper#654c1a54' defined in class path resource [dao/spring-dao.xml]; nested exception is java.lang.ClassNotFoundException: com.github.pagehelper.PageHelper
这是源代码位置。
public ConfigurableApplicationContext run(String... args) {
try{
......
}catch (Throwable ex) {
handleRunFailure(context, listeners, analyzers, ex);-------//stuck in here
throw new IllegalStateException(ex);
}
}
private void handleRunFailure(ConfigurableApplicationContext context,SpringApplicationRunListeners listeners, FailureAnalyzers analyzers,Throwable exception) {
try {
......
}catch (Exception ex) {
logger.warn("Unable to close ApplicationContext", ex);
}
ReflectionUtils.rethrowRuntimeException(exception);-------//stuck in here
}
public static void rethrowRuntimeException(Throwable ex) {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex; --------//stuck in here and then all stopped
}
if (ex instanceof Error) {
throw (Error) ex;
}
throw new UndeclaredThrowableException(ex);
}
答案 0 :(得分:-1)
我的项目使用rpc framework-dubbo进行了整合,并且发生了这种情况。我开始一个新项目,它工作正常。