我正在使用warbler来创建我的Jruby应用程序的战争。它创建了一个没有任何问题的战争,但当我在tomcat(webapps)中部署它时,它给了我以下异常:
SEVERE: Parse error in application web.xml file at jndi:/localhost/POC_Rails_1_3_1_/WEB-INF/web.xml
org.xml.sax.SAXParseException: Comment must start with "<!--".
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
生成(WEB-INF / web.xml)如下。如果我忘记配置某些内容,请告诉我。
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>public.root</param-name>
<param-value>/</param-value>
</context-param>
<context-param>
<param-name>rails.env</param-name>
<param-value>developement</param-value>
</context-param>
<filter>
<filter-name>RackFilter</filter-name>
<filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RackFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
</listener>
</web-app>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>public.root</param-name>
<param-value>/</param-value>
</context-param>
<context-param>
<param-name>rails.env</param-name>
<param-value>developement</param-value>
</context-param>
<filter>
<filter-name>RackFilter</filter-name>
<filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RackFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
</listener>
</web-app>
答案 0 :(得分:1)
正如第一个评论家提到的那样,由于duplicate <web-app> and <!DOCTYPE
,xml无效。解析器错误与<!
有关。 <!
用于声明文档类型,它只能在根元素开始之前出现。任何后续出现都将被视为评论的开始。评论needs -- after <!