首页 新闻 会员 周边

Failed to load ApplicationContext

0
[待解决问题]

@Test 单元测试出现 Failed to load ApplicationContext异常情况

控制台里面给的异常情况是
Caused by: com.alibaba.dubbo.rpc.RpcException: No servlet context found. If you are using server='servlet', make sure that you've configured com.alibaba.dubbo.remoting.http.servlet.BootstrapListener in web.xml

其weweb.xml 里面都配置了BootstrapListener

找了一个上午的百度都没有找到解决办法,求各路大神帮忙分析原因

果果爱吃土豆的主页 果果爱吃土豆 | 初学一级 | 园豆:73
提问于:2021-01-22 12:05
< >
分享
所有回答(1)
0

看上面的信息,你使用的应该是spring mvc吧?
这种工程测试时如果依赖servlet有关的东西,直接使用Junit是不行的

看下这个 https://blog.csdn.net/wangxindong11/article/details/53319797 SpringJUnit4ClassRunner 需要注入spring的上下文

2012 | 园豆:21230 (高人七级) | 2021-01-22 14:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册