We are using Spring-test-4.0.6
jar in test scope in our project. Under same project we also have javaee-6.0
dependency in provided scope.
I am getting this error in test case
Could not initialize class org.springframework.mock.web.MockServletContext at com.sample.TestWebDOMConfiguratorMultiple.setUp(TestWebDOMConfiguratorMultiple.java:77
)
Surprisingly replacing Javaee-6.
0 dependency with servlet-api-3.0.1
resolves this issue.
Note: Spring-4.0.6
pom has compile time optional dependency on servlet-api-3.0.1
.
Question is why is it working with servlet-3.0.1
and not with javaee 6.0
as we are trying to replace servlet-api-3.0.1
with javaee-6.0
.
Thanks in advance.
Without knowing the exact artifact that you are referring to as javaee-6.0
and without being able to see the full stack trace, it appears that your javaee-6.0
dependency contains Servlet API 3.0; whereas, spring-test-4.0.6.RELEASE
explicitly requires Servlet API 3.0.1.
So that is likely the source of your problem.
Regards,
Sam
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.