java 构造函数抛出异常,构造函数抛出异常;嵌套异常是java.lang.NoClassDefFoundError:javax/servlet/ServletContext...
我正在嘗試使用MockMVC設置Junit測試.
從這個link – “要么不能使用Servlet API,要么你需要在類路徑上提供它”.
我在pom.xml中添加了以下內容但是沒有用.任何的想法?
這是跟蹤
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.test.context.web.WebDelegatingSmartContextLoader]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:105)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:130)
at org.springframework.test.context.ContextLoaderUtils.resolveContextLoader(ContextLoaderUtils.java:118)
at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:594)
at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:560)
at org.springframework.test.context.TestContext.
好的,根據評論更新,所以我把范圍改為編譯然后似乎通過了找不到類的問題!
總結
以上是生活随笔為你收集整理的java 构造函数抛出异常,构造函数抛出异常;嵌套异常是java.lang.NoClassDefFoundError:javax/servlet/ServletContext...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java 广播地址,根据ip地址跟子网掩
- 下一篇: matlab人工势场法三维演示图,人工势