1 2 Previous Next 20 Replies Latest reply on Jul 16, 2008 8:19 PM by jinpsu Go to original post
      • 15. Re: Unable To Get Started With Ant Task
        ssilvert

         

        "jinpsu" wrote:
        Not sure if this is related to your issue, but I ran into problems with the ant task properly editing web.xml. I found that the ant task was inserting the filters, servlets, and mappings (seemingly) at random throughout the file. For example, filter mappings would be defined before the filter itself and my web app would choke on it.

        To get around this, I moved all my existing < filter >, < filter-mapping >, < servlet >, and < servlet-mapping > tags to the top of web.xml. Only then did it seem to correctly modify the file and allow my app to cleanly start up.


        I'm pretty sure that the web.xml spec was changed so that the order of filter and servlet declarations doesn't matter. If you are defining your web.xml based on an old DTD (Servlet 2.3?) then you will see this problem.

        The ant task needs to take this into account, of course, but I don't know how soon we can get to it. A full rewrite of the ant task and a new Maven JSFUnit plugin are planned but it probably won't happen until after GA.

        Also, the Cactus project is working on this problem too, so we'll borrow from them as needed.

        Stan

        • 16. Re: Unable To Get Started With Ant Task

           

          "stan.silvert@jboss.com" wrote:
          I'm pretty sure that the web.xml spec was changed so that the order of filter and servlet declarations doesn't matter. If you are defining your web.xml based on an old DTD (Servlet 2.3?) then you will see this problem.

          Stan


          Well I'm using JBoss 4.2.2.GA which I believe is bundled with Servlet 2.4.

          Justin.

          • 17. Re: Unable To Get Started With Ant Task
            ssilvert

             

            "jinpsu" wrote:
            "stan.silvert@jboss.com" wrote:
            I'm pretty sure that the web.xml spec was changed so that the order of filter and servlet declarations doesn't matter. If you are defining your web.xml based on an old DTD (Servlet 2.3?) then you will see this problem.

            Stan


            Well I'm using JBoss 4.2.2.GA which I believe is bundled with Servlet 2.4.

            Justin.

            I'm talking about the DTD declaration on web.xml. It's been awhile since I tried it, so I don't remember exactly which spec allows random ordering. I think it was indeed 2.4. So if you declare your web.xml as following the 2.4 XML schema it might work.

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


            Stan

            • 18. Re: Unable To Get Started With Ant Task

              Ah yes, the schema I'm using in web.xml is:

              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
              


              Justin.

              • 19. Re: Unable To Get Started With Ant Task
                kragoth

                I'm using 2.5 though :P

                <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
                


                and I have no problems. :s

                • 20. Re: Unable To Get Started With Ant Task

                  Well I'm not saying it won't work all the time. I'm no longer having issues, either. But, I had to rearrange web.xml in order for it to work. Originally, I had defined filters and servlets about 100 lines down. Once I moved them all towards the top of web.xml, it worked. It was definitely the ordering that was screwing it up but I don't know why (using 2.5).

                  Justin.

                  1 2 Previous Next