Jaikiran Pai wrote:Are you seeing that error in your IDE? Does your application deploy fine?
Kiran,
I am getting this error in the Eclipse IDE and all the different XML Editors.
The exact error is this.
In the Jboss-ejb3.xml,its trying to reference
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd something like this.
<?xml version="1.0" encoding="UTF-8"?>
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="urn:clustering:1.0"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee jboss-ejb3-2_0.xsd
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1" impl-version="2.0">
In the above,We are referencing both Schemas
http://www.jboss.com/xml/ns/javaee jboss-ejb3-2_0.xsd (namespace is
http://www.jboss.com/xml/ns/javaee ) and
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd (namespace is
http://java.sun.com/xml/ns/javaee) under xsi:schemaLocation.
jboss-ejb3-2_0.xsd inturn references jboss-ejb3-spec-2_0.xsd something like this
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.jboss.com/xml/ns/javaee"
xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="2.0">
<!-- xs:import namespace="http://java.sun.com/xml/ns/javaee" schemaLocation="ejb-jar_3_1.xsd"/ -->
<!-- xs:import namespace="http://java.sun.com/xml/ns/javaee" schemaLocation="http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"/ -->
<xs:import namespace="http://java.sun.com/xml/ns/javaee" schemaLocation="jboss-ejb3-spec-2_0.xsd"/>
There is an ambiguity error or the Conflict that is Caused for the Element <assembly-descriptorType> in both jboss-ejb3-spec-2_0.xsd and ejb-jar_3_1.xsd
1.
jboss-ejb3-spec-2_0.xsd Defines the Defines the Element <assembly-descriptorType> as below:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://java.sun.com/xml/ns/javaee"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:jboss="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-ejb3-2_0.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="2.0">
<!-- xs:include schemaLocation="ejb-jar_3_1.xsd"/ -->
<!--
<xs:include schemaLocation="http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"/>
-->
<xs:import namespace="http://www.jboss.com/xml/ns/javaee" schemaLocation="jboss-ejb3-2_0.xsd"/>
<xs:redefine schemaLocation="http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
<xs:complexType name="assembly-descriptorType">
<xs:complexContent>
<xs:extension base="javaee:assembly-descriptorType">
<xs:sequence>
<xs:element ref="javaee:assembly-descriptor-entry" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
It references assembly-descriptor like this:
<xs:complexType name="jboss-ejb-jarType">
<xs:complexContent>
<xs:extension base="javaee:ejb-jarType">
<xs:sequence>
<xs:element ref="jboss:enterprise-beans" minOccurs="0"/>
<xs:element name="assembly-descriptor" type="javaee:assembly-descriptorType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="impl-version" type="javaee:dewey-versionType" fixed="2.0" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
2.
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd Defines the Element <assembly-descriptorType> something like this
<xsd:complexType name="assembly-descriptorType">
<xsd:annotation>
<xsd:documentation>
The assembly-descriptorType defines
application-assembly information.
The application-assembly information consists of the
following parts: the definition of security roles, the
definition of method permissions, the definition of
transaction attributes for enterprise beans with
container-managed transaction demarcation, the definition
of interceptor bindings, a list of
methods to be excluded from being invoked, and a list of
exception types that should be treated as application exceptions.
All the parts are optional in the sense that they are
omitted if the lists represented by them are empty.
Providing an assembly-descriptor in the deployment
descriptor is optional for the ejb-jar or .war file producer.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="security-role"
type="javaee:security-roleType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="method-permission"
type="javaee:method-permissionType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="container-transaction"
type="javaee:container-transactionType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="interceptor-binding"
type="javaee:interceptor-bindingType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="message-destination"
type="javaee:message-destinationType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="exclude-list"
type="javaee:exclude-listType"
minOccurs="0"/>
<xsd:element name="application-exception"
type="javaee:application-exceptionType"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="id"
type="xsd:ID"/>
</xsd:complexType>
Because of the above Scenario when I am trying to Validate the XML ,I am getting the following error:
cos-nonambig: "http://java.sun.com/xml/ns/javaee":assembly-descriptor and "http://java.sun.com/xml/ns/javaee":assembly-descriptor (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
Attached are the xsd's. I renamed to xsd1.