I am getting the following exception when I execute the code via JUnit Test Case
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'somarFactory': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
Could someone advise what might be the issues?
To diagnose this type of issue, we'll first make sure the bean is declared: either in an XML configuration file using the <bean /> element. or in a Java @Configuration class via the @Bean annotation. or is annotated with @Component, @Repository, @Service, @Controller, and classpath scanning is active for that package.
By default, the scope of a bean is a singleton.
BeanCreationException. . This means that Spring found a bean to create, but was unable to fulfill the dependencies needed to create this this Spring bean.
There could be numerous reasons why Spring could not able to create a bean with name X, but clue always lies on the detailed stack trace. This error always has some underlying cause e.g. a ClassNotFoundException or a NoClassDefFoundError, which potentially signal a missing JAR file in the classpath.
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.
I hope that will help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With