spring异常java.lang.IllegalStateException

十月 26, 2017 11:23:24 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
十月 26, 2017 11:23:24 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Tomcat
十月 26, 2017 11:23:24 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.47
十月 26, 2017 11:23:28 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
十月 26, 2017 11:23:28 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
十月 26, 2017 11:23:30 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: The class com.sun.proxy.$Proxy39 unimplemented interface interface com.jd.service.TestService!
	at com.alibaba.dubbo.config.ServiceConfig.checkRef(ServiceConfig.java:251)
	at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:203)
	at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143)
	at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:109)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:855)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	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)

原因:spring/application.XML中dubbo暴露了一个接口(对应在interface下),而 包扫描器扫描service的包时没有发现和该接口对应的实现类.总之一句话配置文件XML 中有的类中对应的一定要有,而类中有的XMl可以没有.


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在使用Spring框架时,有时候会遇到java.lang.illegalstateexception: failed to load applicationcont这个异常错误,这个错误主要是由于在加载ApplicationContext时出现问题导致的。 造成这个问题的原因有很多,大多数原因都是引用不正确或配置文件错误。下面是一些常见的原因及解决方法。 1. 找不到配置文件 在加载ApplicationContext时,如果没有正确配置spring-config.xml文件的路径,就会出现这个错误。这个问题可以通过以下两种方法解决:一是将spring-config.xml文件放在正确的位置,一般是在src/main/resource下面;二是在web.xml中配置ContextLoaderListener,来指定spring-config.xml文件路径。 2. 配置文件错误 如果spring-config.xml文件中的标签或属性格式不正确,也会导致这个异常错误。可以通过检查spring-config.xml文件中的标签格式和属性设置来解决这个问题。可以通过使用Spring自带的schema和命名空间来检查配置文件中的标签和属性的正确性。 3. 依赖问题 另外一个常见的原因是依赖问题,可能是第三方库或jar包版本不一致,或者是没有正确添加必要的依赖。可以通过检查项目中的pom.xml或者lib文件夹下的jar包来确定是否存在依赖问题。 总之,java.lang.illegalstateexception: failed to load applicationcont这个异常错误看起来比较棘手,但是只要仔细分析和排除所有可能的原因,还是能够解决的。确保配置文件正确,依赖正确,就可以顺利加载ApplicationContext了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值