GVKun编程网logo

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springf...

15

如果您对警告:Exceptionencounteredduringcontextinitialization-cancellingrefreshattempt:org.springf...感兴趣,那么

如果您对警告: Exception encountered during context initialization - cancelling refresh attempt: org.springf...感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解警告: Exception encountered during context initialization - cancelling refresh attempt: org.springf...的各种细节,此外还有关于Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException、com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException、Context initialization failed org.springframework.beans.factory.BeanCreationException、Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException的实用技巧。

本文目录一览:

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springf...

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springf...

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ''bookShopService'' defined in class path resource [tx.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type ''com.sun.proxy.$Proxy10 implementing com.figsprite.spring.BookShopDao,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy'' to required type ''com.figsprite.spring.BookShopDaoImpl'' for property ''bookShopDao''; nested exception is java.lang.IllegalStateException: Cannot convert value of type ''com.sun.proxy.$Proxy10 implementing com.figsprite.spring.BookShopDao,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy'' to required type ''com.figsprite.spring.BookShopDaoImpl'' for property ''bookShopDao'': no matching editors or conversion strategy found

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ''bookShopService'' defined in class path resource [tx.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type ''com.sun.proxy.$Proxy10 implementing com.figsprite.spring.BookShopDao,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy'' to required type ''com.figsprite.spring.BookShopDaoImpl'' for property ''bookShopDao''; nested exception is java.lang.IllegalStateException: Cannot convert value of type ''com.sun.proxy.$Proxy10 implementing com.figsprite.spring.BookShopDao,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy'' to required type ''com.figsprite.spring.BookShopDaoImpl'' for property ''bookShopDao'': no matching editors or conversion strategy found
View Code

  AOP 切点表达式写错了,报的是 DataSource 空指针??喵喵???

  出现这种错误多半是标签的问题,要细细检查一下

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException

org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name ''BusinessAccountController'' for bean class [com.hs.BusinessAccountController] conflicts with existing, non-compatible bean definition of same name and class [com.hs.BusinessAccountController]
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:314)
    at org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate(ClassPathMapperScanner.java:223)
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:253)
    at org.mybatis.spring.mapper.ClassPathMapperScanner.doScan(ClassPathMapperScanner.java:155)
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.scan(ClassPathBeanDefinitionScanner.java:220)

问题的根源是出现bean名称重复

原因:

1.两个bean名称重复,spring扫描无法创建bean对象(有时候会与引入的第三方的jar包中的bean名称重复);

2.target中有缓存导致,Maven项目clean下再编译

com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException

com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException

confluence 启动访问报错:

com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException
    at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)
    at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112)
    at com.atlassian.confluence.plugin.servlet.filter.ServletFilterModuleContainerFilter.getServletModuleManager(ServletFilterModuleContainerFilter.java:23)
    at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:68)
    at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:50)
    at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:488)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:466)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:337)
    at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:427)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
解决办法:

给 confluence 的 HOME 文件夹赋权限

chmod -R 777 /var/atlassian/

Context initialization failed org.springframework.beans.factory.BeanCreationException

Context initialization failed org.springframework.beans.factory.BeanCreationException

严重: Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with namewebSocketHandlerMappingdefined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory methodwebSocketHandlerMappingthrew exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found 
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111) 
atCaused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory methodwebSocketHandlerMappingthrew exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found 
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) 
atCaused by: java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found 
at org.springframework.web.socket.server.support.DefaultHandshakeHandler.initRequestUpgradeStrategy(DefaultHandshakeHandler.java:127) 
at

出现上述异常,是由于缺少 RequestUpgradeStrategy 
对于 jetty,需要添加如下依赖

1     <dependency>
2         <groupId>org.eclipse.jetty.websocket</groupId>
3         <artifactId>websocket-server</artifactId>
4         <version>9.3.3.v20150827</version>
5         <scope>provided</scope>
6     </dependency>

对于 tomcat,需要添加如下依赖

<dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-websocket</artifactId>
        <version>8.0.23</version>
        <scope>provided</scope>
    </dependency>

在 poem.xml 文件中添加这两个依赖后成功解决

 

原文:https://blog.csdn.net/manerfan/article/details/48526681 
来源:CSDN

Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException

Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException

Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name ''servletEndpointRegistrar'' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method ''servletEndpointRegistrar'' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ''healthEndpoint'' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method ''healthEndpoint'' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ''healthIndicatorRegistry'' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthIndicatorRegistry]: Factory method ''healthIndicatorRegistry'' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ''org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAutoConfiguration'': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ''dataSource'' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method ''dataSource'' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

 

 

这是什么原因造成的呢?

我自己摸索了很久发现,该项目的在pom文件中的这个看图:

 

 

没错,packaging标签我们不应该写成pom,要嘛不写去掉,要嘛就写成jar。

然后重启springBoot项目就不会报这个错误了,希望能帮到大家。

 

今天关于警告: Exception encountered during context initialization - cancelling refresh attempt: org.springf...的讲解已经结束,谢谢您的阅读,如果想了解更多关于Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException、com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException、Context initialization failed org.springframework.beans.factory.BeanCreationException、Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException的相关知识,请在本站搜索。

本文标签: