org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#114a85c2 has been closed already - spring-boot

I found below exception after loading springboot.
[2020-01-06 20:03:39.173][main (1)][WARN ][o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties': Could not bind properties to 'TaskSchedulingProperties' : prefix=spring.task.scheduling, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#114a85c2 has been closed already
I don’t understand this error.
Please let me know why this exception is generated.

Related

org.apache.ibatis.type.TypeException: The alias 'Criterion' is already mapped to the value 'com.xxx.domain.def.GameListExample$Criterion'

I use mybatis generator to generate domain and mapper. It works well when I generate one table.
When I generate another table , the problem comes. It seems like the Criterion class in GameListExample and BetRecdExample conflicts, but it was generated by mybatis.
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'betRecdMapper' defined in file
[F:\IdeaProjects\game\target\classes\com\good\game\dao\def\BetRecdMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]:
Factory method 'sqlSessionFactory' threw exception; nested exception is org.apache.ibatis.type.TypeException: The alias 'Criterion' is already mapped to the value 'com.good.game.domain.def.GameListExample$Criterion'.
Sounds like the same issue as https://github.com/mybatis/generator/issues/461
It's caused by a bug in mybatis-spring 2.0.1.
https://github.com/mybatis/spring/issues/362
Current workaround is to use mybatis-spring 2.0.0 or 2.0.2-SNAPSHOT.

Null pointer exception while initializing listener

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PurchaseAccount': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.NullPointerException
can u tell me y this exception is caused?
... How about you provide some more information. There is not way for anyone to know what is wrong with your code when you don't give any. Please also let us know what have you done already to try to solve your problem.

spring rabbitmq: can't set id as a property?

I have a property file which contains queue whose value is queue_name
If I use the property in other please, then it works, but if I used it on "id", then it failed
<rabbit:queue id="${queue}" name="queue" />
The error is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.amqp.rabbit.config.BindingFactoryBean#0': Cannot resolve reference to bean 'queue_name' while setting bean property 'destinationQueue'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ConnectorInputQueue_silo' is defined.
update:
I found the following log: it said bean ${queue} is created, so why didn't it replace ${queue} with the value of property of "queue"?
2014-11-21 05:27:11 DEBUG DefaultListableBeanFactory:220 - Creating shared instance of singleton bean '${queue}'
2014-11-21 05:27:11 DEBUG DefaultListableBeanFactory:450 - Creating instance of bean '${queue}'
2014-11-21 05:27:11 DEBUG DefaultListableBeanFactory:524 - Eagerly caching bean '${queue}' to allow for resolving potential circular references
2014-11-21 05:27:11 DEBUG DefaultListableBeanFactory:478 - Finished creating instance of bean '${queue}'
Show, please, more info to reproduce the issue. And pay attention that your StackTrace says:
No bean named 'ConnectorInputQueue_silo' is defined.
Maybe it will help you somehow...

Grails 2.4.3 Upgrade - Spring Security ACl - SpelExpressionParser

Getting the below error while running the app, no issues during compile. Kindly help, how to fix this issue.
ERROR [localhost-startStop-1] 2014-09-26 19:19:19,050 org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener.error(213) : Error initializing the application: Error creating bean with name 'flowBuilderServices': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.expression.spel.standard.SpelExpressionParser' to required type 'org.springframework.binding.expression.ExpressionParser' for property 'expressionParser'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.expression.spel.standard.SpelExpressionParser] to required type [org.springframework.binding.expression.ExpressionParser] for property 'expressionParser': no matching editors or conversion strategy found
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowBuilderServices': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.expression.spel.standard.SpelExpressionParser' to required type 'org.springframework.binding.expression.ExpressionParser' for property 'expressionParser'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.expression.spel.standard.SpelExpressionParser] to required type [org.springframework.binding.expression.ExpressionParser] for property 'expressionParser': no matching editors or conversion strategy found
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.expression.spel.standard.SpelExpressionParser' to required type 'org.springframework.binding.expression.ExpressionParser' for property 'expressionParser'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.expression.spel.standard.SpelExpressionParser] to required type [org.springframework.binding.expression.ExpressionParser] for property 'expressionParser': no matching editors or conversion strategy found
... 4 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.expression.spel.standard.SpelExpressionParser] to required type [org.springframework.binding.expression.ExpressionParser] for property 'expressionParser': no matching editors or conversion strategy found
What plugins are you using? I was getting the same exception when upgrading to Grails 2.4.3 and just narrowed it down (it wasn't easy) to the fact that the Grails WebFlow plugin and the ACL plugin both setup a bean named expressionParser, but each plugin is using a different class... one is overwriting the other during Grails initialization of spring beans. By renaming the web flow plugin's expressionParser to flowExpressionParser in the WebFlowPluginSupport.groovy file, I was able to get around this exception. You could search in your plugins directory for 'expressionParser' and see if you have >1 plugin using it.
I have let the webflow plugin folks know, and a bit more detail here.
https://jira.grails.org/browse/GPWEBFLOW-109

Spring - Instanciate a bean with a class which throws an Exception

I'm trying to instanciate a bean which constructor could throw an Exception.
I can't modify this class (given by an external team).
<bean id="myClass" class="myClass" />
The myClass constructor throws Exception.
I've been thinking about extending this class with a Singleton Pattern which is the behavior I want (be sure to instantiate only one instance of MyClass).
Error message :
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'myClass'
defined in class path resource
[.../spring_applicationContext.xml]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[myClass]:
Constructor threw exception; nested exception is
java.lang.ExceptionInInitializerError
Thanks in advance for your answers
I think the problem comes from the fact that my constructor throws an Exception.
My question is : with Spring, is it possible to instanciate a bean with a constructor which could throw an exception ?
If no bean scope is specified in bean configuration file, default to singleton. Your bean myClass is a singleton and you dont need to do anything more.
Spring Doc
Spring beans are by default singletons.
You should provide more of the stacktrace - what you're showing indicates that it is not myClass that is the problem, but the ClassPathXmlApplicationContext constructor that throws an exception - the cause usually follows later in the stacktrace.
Cheers,
As per stack trace, looks like there is an unexpected error either in static block or variable while creating an object of class 'myClass'.

Resources