facebook

[Closed] Cannot find the element ‘struts-config’.

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #241479 Reply

    I’m new at this so please be patient…

    I imported a test struts application that a consultant wrote. I’m getting the following message when I start the WebLogic 8.12 app server:

    Nov 14, 2005 10:42:57 PM org.apache.commons.digester.Digester error
    SEVERE: Parse Error at line 2 column 18: cvc-elt.1: Cannot find the declaration of element ‘struts-config’.
    org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘struts-config’.

    The odd thing is…the application works, but what can I do to get rid of these messages?…or should I care?

    TIA.

    #241507 Reply

    Riyad Kalla
    Member

    If you look in your web.xml file, you will see a mapping for ActionServlet, where parameters for your struts-config files are passed, what are all the struts files listed? Can you find those actual files under your web-inf dir? I’m wondering if he stuck a stray filename in there and forgot to clear it out, or if he put in a file name for an invalid struts file that is in your web-inf dir somewhere.

    #241541 Reply

    Thanks rkalla,

    Here’s the ActionServlet section of web.xml:

    <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>

    …and struts-config.xml is in WebRoot\WEB-INF. (I would have posted a small screen shot image of the directory tree, but I wasn’t sure how to use the img tag).

    I found out something else that may be related…when I double-click on struts-config.xml, I get the following message:

    “Cannot open default editor on struts-config.xml. Project … is not configured as a MyEclipse Web-Struts Project.”

    Could this be the problem?…how do I configure my project as a “MyEclipse Web-Struts Project”?

    TIAA

    #241545 Reply

    Riyad Kalla
    Member

    Right click on the project Root > MyEclipse > Add Struts Capabilities. Be sure to fill in all the appropriate fields here, also be sure to select the correct version of Struts you are using and hit Finish.

    Now close and open the struts-config.xml file. Then we can try validating it and see if there is some problem there.

    #241565 Reply

    I took the “Add Struts Capabilities” option, but I didn’t look closely and took all the defaults, including Struts 1.0…should have been 1.2.

    But now I don’t get an error when I try to open struts-config.xml.

    Now what?

    #241572 Reply

    Riyad Kalla
    Member

    If your project validates fine I am starting to wonder if this error is from another deployed project to your app server and not this one you are working with. If you remove the deployment, and restart your app server, do you still see the message?

    #243178 Reply

    antman
    Member

    Nov 14, 2005 10:42:57 PM org.apache.commons.digester.Digester error
    SEVERE: Parse Error at line 2 column 18: cvc-elt.1: Cannot find the declaration of element ‘struts-config’.
    org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘struts-config’.

    If you look at stuts-config.xml you will notice that DOCTYPE is missing , just add this after xml declation.
    so the second line in this file will be:
    <!DOCTYPE struts-config PUBLIC
    “-//Apache Software Foundation//DTD Struts Configuration 1.2//EN”
    http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd”&gt;
    that shoud correct the problem

    #243369 Reply

    That’s what I finally found out…thanks.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: [Closed] Cannot find the element ‘struts-config’.

You must be logged in to post in the forum log in