首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tomcat7.0版服务器不读取context.xml

Tomcat7.0版服务器不读取context.xml
EN

Stack Overflow用户
提问于 2015-06-13 10:13:59
回答 1查看 84关注 0票数 0

正如问题所说,TomcatV7.0不能读取context.xml。我添加到src文件夹,以便它在类路径中。但是,仍然没有读到它。但是,如果我使用Grid Server而不是Tomcat,我可以运行我的应用程序。除了将context.xml添加到src文件夹之外,我还遗漏了什么吗?(我有一个动态项目)。

这是web.xml

代码语言:javascript
复制
<?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>

另外,这里有一些东西:

代码语言:javascript
复制
 @ApplicationPath( "rs" )
 public class RestTestApp extends ResourceConfig {
 public RestTestApp () {
    super();
    register( HttpMethodOverrideFilter.class );
    packages( true, "com.thd.mm.pc.resttest", "com.fasterxml.jackson.jaxrs"       );
    }
 }
EN

回答 1

Stack Overflow用户

发布于 2015-06-13 14:10:23

context.xml文件应该放入webapp根目录下的META-INF中(所有静态文件都在这里)。它不应该在类路径上。

欲了解更多信息,请访问Defining a Context

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30814449

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档