[jboss-jira] [JBoss JIRA] Created: (JBAS-6426) "jboss_5.0.xsd" of JBoss 5.0GA is invalid

Wolfgang Knauf (JIRA) jira-events at lists.jboss.org
Wed Jan 28 14:40:44 EST 2009


"jboss_5.0.xsd" of JBoss 5.0GA is invalid
-----------------------------------------

                 Key: JBAS-6426
                 URL: https://jira.jboss.org/jira/browse/JBAS-6426
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: JBossAS-5.0.0.GA
            Reporter: Wolfgang Knauf


The jboss_5.0.xsd in the JBoss 5.0GA release (\docs\schema) is invalid. 

First of all: The comment in "jboss_5_0.xsd" showing a sample "jboss.xml" file seems to be wrong, as this jboss.xml leads to a deployment error:
This is found in the XSD:
	    <jboss xmlns="http://www.jboss.com/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.jboss.org/j2ee/schema
                            http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
             version="5.0">
	       ...
		 </jboss>
	
The deployment error is:
...
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Element {http://www.jboss.com/xml/ns/javaee}jboss is not bound as a global element.
	at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203)
	at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)	


I found that the following snippet is working on deploy (but version is still invalid, see below!):
<?xml version="1.0" encoding="UTF-8"?>
<jboss 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_5_0.xsd"
             version="5.0">
	....
</jboss>

=================
The rest of the problems occur when using Eclipse 3.4/WebToolsPlatform 3.0 to build a "jboss.xml" which references to XSD. The errors also occur when adding the XSD itself to the project so that WTP validates it.

First one:
"Failed to read schema document 'ejb-jar_3_0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>."

Solution:
Modify import of "ejb-jar_3_0.xsd" to:
<xsd:import namespace="http://java.sun.com/xml/ns/javaee" schemaLocation="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"/>

===============
This leads to the next one:
"http://www.jboss.com/xml/ns/javaee":security-identity and "http://www.jboss.com/xml/ns/javaee":security-identity (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.

Solution: in the definition of "message-driven-bean" is a dupliate "security-identity" element:
<xsd:complexType name="message-driven-beanType">
   ...
         <xsd:element name="service-ref" type="jboss:service-refType" minOccurs="0"
                      maxOccurs="unbounded"/>
===>         <xsd:element name="security-identity" type="jboss:security-identityType" minOccurs="0"/>
         <xsd:element name="resource-ref" type="jboss:resource-refType" minOccurs="0"
                      maxOccurs="unbounded"/>
         <xsd:element name="service-ref" type="jboss:service-refType" minOccurs="0"
                      maxOccurs="unbounded"/>
         <xsd:element name="security-identity" type="jboss:security-identityType" minOccurs="0"/>
         <xsd:element name="resource-ref" type="jboss:resource-refType" minOccurs="0"
                      maxOccurs="unbounded"/>
         <xsd:element name="resource-env-ref" type="jboss:resource-env-refType" minOccurs="0"
                      maxOccurs="unbounded"/>
         <xsd:element name="message-destination-ref" type="jboss:message-destination-refType"
                      minOccurs="0" maxOccurs="unbounded"/>

===>         <xsd:element name="security-identity" type="jboss:security-identityType" minOccurs="0" maxOccurs="1"/>
         <xsd:element name="security-domain" type="jboss:security-domainType" minOccurs="0"/>
         <xsd:element name="method-attributes" type="jboss:method-attributesType" minOccurs="0"/>

Remove one of the duplicates.

Now the XSD validates.
=================
So back to my jboss.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jboss 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 jboss_5_0.xsd"
             version="5.0">
</jboss>

Error:
Value '5.0' of attribute 'version' of element 'jboss' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '3.0'.

Solution: version must be "3.0":
<jboss 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 jboss_5_0.xsd"
             version="3.0">

I will attach a reworked file.

Please take a look at bug https://jira.jboss.org/jira/browse/JBAS-6114 
This one is about updating the XSD at http://www.jboss.org/j2ee/schema/ , which would upload the invalid file from 5.0GA, and I think it should be blocked.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list