0
我正在用Apache Tomcat开发Web应用程序。我的web应用程序有一个META-INF目录,其中包含context.xml文件。问题是,当我尝试使用命令“jar -cvf mywebapp.war”创建一个.war文件时。 ,我得到这样的警告(我翻译,我可以到英语):Apache Tomcat:创建.war文件时忽略META-INF目录
META-INF will be ignored
adding META-INF/context.xml(in = 142)(compression 17%)
META-INF/MANIFEST.MF will be ignored
因为当我启动Tomcat我得到了一些错误,我想,也许这一切都是由于此警告。谢谢。
编辑:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="mywebapp" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>My web app</display-name>
<description>...</description>
<welcome-file-list>
<welcome-file>html/index.html</welcome-file>
</welcome-file-list>
<!-- Define the roles we want to use in the application -->
<security-role>
<role-name>member</role-name>
</security-role>
<security-constraint>
<!-- Define the resource -->
<web-resource-collection>
<web-resource-name>Members Only</web-resource-name>
<url-pattern>html/members/*</url-pattern>
</web-resource-collection>
<!-- Only members can access this resource -->
<auth-constraint>
<role-name>member</role-name>
</auth-constraint>
<user-data-constraint>
<!-- transport-guarantee can be CONFIDENTIAL, INTEGRAL, or NONE -->
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!-- Use BASIC security -->
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Secure area</realm-name>
</login-config>
</web-app>
在结果战争中是否存在'context.xml'?你可以用命令'jar -tvf mywebapp.war'来检查。此外,如果您可以发布您的Tomcat日志,我们可能可以帮助您找出问题所在。 –
我刚刚打开.war文件,并发现context.xml存在。这是我的Tomcat日志:http://i40.tinypic.com/zvzs5f.png。谢谢 – user3067088
在你的日志里有一个'IllegalArgumentExcpetion:无效的 ...'。这很可能是你的'web.xml'或一个注释的问题。你可以发布你的'web.xml'吗?您可以使用“代码示例”标签将其包含在问题的正文中。 –