8 Replies Latest reply on Jan 21, 2011 7:13 PM by gturner

    jboss 5.1 jboss-web.xml is not well formed ?

    gerry.matte

      I've been converting a jboss 4 web application to be compliant with jboss 5.1

       

      One of the webapp XML files that now has a new prolog (schema now replacing a DTD) is the jboss-web.xml file is causing jboss 5.1 to throw exceptions claiming that the jboss-web.xml file is not well formed.  The XML editor in eclipse and my external XML editor (Altova XMLspy) both consider the file to be well formed and compliant with the schema.

       

      Below are the former (jboss 4) and current (jboss 5.1) versions of the file.  Can anyone see a cause for the exception shown at the end of this post ?

       

      Thanks in advance

      Gerry Matte

       

      [see my reply below]

       

      and the exception stack trace thrown by jboss 5.1 is:

      16:00:16,993 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 46s:934ms

      16:00:19,747 ERROR [AbstractKernelController] Error installing to Parse: name=vfsfile:/C:/Users/Gerry/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server_(1)1288291257195/deploy/jbossTests.war/ state=Not Installed mode=Manual requiredState=Parse
      org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfsfile:/C:/Users/Gerry/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server_(1)1288291257195/deploy/jbossTests.war/
           at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
      [snip]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)

      Caused by: java.lang.Exception: The xml jbossTests.war/WEB-INF/jboss-web.xml is not well formed!
           at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:191)
           at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:166)
           at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:137)
           at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:121)
           at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:256)
           at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:188)
           at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:348)
           ... 30 more
      16:00:19,749 WARN  [HDScanner] Failed to process changes
      org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
        • 1. Re: jboss 5.1 jboss-web.xml is not well formed ?
          gerry.matte

          Sorry - I failed to correctly specify the markup needed to display the text of the two jboss-web.xml files.

          I'll try using an image to show them.

          jboss-web.png

          • 2. Re: jboss 5.1 jboss-web.xml is not well formed ?
            jaikiran

            The schemaLocation looks incorrect. Try this:

             

             

             

            <jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"  
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
                       xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd"  
                       version="5.1">
            
            
            
            • 3. Re: jboss 5.1 jboss-web.xml is not well formed ?
              gerry.matte

              There is no schema at the URL http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd so validation fails immediately when using an XML editor.  I only found the schema location that I was using after google searching for hours..... 

              Also, the version attribute is not a valid attribute for the jboss-web tag according to the eclipse XML editor.

              • 4. Re: jboss 5.1 jboss-web.xml is not well formed ?
                jaikiran

                Gerry Matte wrote:

                 

                There is no schema at the URL http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd so validation fails immediately when using an XML editor. 

                Unfortunately, they haven't been published online. You'll find this xsd in JBOSS_HOME/docs/schema folder.

                 

                Gerry Matte wrote:

                 

                I only found the schema location that I was using after google searching for hours.....

                But that's an incorrect schemaLocation value.

                • 5. Re: jboss 5.1 jboss-web.xml is not well formed ?
                  gerry.matte

                  It's the schema URL value that is embedded in the schema that arrived with jboss 5.1.0.GA in the [JBOSS_HOME]/docs/schema copy of jboss-web_5_1.xsd

                   

                  It's also the value you provided as xsi:schemaLocation.

                   

                  If I use the attribute version="5.1", jboss throws org.jboss.xb.binding.JBossXBException: Failed to parse source: cvc-complex-type.3.2.2: Attribute 'version' is not allowed to appear in element 'jboss-web'.  The schema supplied with jboss states incorrectly that this attribute may be used for tage joboss-web.

                   

                  When I store the jboss collection of schemas on my localhost webserver and adjust the xsi:schemaLocation to reference localhost, the jboss-web.xml file again throws a not well-formed exception.  Further, my Altova XmlSpy XML Editor claims that the chain of included schemas are in conflict with each other:

                  'javaee:service-refGroup' is already declared in schema document 'http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_2.xsd'.
                      Error location: schema / group
                      Details
                          sch-props-correct.2: 'javaee:service-refGroup' is already declared in schema document 'http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_2.xsd'.

                  • 6. Re: jboss 5.1 jboss-web.xml is not well formed ?
                    gerry.matte

                    By the way, in case anyone else reads this posting, my current work around solution is to start my jboss-web.xml with the prolog that works for jboss 4.2.3.GA.  That seems to work ok with jboss 5.1 (a backwards compatibility feature I'm sure).

                    <!DOCTYPE jboss-web PUBLIC
                        "-//JBoss//DTD Web Application 4.2//EN"
                        "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
                    <jboss-web>

                    • 7. Re: jboss 5.1 jboss-web.xml is not well formed ?
                      gerry.matte

                      In reviewing the posts, I see that I failed to state that I did try the exact coding that jaikiran first provided.  The version attribute caused an exception.  When I removed the version attribute, the jboss-web.xml threw a "not well-formed" exception.  I apologise for not providing that feedback before now.  I know there's nothing more annoying than having your suggestion ignored - that was not the case at all.  I tried your suggestion immediately.

                      • 8. Re: jboss 5.1 jboss-web.xml is not well formed ?
                        gturner

                        Ugh... I just got hit by this error trying to get a web application to deploy on JBoss 5.1.0.GA.  The application had been using XDoclet for generating web.xml, jboss-web.xml and a taglib descriptor.  Unfortunately XDoclet was generating an invalid 2.4 web.xml, JBoss 4.0 and 4.2 series didn't mind, but 5.1 breaks.  XDoclet is very old (development stopped in 2005) and braindead, so I'm having to convert this app from XDoclet to hand-written deployment descriptors.

                         

                        I get the same error trying to use jboss-web_5_1.xsd: "jboss-web.xml is not well formed!"

                         

                        Seems like a step backward having to use 4.2 style jboss-web.xml.  How could we be the only people having this error?

                         

                        Furthermore the XSD file looks a bit misleading, like a copy-paste from the Sun's Servlet XSD's, example namespace is wrong, version attribute doesn't exist.  Examples of boolean types are invalid (e.g. uppercase "TRUE" is invalid, BTW why the heck did Sun and this quasi-copy in JBoss redefine a boolean type when that's already a builtin Schema type?!).

                         

                        Madness.