The content of element type

Discussions

EJB design: The content of element type

  1. The content of element type (6 messages)

    Hi,

      I'm trying to deploy an application with web.xml as below, but it gives me the following error on websphere, while the same thing works fine in weblogic.

       [wsjspc] com.ibm.etools.archive.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml
       [wsjspc] Stack trace of nested exception:
       [wsjspc] com.ibm.etools.j2ee.exception.WrappedRuntimeException: IWAE0099E An Exception occurred while parsing xml: Line #: 122 :Column #: 11
       [wsjspc] Stack trace of nested exception:
       [wsjspc] org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
       [wsjspc] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
       [wsjspc] at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
       [wsjspc] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       [wsjspc] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       [wsjspc] at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
       [wsjspc] at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
       [wsjspc] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)

    (....)

    my web.xml is as below...

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
        "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

    <web-app>
        <!-- Application Startup Class -->

        <listener>
        <listener-class>com.amdocs.cs.infra.common.ui.VRStatupManager</listener-class>
        </listener>

        <!-- General description of your web application -->

        <display-name>SuRF</display-name>
        <description>
          This is version 0.1b of an application to perform
          a wild and wonderful task, based on servlets and
          JSP pages.
        </description>

      <!-- Multi Language Support -->
     <context-param>
      <param-name>weblogic.httpd.inputCharset./*</param-name>
      <param-value>UTF-8</param-value>
     </context-param>
       <!-- Multi Language Support Configuration -->

      <!-- Action Servlet Configuration -->
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>application</param-name>
          <param-value>VRGUIResourceBundle</param-value>
        </init-param>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>validate</param-name>
          <param-value>true</param-value>
        </init-param>
        <init-param>
          <param-name>locale</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
      </servlet>
      
      <!-- Example filter to set character encoding on each request -->
     
     <servlet>
        <servlet-name>resource</servlet-name>
        <servlet-class>com.amdocs.cs.infra.web.servlet.ResourceBundleLocalizationServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>

      <!-- Action Servlet Mapping -->
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>

        <!-- Define the default session timeout for your application,
             in minutes. From a servlet or JSP page, you can modify
             the timeout for a particular session dynamically by using
             HttpSession.getMaxInactiveInterval(). -->
        <welcome-file-list>
         <welcome-file>/AppInit.do</welcome-file>
        </welcome-file-list>
        
        <session-config>
          <session-timeout>30</session-timeout> <!-- 30 minutes -->
        </session-config>

      <!-- Struts Tag Library Descriptors -->
      <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
      </taglib>

      <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>

      <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-template.tld</taglib-location>
      </taglib>

      <!-- end Struts Tag Library Descriptors -->
      <taglib>
        <taglib-uri>/WEB-INF/vr-ui.tld</taglib-uri>
        <taglib-location>/WEB-INF/vr-ui.tld</taglib-location>
      </taglib>
      <!-- persona parameters -->
      
      <context-param>
        <param-name>weblogic.servlet.reloadCheckSecs</param-name>
        <param-value>0</param-value>
      </context-param>
      
      <error-page>
        <exception-type>javax.servlet.jsp.JspException</exception-type>
        <location>/error/error.jsp</location>
      </error-page>
    </web-app>

    Threaded Messages (6)

  2. As the error says[ Go to top ]

    org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".&nbsp;&nbsp;&nbsp;[wsjspc]

    As it says, the contents nested inside the <web-app></web-app>
    tags must match the list given, and preferably in the same order. In your web.xml, you have the <listener> tags as the first set of tags, look at the list above, should it come first?
  3. As the error says[ Go to top ]

    Your comment is almost 4 years old but it was a great help to me... I reordered the elements and took out the spaces. Thanks!
  4. Thanks[ Go to top ]

    Thanks for the tip ...
  5. Even now, it has helped me, the red marks shown through eclipse were really irritating, and ordering the elements has fixed the issue. Thanks a ton.
  6. Usefull[ Go to top ]

    Helped me too. Thanks!

  7. error in web.xml file in web-app element[ Go to top ]

    <web-app>
            
        <!-- Main servlet of Struts -->
        <servlet>
              <servlet-name>main</servlet-name>
              <servlet-class>com.pandora.gui.struts.action.GeneralStruts</servlet-class>
              <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml    </param-value>
              </init-param>
              <init-param>
                <param-name>application</param-name>
                <param-value>ApplicationResources</param-value>          
              </init-param>
              <load-on-startup>1</load-on-startup>
          </servlet>
        
        <!-- the kickoff servlet used to setup Plandora startup parameters -->
        <servlet>
              <servlet-name>kickoff</servlet-name>
              <servlet-class>com.pandora.gui.struts.action.SystemStartup</servlet-class>
              <init-param>
                <param-name>timer</param-name>
                <param-value>ON</param-value>          
              </init-param>
              <init-param>
                <param-name>data_source</param-name>
                <param-value>jdbc/plandora</param-value>          
              </init-param>
              <init-param>
                <param-name>sys_protocol</param-name>
                <param-value>http</param-value>          
              </init-param>                                                                      
              <load-on-startup>2</load-on-startup>
          </servlet>    
     
        <!-- this servlet is used to expose public link for file downloads (only public attachments). -->
        <servlet>
              <servlet-name>file</servlet-name>
              <servlet-class>com.pandora.gui.struts.action.PublicFileDownload</servlet-class>
              <init-param>
                <param-name>enable</param-name>
                <param-value>ON</param-value>          
              </init-param>                                        
              <load-on-startup>3</load-on-startup>
          </servlet>      

        <servlet-mapping>
            <servlet-name>file</servlet-name>
            <url-pattern>/file/*</url-pattern>
        </servlet-mapping>
        
        <servlet-mapping>
            <servlet-name>main</servlet-name>
            <url-pattern>/do/*</url-pattern>
        </servlet-mapping>
        

        <!-- this servlet is used to expose public link for artifact downloads (only public artifacts). -->
        <servlet>
              <servlet-name>artifact</servlet-name>
              <servlet-class>com.pandora.gui.struts.action.PublicArtifactDownload</servlet-class>
              <init-param>
                <param-name>enable</param-name>
                <param-value>ON</param-value>          
              </init-param>                                        
              <load-on-startup>3</load-on-startup>
          </servlet>      

        <servlet-mapping>
            <servlet-name>artifact</servlet-name>
            <url-pattern>/artifact/*</url-pattern>
        </servlet-mapping>
        
        <session-config>
            <session-timeout>360</session-timeout>    <!-- in minutes -->
        </session-config>
        
        <resource-ref>
             <description>PLANdora mySQL connection</description>
             <res-ref-name>jdbc/plandora</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
        </resource-ref>
        
    <!--     
        <filter>
           <filter-name>SetCharacterEncoding</filter-name>
           <filter-class>filters.SetCharacterEncodingFilter</filter-class>
                 <init-param>
                 <param-name>encoding</param-name>
                 <param-value>UTF-8</param-value>
                 </init-param>
        </filter>    
        <filter-mapping>
                <filter-name>SetCharacterEncoding</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>    
     -->    
        <taglib>
              <taglib-uri>/WEB-INF/lib/struts-bean</taglib-uri>
              <taglib-location>/WEB-INF/lib/struts-bean.tld</taglib-location>
        </taglib>
        <taglib>
              <taglib-uri>/WEB-INF/lib/struts-html</taglib-uri>
              <taglib-location>/WEB-INF/lib/struts-html.tld</taglib-location>
        </taglib>
        <taglib>
              <taglib-uri>/WEB-INF/lib/struts-logic</taglib-uri>
              <taglib-location>/WEB-INF/lib/struts-logic.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/lib/display</taglib-uri>
              <taglib-location>/WEB-INF/lib/display.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/lib/plandora-html</taglib-uri>
              <taglib-location>/WEB-INF/lib/plandora-html.tld</taglib-location>
        </taglib>

        
        
     
    </web-app>