遇到了很奇怪的事情,项目里有个类A无论是在Spring,Struts中都没有被配置(已经反复确认了一下午了)
通过IDEA的Alt + F7 清除了其他类对该类的依赖,清除了该类的注解,直到Alt+F7找不到引用,等于说这个类A就是一个完全独立没有被任何引用的类,如下图
而且我还将类本身写了空类,事实上已经隔离了hibernate,spring和struts的配置也是保证启动的最小配置,不删除该类项目能正常启动,只要删了他,或者network包下的另外两个类,就会报相同的错,感觉就像赖着不走一样,但network包下的其他类,包括曾经有一个基类也能被正常删除
错误还不是一般的ClassNotFound这种错误,我也没见过这个错误,尝试过升级降级log4j、spring、struts的版本都不行
23-Nov-2018 20:15:50.094 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
java.lang.ExceptionInInitializerError
at org.apache.logging.log4j.core.impl.Log4jLogEvent.createContextData(Log4jLogEvent.java:472)
at org.apache.logging.log4j.core.impl.Log4jLogEvent.(Log4jLogEvent.java:331)
at org.apache.logging.log4j.core.impl.DefaultLogEventFactory.createEvent(DefaultLogEventFactory.java:54)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:401)
at org.apache.logging.log4j.core.config.DefaultReliabilityStrategy.log(DefaultReliabilityStrategy.java:49)
at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
...
Caused by: java.lang.IllegalArgumentException: Initial capacity must be at least one but was 0
at org.apache.logging.log4j.util.SortedArrayStringMap.(SortedArrayStringMap.java:102)
at org.apache.logging.log4j.core.impl.ContextDataFactory.createContextData(ContextDataFactory.java:109)
at org.apache.logging.log4j.core.impl.ContextDataFactory.(ContextDataFactory.java:57)
... 59 more
23-Nov-2018 20:15:50.111 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
23-Nov-2018 20:15:50.141 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStop Exception sending context destroyed event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:176)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1037)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1013)
...