Unable to work with struts , tomcat startup gives xml error

Discussions

General J2EE: Unable to work with struts , tomcat startup gives xml error

  1. Hi,

    I am new to struts , i have written a small sample struts app pasted below. The tomcat server on startup gives the following error
    -----------------------------------------------------------

    Jun 25, 2004 4:04:56 PM .org.apache.commons.digester.Digester fatalError
    SEVERE: Parse Fatal Error at line 215 column 5: Element type "null" must be foll
    owed by either attribute specifications, ">" or "/>".
    org.xml.sax.SAXParseException: Element type "null" must be followed by either at
    tribute specifications, ">" or "/>".
            at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
    known Source)
            at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)

            at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
            at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
            at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
    own Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
    Dispatcher.dispatch(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
    known Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
            at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
            at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.apache.commons.digester.Digester.parse(Digester.java:1548)
            at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionSe
    rvlet.java:1006)
            at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet
    .java:955)
            at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
            at javax.servlet.GenericServlet.init(GenericServlet.java:256)
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
    java:935)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:82
    3)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
    t.java:3427)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
    628)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
    .java:821)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
    7)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)

            at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
    loyer.java:307)
            at org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
            at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:492
    )
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:400
    )
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
    :358)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
    eSupport.java:166)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)

            at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363
    )
            at org.apache.catalina.core.StandardService.start(StandardService.java:4
    97)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:219
    0)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
            at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
            at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
    Jun 25, 2004 4:04:56 PM org.apache.struts.action.ActionServlet handleConfigExcep
    tion
    SEVERE: Parsing error processing resource path
    org.xml.sax.SAXParseException: Element type "null" must be followed by either at
    tribute specifications, ">" or "/>".
            at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.apache.commons.digester.Digester.parse(Digester.java:1548)
            at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionSe
    rvlet.java:1006)
            at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet
    .java:955)
            at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
            at javax.servlet.GenericServlet.init(GenericServlet.java:256)
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
    java:935)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:82
    3)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
    t.java:3427)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
    628)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
    .java:821)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
    7)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)

            at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
    loyer.java:307)
            at org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
            at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:492
    )
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:400
    )
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
    :358)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
    eSupport.java:166)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)

            at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363
    )
            at org.apache.catalina.core.StandardService.start(StandardService.java:4
    97)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:219
    0)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
            at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
            at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
    ***********************************************************************************************************************

    the config files are

    struts-config.xml
    ------------------------------------------------------------------------------------------------------------------------

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

    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">



    <struts-config>
    <!-- ======================================== Form Bean Definitions -->
        <form-beans>
    <form-bean name="userRegistrationForm" type="strutsTutorial.userRegistrationForm" />
        </form-beans>
    <!-- ================================= Global Exception Definitions -->
        <global-exceptions>

            <!-- sample exception handler

            <exception

                key="expired.password"

                type="app.ExpiredPasswordException"

                path="/changePassword.jsp"/>

            end sample -->

        </global-exceptions>

    <!-- =================================== Global Forward Definitions -->

        <global-forwards>

            <!-- Default forward to "Welcome" action -->

            <!-- Demonstrates using index.jsp to forward -->

            <forward

                name="welcome"

                path="/Welcome.do"/>

        </global-forwards>
    <!-- =================================== Action Mapping Definitions -->
        <action-mappings>
    <action path="/userRegistration"
                type="strutsTutorial.UserRegistrationAction"
                name="userRegistrationForm"
                attribute="user"
                input="/userRegistration.jsp"
                parameter="action">
        
                  <forward name="success" path="/regSuccess.jsp" />
                 
        </action>
            
            
                <!-- Default "Welcome" action -->

                <!-- Forwards to Welcome.jsp -->

            <action

                path="/Welcome"

                type="org.apache.struts.actions.ForwardAction"

                parameter="/pages/Welcome.jsp"/>
        </action-mappings>





    <!-- ===================================== Controller Configuration -->



        <controller

           processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>


    <!-- ================================ Message Resources Definitions -->
        <message-resources parameter="resources.application"/>
    </struts-config>

    ----------------------------------------------------------------------------- web.xml ----------------------------------
    <?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>
      <display-name>Struts Blank Application</display-name>
      
      <!-- Standard Action Servlet Configuration (with debugging) -->
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <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>2</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>2</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
      </servlet>


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


      <!-- The Usual Welcome File List -->
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>


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

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

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

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

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

    </web-app>
    ------------------------------------------------------------
    ---------------userRegistration.jsp-------------------------
    <%@taglib uri="/tags/struts-html" prefix="html" %>
    <%@taglib uri="/tags/struts-bean" prefix="bean" %>
    <html>
    <head>
    <title>User Registration</title>
    </head>
    <body>
    <h1>User Registration</h1>
    <html:errors />
    <table>
    <html:form action ="/userRegistration">
    <tr>
    <td><bean:message key="userRegistration.firstName"/></td>
    <td><html:text property="firstName"/>*</td>
    </tr>
    <tr>
    <td><bean:message key="userRegistration.lastName" />*</td>
    <td><html:text property="lastName" /></td>
    </tr>
    <tr>
    <td><bean:message key="userRegistration.userName" />*</td>
    <td><html:text property="userName" /></td>
    </tr>
    <tr>
    <td><bean:message key="userRegistration.email" />*</td>
    <td><html:text property="email" /></td>
    </tr>
    <tr>
    <td><bean:message key="userRegistration.phone" /></td>
    <td><html:text property="phone" /></td>
    </tr>
    <tr>
    <td><bean:message key="userRegistration.fax" /></td>
    <td><html:text property="fax" /></td>
    </tr>
    <tr>
    <td><bean:message key="userRegistration.password" />*</td>
    <td><html:password property="password" /></td>
    </tr>
    <tr>
    <td><bean:message key="userRegistration.password" />*</td>
    <td><html:password property="passwordCheck" /></td>
    </tr>
    <tr>
    <td><html:submit /></td>
    <td><html:cancel /></td>
    </tr>
    </html:form>
    </table>
    </body>
    </html>

    ------------------------------------------------------------------------------------------------------------------------


    Please help me as i am unable to proceed furthur

    Thanks

    Threaded Messages (4)

  2. I think its tomcat conf...[ Go to top ]

    You get that error when you have an invalid XML document. Both you have displayed are valid. So i suspect that a tomcat config is currupt. Did you change any tomcat conf files?

    I would reccomend removing the app from the webapp dir and if the error does not go away, then it is a tomcat conf error.

    If its a tomcat conf error, then open the xml files one by one in IE. IE has a good xml parser, it will point out the error.
  3. Struts newbi,

    You get that error when you have an invalid XML document. Both you have displayed are valid. So i suspect that a tomcat config is currupt. Did you change any tomcat conf files?

    I would reccomend removing the app from the webapp dir and if the error does not go away, then it is a tomcat conf error.

    If its a tomcat conf error, then open the xml files one by one in IE. IE has a good xml parser, it will point out the error.
  4. Hi,
    thanks for your reply,

    i have tried REMOVING the application from the tomcat webapps folder , the tomcat initialization works fine , it is only when i try to deploy the "war" file the error occurs , also any idea which file tomcat is parsing at this moment , it just says line 215 col 5 . For the current struts-config.xml everything looks fine at this line number.


    Thanks.
  5. email me the war[ Go to top ]

    mlavwilson@hotmail.com