Bug 847379

Summary: If agent does not have Internet access, XPath queries can fail
Product: [JBoss] JBoss Operations Network Reporter: Larry O'Leary <loleary>
Component: Plugin -- JBoss EAP 4, Plugin -- JBoss EAP 5Assignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: high    
Version: JON 2.4.2CC: fbrychta
Target Milestone: ER01   
Target Release: JON 3.2.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-02 20:36:24 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:
Bug Depends On: 627023    
Bug Blocks:    

Description Larry O'Leary 2012-08-10 19:09:18 UTC
Description of problem:
When the plug-in is attempting to discover configuration for a resource using XML parsing via xquery or XPath and the target XML document contains a remote document definition or schema reference, an exception can be thrown during parsing if the agent host is unable to reach the remote resource.

This can be seen in the AS 4 plug-in when attempting to determine the context-root value for an Embedded WAR by performing and xquery on the parent EAR's application.xml file. If the application.xml contains an XML DOCTYPE definition such as:

    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">

And the agent machine is unable to resolve or reach java.sun.com, the result is an invalid value being used for the WAR's context-root property and MBean query property.

Although XPath expects a well-formed XML document, schema and DTD validation is not required to query the documents contents. Therefore, validation/verification and remote schema loading should be disabled to prevent application server artifacts such as deployment descriptors from breaking the plug-in.

This issue also applies to the host.xml in JBoss AS 7. Again, if document schema or definition is defined in the XML (which is standard by most development and validation tools), the result will be that the agent must also be able to reach those resources in order for the XPath operation to be possible unless we disable this validation.

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

How reproducible:
Always

Steps to Reproduce:
1. Deploy an EAR which contains a WAR to JBoss AS making certain that the document defines a DOCTYPE or XML schema which references a remote URL
2. Add an alias for the remote URL to the agent machines /etc/hosts file to cause the host name mentioned in the URL to be unreachable.

   For example, if the URL is: http://java.sun.com/dtd/application_1_3.dtd
   Add the following to /etc/hosts
      127.0.0.1	java.sun.com
3. Add the JBoss AS server to JON inventory
  
Actual results:
The WAR will be discovered by show as DOWN and its Context Root property will be set to - invalid - and its JBoss Web Name property will be <null>

Expected results:
The WAR should show UP and its Context Root and JBoss Web Name property should be valid.

Comment 1 mark yarborough 2012-11-06 20:05:22 UTC
Per 3.1.2 triage with loleary, mfoley, ccrouch, asantos: Okay to move to JON 3.2.

Comment 2 Larry O'Leary 2013-06-03 18:13:05 UTC
Looks like this may have been done in master already with commits 09872c1 eff5f3c cacf370 as per upstream BZ627023.

Additionally testing instructions also available in upstream: see https://bugzilla.redhat.com/show_bug.cgi?id=627023#c4

Comment 3 Larry O'Leary 2013-09-06 14:33:15 UTC
As this is MODIFIED or ON_QA, setting milestone to ER1.

Comment 4 Filip Brychta 2013-12-10 15:58:48 UTC
Verified on:
Version :	
3.2.0.CR1
Build Number :	
6ecd678:d0dc0b6