-1

我正在使用莺来创建我的 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>
4

1 回答 1

1

正如第一个评论者提到的那样,xml 是无效的,因为duplicate <web-app> and <!DOCTYPE. 解析器错误与<!. <!用于声明文档类型,它只能出现在根元素的开始之前。任何后续出现都将被视为评论的开始。和评论needs -- after <!

于 2011-07-08T02:59:28.737 回答