出现这个错误的原因Singleton的对象已经被销毁了,然后随后被另一个线程访问了。
我出现这个问题的场景是:使用JUnit测试异步任务的时候,任务执行了,随后scheduler访问了一个Singleton的Bean,但是这个Bean实际已经被销毁了。
还有一个情况也可能会出现这个问题:多个tomcat instance在运行(Check if you have more than one tomcat's instance.
if this is your case, shutdown all instance then open one and only one instance)。