Bug 820570

Summary: [as7] code in discovery that figures out System property (sysprop) values by parsing the server command line does not process -P/--properties option
Product: [Other] RHQ Project Reporter: Ian Springer <ian.springer>
Component: PluginsAssignee: Charles Crouch <ccrouch>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.4CC: ccrouch, hbrock, hrupp, lzoubek, vnguyen
Target Milestone: ---   
Target Release: JON 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 819145 Environment:
Last Closed: 2013-09-03 11:12:58 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 819145, 820584, 820622    
Bug Blocks: 707223, 782579    

Description Ian Springer 2012-05-10 08:04:23 EDT
+++ This bug was initially created as a clone of Bug #819145 +++

standalone.sh/bat and domain.sh/bat both support the following command line options:

    -P=<url>                            Load system properties from the given 

    -P <url>                            Load system properties from the given 

    --properties=<url>                  Load system properties from the given 

--- Additional comment from mfoley@redhat.com on 2012-05-08 14:11:28 EDT ---

per BZ triage crouch, foley, loleary

--- Additional comment from ian.springer@redhat.com on 2012-05-09 20:18:00 EDT ---

Fixed in master: 


Note, AS7 support more than one -P and/or --properties option on the same command line, and our code handles that.
Comment 1 Charles Crouch 2012-05-10 08:25:32 EDT
*** Bug 820584 has been marked as a duplicate of this bug. ***
Comment 2 Ian Springer 2012-05-10 10:10:01 EDT
Cherry-picked to the release/jon3.1.x branch:

Comment 3 Viet Nguyen 2012-05-23 16:30:40 EDT
Does properties file path have to be absolute?  AS7 can process the following without any problem (values showed up in admin console)

./standalone.sh -P p1.properties -P= p2.properties --properties=p3.properties

JON Agent throws IllegalArgumentException: URI is not absolute

agent log
2012-05-23 16:25:57,601 ERROR [ResourceDiscoveryComponent.invoker.daemon-6] (rhq.modules.plugins.jbossas7.StandaloneASDiscovery)-
 Discovery of a JBossAS7 Standalone Server Resource failed for process: pid=[330], name=[java], ppid=[32746].
java.lang.IllegalArgumentException: URI is not absolute
        at java.net.URI.toURL(URI.java:1097)
        at org.rhq.modules.plugins.jbossas7.AS7CommandLine.toURL(AS7CommandLine.java:149)
        at org.rhq.modules.plugins.jbossas7.AS7CommandLine.processClassArgument(AS7CommandLine.java:133)
        at org.rhq.core.pluginapi.util.JavaCommandLine.parseClassArguments(JavaCommandLine.java:194)
        at org.rhq.core.pluginapi.util.JavaCommandLine.parseCommandLine(JavaCommandLine.java:159)
        at org.rhq.core.pluginapi.util.JavaCommandLine.<init>(JavaCommandLine.java:136)
        at org.rhq.modules.plugins.jbossas7.AS7CommandLine.<init>(AS7CommandLine.java:70)
        at org.rhq.modules.plugins.jbossas7.AS7CommandLine.<init>(AS7CommandLine.java:75)
        at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.discoverResources(BaseProcessDiscovery.java:135)
Comment 4 Libor Zoubek 2012-05-28 06:00:27 EDT
Moving ON_DEV, I get same exception as Viet - when passing relative path to properties file and server does not appear in discovery queue.

I've checked that relative path of properties file is based on process working directory (current directory when server is started)

On linux it should be easy to detect work dir for process (pwdx <pid>) but I am not sure about windows. 

If we cannot fully support this, please change the error message to something more user-friendly - for example : relative URL command line option to properties file is not supported
Comment 5 Ian Springer 2012-05-29 09:16:36 EDT
Fixed in master:

Comment 6 Ian Springer 2012-05-29 09:18:15 EDT
Cherry-picked to release/jon3.1.x branch:

Comment 7 Libor Zoubek 2012-05-30 07:49:27 EDT
verified in JON 3.1.CR1, also added CLI automation
Comment 10 Heiko W. Rupp 2013-09-03 11:12:58 EDT
Bulk closing of old issues in VERIFIED state.