Bug 1195161

Summary: Wrong value of atomic types in standard configuration XML files
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Marek Kopecky <mkopecky>
Component: Domain ManagementAssignee: Radovan Netuka <rnetuka>
Status: CLOSED WONTFIX QA Contact: Marek Kopecky <mkopecky>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.0CC: cdewolf, dandread, msimka, msochure, pkremens, rnetuka
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://github.com/jbossas/jboss-eap/pull/2735
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-20 11:51:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Xsd schema (with all necessary schemas included) none

Description Marek Kopecky 2015-02-23 09:46:03 UTC
Description of problem:
  XSD schema doesn't support "${variable}" values of some attributes.

  XSD schema: docs/schema/jboss-as-config_1_7.xsd

  Affected attributes:
    port-offset
    port
    multicast-port
    
  Affected files:
    standalone/configuration/standalone.xml
    standalone/configuration/standalone-osgi.xml
    standalone/configuration/standalone_xml_history/standalone.boot.xml
    standalone/configuration/standalone_xml_history/standalone.initial.xml
    standalone/configuration/standalone_xml_history/standalone.last.xml
    standalone/configuration/standalone-ha.xml
    standalone/configuration/standalone-full.xml
    standalone/configuration/standalone-full-ha.xml
    domain/configuration/host.xml
    domain/configuration/domain.xml
    domain/configuration/host-slave.xml
    domain/configuration/host-master.xml
    docs/examples/configs/standalone-osgi-only.xml
    docs/examples/configs/standalone-picketlink.xml
    docs/examples/configs/standalone-jts.xml
    docs/examples/configs/standalone-hornetq-colocated.xml
    docs/examples/configs/standalone-xts.xml
    docs/examples/configs/standalone-genericjms.xml

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

Validate logs for standalone/configuration/standalone-full-ha.xml:
  standalone/configuration/standalone-full-ha.xml:515: element socket-binding-group: Schemas validity error : Element '{urn:jboss:domain:1.7}socket-binding-group', attribute 'port-offset': '${jboss.socket.binding.port-offset:0}' is not a valid value of the atomic type 'xs:int'.
  standalone/configuration/standalone-full-ha.xml:516: element socket-binding: Schemas validity error : Element '{urn:jboss:domain:1.7}socket-binding', attribute 'port': '${jboss.management.native.port:9999}' is not a valid value of the atomic type 'xs:unsignedShort'.
  standalone/configuration/standalone-full-ha.xml:517: element socket-binding: Schemas validity error : Element '{urn:jboss:domain:1.7}socket-binding', attribute 'port': '${jboss.management.http.port:9990}' is not a valid value of the atomic type 'xs:unsignedShort'.
  standalone/configuration/standalone-full-ha.xml:518: element socket-binding: Schemas validity error : Element '{urn:jboss:domain:1.7}socket-binding', attribute 'port': '${jboss.management.https.port:9443}' is not a valid value of the atomic type 'xs:unsignedShort'.
  standalone/configuration/standalone-full-ha.xml:530: element socket-binding: Schemas validity error : Element '{urn:jboss:domain:1.7}socket-binding', attribute 'multicast-port': '${jboss.messaging.group.port:9876}' is not a valid value of the atomic type 'xs:positiveInteger'.

Comment 1 Brian Stansberry 2015-02-23 15:02:02 UTC
If you use an expression, you have to convert the doc to a non-expression value before validating. I have no intent to change this.

Comment 3 Weston M. Price 2015-05-07 00:02:01 UTC
What is the validation scenario where this error is occurring? I am assuming it's in testing or something like that and not at runtime or this would be a different problem. As for the ports/variables in the XSD, Brian is right, we are going to need to do some form of conversion. I mean, we could setup some form of XSL transformation or do an Ant replacement before validation. Might be something we should discuss; although, it's a lot of work for a few simple variables.

Comment 4 Marek Kopecky 2015-05-25 05:48:53 UTC
Validation scenario where this error is occurring: validate xml files (mentioned in description of this bugzilla) without running EAP

Comment 5 Weston M. Price 2015-05-26 01:20:30 UTC
Right, I get how the validation is failing, but can you point me to the tools/process you are using to do this? I would like to use yours without having to write my own. Plus, I think we should be using the same process, at least for stuff like this. Thanks.

Comment 6 Marek Kopecky 2015-05-27 06:25:29 UTC
I prepared manually xsd schema (with all necessary schemas included). Then I used xmllint:

mv all.xsd $EAP_HOME
cd $EAP_HOME
for line in `find standalone/ domain/ bin/ docs/ appclient/ | grep "\.xml$"` ; do echo $line ; xmllint --noout -schema all.xsd $line ; echo ; done

Comment 7 Marek Kopecky 2015-05-27 06:27:03 UTC
Created attachment 1030333 [details]
Xsd schema (with all necessary schemas included)

Comment 8 Weston M. Price 2015-06-01 07:34:20 UTC
What we probably need if we are going to validate this properly is a custom type where we capture both the property name, and a port [offset]. This will allow the files to be validated correctly. However, I'm not sure how big of a change this is and all the files it would effect. Looking at that next.

Comment 9 Weston M. Price 2015-06-01 07:47:28 UTC
Btw, cool little way to do the validation with xmllint. Thanks!

Comment 10 Marek Kopecky 2015-06-01 11:23:04 UTC
You are welcome!

Comment 11 Weston M. Price 2015-07-06 21:57:19 UTC
Ok, there are basically two choices for a resolution of this issue,neither of them is great: 

1) create a new datatype corresponding to the system property:port mapping. To be clear, there is no native XML type that could accommodate this construct. Should we create one there are the obvious questions:
   a) where does it live in our schema
   b) where can it/should it be used
   
It looks simple at face value in that it's just a restriction of two simple types xs:string and xs:int. The construct is not the hard part,its how many areas the change would touch which are quite a few. Note, this a model change as well and as such, has a separate process for change acceptable as part of the SET workflow.

2)Create an XSLT stylesheet that transforms the value somehow. Note, it probably could not be done in a stylesheet alone as the system properties would need to be known for that particular instance to which the XML belongs. This would be the least intrusive of the two options. I'm not sure the exact amount of work but the mapping is simply

  string:port->int

Either approach has it's drawbacks and I really just need to know if this is something we want to invest time. This only comes into effect, to my knowledge, when we are running in domain mode using port offsets to generate nth member of the cluster/domain. 

The major drawback in not doing this is that when the above configuration is used we have no effective way to validate the files. Important yes, model changing worth...I'm not so sure.

Comment 14 Mike McCune 2016-03-28 23:29:58 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 15 JBoss JIRA Server 2016-04-20 11:46:32 UTC
Radovan Netuka <rnetuka> updated the status of jira JBEAP-4263 to Closed

Comment 16 Radovan Netuka 2016-04-20 11:51:42 UTC
Rejected on upstream
https://github.com/wildfly/wildfly-core/pull/1506

Comment 17 JBoss JIRA Server 2016-04-20 12:26:31 UTC
Radovan Netuka <rnetuka> updated the status of jira JBEAP-4263 to Reopened

Comment 18 JBoss JIRA Server 2016-04-20 12:26:43 UTC
Radovan Netuka <rnetuka> updated the status of jira JBEAP-4263 to Resolved