I am writing test for a servlet filter using spring MockHttpServletResponse and request. I am getting the following error while creating MockHttpServletResponse object.
Caused by: java.util.MissingResourceException: Can't find bundle for base name javax.servlet.LocalStrings, locale en_US
I tried couple of things suggested on stackoverflow like adding javax.servlet-api to pom but even with that its not working.
I tried adding tomcat server api in pom, but that is also not working.
My pom file just contains servlet api, jmockit and spring-test dependencies. And I dont have any message.properties or any other resource in classpath.
Is there any other dependency that I need to add here?
You need the appropriate version of javax.servlet:javax.servlet-api in the test classpath.
For Maven, you will need something similar to the following.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With