facebook

web.xml parsing errors when using filters [Closed]

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #208518 Reply

    Mark Sommer
    Member

    Using tomcat5/struts. Added the following:

    <filter>
    <filter-name>
    AppTimeoutFilter
    </filter-name>
    <filter-class>
    com.clsi.util.AppTimeoutFilter
    </filter-class>
    </filter>

    getting:

    Error Element type “filter” must be declared. web.xml licensing/pages/WEB-INF line 68
    Error Element type “filter-class” must be declared. web.xml licensing/pages/WEB-INF line 72
    Error Element type “filter-name” must be declared. web.xml licensing/pages/WEB-INF line 69

    The filter works, but I sure would like to get rid of the error messages. I’m guessing I need to update a DTD in the myEclipse directory somewhere, but I don’t know where.

    Thanks

    #208522 Reply

    Riyad Kalla
    Member

    Hmm… I just added a filter to a project I am working on recently and it worked fine, did you change the web.xml DTD reference from the default 2.3 reference? You shouldn’t need to replace a DTD, we ship with the DTDs from Sun.

    If you comment out the filter, and right click and choose “Validate”, does the file validate corectly? If you put the filter back in, and then re-validate the file, what happens? Are you sure the location of the filter element is valid for the DTD? (needs to be after the <description> tag and before any <servlet> tags)

    #208534 Reply

    Mark Sommer
    Member

    OK, didn’t know about the location issue. So many DTDs in your install directory, not sure which one it’s using as I see various versions. I’m running eclipse 2.13 and MyEclipse version 2.7.101 which I just installed last week freshly. No mods done to the DTDs. After moving this filter as folloows:
    <web-app>
    <display-name>Struts Blank Application</display-name>

    <filter>
    <filter-name>
    AppTimeoutFilter
    </filter-name>
    <filter-class>
    com.clsi.util.AppTimeoutFilter
    </filter-class>
    </filter>

    <!– Standard Action Servlet Configuration (with debugging) –>
    <servlet>

    and validating, I get the same errors. With it commented out, it validates fine. Put it back in, re-validate, same problem.

    Any other ideas?

    Thanks!

    #208536 Reply

    Mark Sommer
    Member

    I should mention, I’m also getting this error message when this occurs:

    Kind Status Priority Description Resource In Folder Location
    Error The content of element type “web-app” must match “(icon?,display-name?,description?,distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*)”. web.xml licensing/pages/WEB-INF line 78

    but I assume this is because of the DTD that’s being used in the validation. Which DTD is it? You have one I can use and replace the default? In the myeclipse/eclipse/plugins directory the following DTDs have web-app defined:

    ./com.genuitec.eclipse.easie.tomcat5_2.7.101/web-app_2_2.dtd
    ./com.genuitec.eclipse.j2eedt.core_2.7.101/dtd/web-app_2_2.dtd
    ./com.genuitec.eclipse.j2eedt.core_2.7.101/dtd/web-app_2_3.dtd
    ./com.genuitec.eclipse.j2eedt.core_2.7.101/templates/web22.xml.ftl
    ./com.genuitec.eclipse.j2eedt.core_2.7.101/templates/web22.xml.sample.ftl
    ./com.genuitec.eclipse.j2eedt.core_2.7.101/templates/web23.xml.ftl
    ./com.genuitec.eclipse.wizards_2.7.101/docs/wJsp.html
    ./com.genuitec.eclipse.wizards_2.7.101/docs/wJsp_en.html
    ./com.genuitec.eclipse.wizards_2.7.101/docs/wServlet.html
    ./com.genuitec.eclipse.wizards_2.7.101/docs/wServlet_en.html
    ./com.genuitec.eclipse.wizards_2.7.101/Templates/WebXml.xml
    ./com.genuitec.eclipse.wizards_2.7.101/Templates/WebXmlStruts.xml
    ./com.genuitec.eclipse.xmen_2.7.101/dtd/http___java.sun.com_dtd_web-app_2_3.dtd
    ./com.genuitec.eclipse.xmen_2.7.101/dtd/http___java.sun.com_j2ee_dtds_web-app_2_2.dtd
    ./com.genuitec.eclipse.xmen_2.7.101/dtd/http___www.bea.com_servers_wls600_dtd_weblogic-web-jar.dtd
    ./com.genuitec.eclipse.xmen_2.7.101/dtd/http___www.bea.com_servers_wls700_dtd_weblogic700-web-jar.dtd
    ./com.genuitec.eclipse.xmen_2.7.101/dtd/http___www.bea.com_servers_wls810_dtd_weblogic810-web-jar.dtd
    ./com.genuitec.eclipse.xmen_2.7.101/dtd/http___www.jboss.org_j2ee_dtd_jboss-web.dtd

    #208581 Reply

    Scott Anderson
    Participant

    Exactly what does your DOCTYPE look like for this file?

    #208592 Reply

    Mark Sommer
    Member

    <!DOCTYPE web-app
    PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN”
    http://java.sun.com/j2ee/dtds/web-app_2_2.dtd”&gt;

    #208596 Reply

    Riyad Kalla
    Member

    You are mostly likely using this file then:

    http___java.sun.com_j2ee_dtds_web-app_2_2.dtd

    Also this error IS important and pretty much tells you whats wrong:

    Kind Status Priority Description Resource In Folder Location
    Error The content of element type “web-app” must match “(icon?,display-name?,description?,distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*)”. web.xml licensing/pages/WEB-INF line 78

    Your file is not valid against the Web 2.2 DTD, filter’s were not introduced until 2.3, so you need to either update your DTD reference to use 2.3 (MyEclipse will automatically use it when you change the DTD url) or don’t use filters.

    #208597 Reply

    Mark Sommer
    Member

    Thanks. I’ve fixed it now.

    #208598 Reply

    Riyad Kalla
    Member

    Cool, glad to hear it.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: web.xml parsing errors when using filters [Closed]

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