Bug 1302544 - jboss-ejb3.xml validation errors.
jboss-ejb3.xml validation errors.
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Documentation (Show other bugs)
6.4.0
All All
high Severity high
: ---
: ---
Assigned To: sgilda
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-28 01:38 EST by xuzhan
Modified: 2017-05-02 08:25 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-05-02 08:25:27 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
sgilda: needinfo-


Attachments (Terms of Use)
Screen shot of this issue. (162.41 KB, image/jpeg)
2016-01-28 01:38 EST, xuzhan
no flags Details

  None (edit)
Description xuzhan 2016-01-28 01:38:24 EST
Created attachment 1119041 [details]
Screen shot of this issue.

Description of problem:
Create "jboss-ejb3.xml" in JBDS 8.0.0 based on document:
~~~
https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Development_Guide/sect-Reference2.html#jboss-ejb3xml_Deployment_Descriptor_Reference
~~~
After that, validation errors shows, see attachment "jbossejb3ValidationError.jpg".

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
Validation errors.

Expected results:
No errors.

Additional info:
We found solution to safely ignoring this error, but customer is working on a large application, he need this function work and the document above isn't actually a complete reference for jboss-ejb3.xml to be a instruction guide.
Comment 2 Carlo de Wolf 2016-02-01 17:32:23 EST
This is a documentation issue. The jboss:ejb-jar does not support enterprise-beans from the http://java.sun.com/xml/ns/javaee namespace.

See also https://github.com/jboss/metadata/blob/master/ejb/src/test/resources/org/jboss/metadata/ejb/test/ejbthree936/jboss-ejb3.xml
Comment 4 sgilda 2016-02-05 10:51:47 EST
Carlo: You say "The jboss:ejb-jar does not support enterprise-beans from the http://java.sun.com/xml/ns/javaee namespace."

What namespace should they use? 

When I look through the JBoss EAP source testsuite, I see lots of jboss-ejb3.xml files containing that namespace, for example:

<?xml version="1.0"?>  
   <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"
                  xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/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">
    <enterprise-beans>
        ...
    </enterprise-beans>
</jboss:ejb-jar>

$ grep 'xmlns="http://java.sun.com/xml/ns/javaee"' `find . -name 'jboss-ejb3.xml'`
./testsuite/integration/iiop/src/test/java/org/jboss/as/test/iiop/transaction/jboss-ejb3.xml:               xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/iiop/src/test/java/org/jboss/as/test/iiop/basic/jboss-ejb3.xml:               xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/iiop/src/test/java/org/jboss/as/test/iiop/security/jboss-ejb3.xml:               xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ws/serviceref/jboss-ejb3.xml:  xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/security/xacml/testobjects/config/jboss-ejb3.xml:	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:s="urn:security"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/stateless/pooling/ejb2/jboss-ejb3.xml:                  xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/descriptor/jboss-ejb3.xml:                  xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/iiop/naming/jboss-ejb3.xml:               xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/database/jboss-ejb3.xml:                  xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/management/deployments/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/transaction/cmt/timeout/jboss-ejb3.xml:               xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/security/jbossappxml/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/security/callerprincipal/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/security/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/security/rolelink/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/security/runas/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/security/runas/mdb/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/mdb/deliveryactive/jboss-ejb3.xml:               xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/mdb/ejb2x/jboss-ejb3.xml:               xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/mdb/messagedestination/jboss-ejb3.xml:                  xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/servlet/jboss-ejb3.xml:        xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/pool/override/jboss-ejb3.xml:<jboss xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/ejb2/reference/annotation/jboss-ejb3.xml:                  xmlns="http://java.sun.com/xml/ns/javaee"
./testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ee/injection/resource/resourceref/jboss-ejb3.xml:                  xmlns="http://java.sun.com/xml/ns/javaee"
Comment 5 Carlo de Wolf 2016-02-05 11:21:18 EST
Actually I'm wrong. The jboss:ejb-jar element supports both javaee:enterprise-beans and jboss:enterprise-beans.
So this is a bug in JBDS.

As a work-around you can keep using jboss:enterprise-beans element.
Comment 6 sgilda 2016-02-05 11:43:05 EST
Carlo, In chat, you mentioned that IDEA shows the same error, so I am not convince that this is a JBDS issue. 

This is not a documentation issue. Where does it belong?
Comment 7 sgilda 2016-02-05 11:44:20 EST
To avoid confusion with the doc team, I am moving this issue back to the EJB component until the correct location is decided.
Comment 8 Vlado Pakan 2016-02-12 05:49:34 EST
Looks like it's problem with jboss-ejb3-2_0.xsd as described here https://issues.jboss.org/browse/WFLY-3189

Fix is already pushed to jboss/metadata repo but did not make it to public web location https://issues.jboss.org/browse/WFLY-3891

It's not problem of JBDS the same issue is with plain Eclise.

As workarround user can remove "http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd" entry from xsi:schemaLocation attribute

If it's not ok for user I can try to find how to make it working with Eclipse probably altering Eclipse xml catalogue I would guess.
Comment 9 Carlo de Wolf 2016-02-12 08:56:03 EST
1. Schema changes should not be made after a release.
2. JBDS should use schema's from the release. The schema location is only a hint.
Comment 10 Vlado Pakan 2016-02-16 11:15:47 EST
My comment here https://issues.jboss.org/browse/JBIDE-18316?focusedCommentId=13163713&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13163713 describe the issue.

I deployed updated jboss-ejb3.xml to EAP and there were no errors.
But new error has appeared in JBDS after jboss-ejb3.xml is changed:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'c:clustering'. One of '{"http://java.sun.com/xml/ns/javaee":security-role, "http://java.sun.com/xml/ns/javaee":method-permission, "http://java.sun.com/xml/ns/javaee":container-transaction, "http://java.sun.com/xml/ns/javaee":interceptor-binding, "http://java.sun.com/xml/ns/javaee":message-destination, "http://java.sun.com/xml/ns/javaee":exclude-list, "http://java.sun.com/xml/ns/javaee":application-exception, "http://java.sun.com/xml/ns/javaee":assembly-descriptor-entry}' is expected.

Reason for this is missing XSD file for "urn:clustering:1.0" namespace. There was already PR to add this file to wildfly but was rejected because wildfly uses newer version of clustering "urn:clustering:1.1" as discussed here https://github.com/wildfly/wildfly/pull/6720. Once I added xsd file from this PR to JBDS XML catalog jboss-ejb3.xml file has no validation errors.

EAP is not validating "urn:clustering:1.0" namespace via XSD file but using own parser https://github.com/wildfly/wildfly/blob/master/ejb3/src/main/java/org/jboss/as/ejb3/clustering/EJBBoundClusteringMetaDataParser.java#L64 

Should I create PR adding xsd file for "urn:clustering:1.0" namespace to EAP 6.4.z, EAP 7 and Wildfly and BZ to update documentation or we should solve it different way?

I will search a bit if this "schemaLocation" override in Eclipse is bug or standard XSD schema procesing
Comment 11 Vlado Pakan 2016-02-17 01:44:27 EST
Since XSD for "urn:clustering:1.0" namespace is not actually used within EAP it's also possible to only add this XSD to JBDS catalog and update documentation without impact to EAP but It will mean validation for jboss-ejb3.xml will work only in JBDS without easy way to validate it in other IDE or CLI validator
Comment 12 Vlado Pakan 2016-02-18 13:22:34 EST
Jira for JBDS created https://issues.jboss.org/browse/JBIDE-21717 together with PR fixing it
Comment 13 Vlado Pakan 2016-02-29 11:26:12 EST
PR for JBDS is pushed please update documentation to contain jboss-ejb3.xml with this content without http://java.sun.com/xml/ns/javaee namespace schema location definition:

<?xml version="1.1" 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 http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd"
                  version="3.1"
                  impl-version="2.0">
      <enterprise-beans>
         <message-driven>
            <ejb-name>ReplyingMDB</ejb-name>
            <ejb-class>org.jboss.as.test.integration.ejb.mdb.messagedestination.ReplyingMDB</ejb-class>
            <activation-config>
               <activation-config-property>
                  <activation-config-property-name>destination</activation-config-property-name>
                  <activation-config-property-value>java:jboss/mdbtest/messageDestinationQueue
                  </activation-config-property-value>
               </activation-config-property>
            </activation-config>
         </message-driven>
      </enterprise-beans>
      <assembly-descriptor>
         <c:clustering>
            <ejb-name>DDBasedClusteredSFSB</ejb-name>
            <c:clustered>true</c:clustered>
         </c:clustering>
      </assembly-descriptor>
   </jboss:ejb-jar>
Comment 19 Vlado Pakan 2016-03-30 03:39:44 EDT
dmichael@redhat.com could you please update documentation as I described in commment #13
Comment 22 sgilda 2017-01-05 10:29:30 EST
I can take this one.
Comment 29 sgilda 2017-02-15 11:42:45 EST
This update is to the Development Guide.

Note You need to log in before you can comment on or make changes to this bug.