As the question says, Tomcat v7.0 doesnt read context.xml. I added to src folder so that its in the class path. But, still not reading it. But, I can run my app if I use Grid Server instead of Tomcat. Am I missing something other than adding context.xml to the src folder? ( I have dynamic project).
Here is web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>REST_TEST</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
Also, here is something:
@ApplicationPath( "rs" )
public class RestTestApp extends ResourceConfig {
public RestTestApp () {
super();
register( HttpMethodOverrideFilter.class );
packages( true, "com.thd.mm.pc.resttest", "com.fasterxml.jackson.jaxrs" );
}
}
The
context.xml
file should go into theMETA-INF
in the root of the webapp (where all the static files are). It should not be on the classpath.See more at Defining a Context