正如问题所说,TomcatV7.0不能读取context.xml。我添加到src文件夹,以便它在类路径中。但是,仍然没有读到它。但是,如果我使用Grid Server而不是Tomcat,我可以运行我的应用程序。除了将context.xml添加到src文件夹之外,我还遗漏了什么吗?(我有一个动态项目)。
这是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>另外,这里有一些东西:
@ApplicationPath( "rs" )
public class RestTestApp extends ResourceConfig {
public RestTestApp () {
super();
register( HttpMethodOverrideFilter.class );
packages( true, "com.thd.mm.pc.resttest", "com.fasterxml.jackson.jaxrs" );
}
}发布于 2015-06-13 14:10:23
context.xml文件应该放入webapp根目录下的META-INF中(所有静态文件都在这里)。它不应该在类路径上。
欲了解更多信息,请访问Defining a Context
https://stackoverflow.com/questions/30814449
复制相似问题