Bug 1075875 - remote API client version is 'undefined' when client is packaged as executable JAR
Summary: remote API client version is 'undefined' when client is packaged as executabl...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: CLI
Version: JON 3.2.1
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: DR03
: JON 3.2.2
Assignee: Libor Zoubek
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-13 05:44 UTC by Jeeva Kandasamy
Modified: 2018-12-04 17:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-29 00:17:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
version-check-cli (78.50 KB, image/png)
2014-07-07 20:17 UTC, Armine Hovsepyan
no flags Details

Description Jeeva Kandasamy 2014-03-13 05:44:54 UTC
Description of problem:

1) Tested with "Package required libraries into generated JAR"
------------------------------------------------------------------
[jkandasa@jkandasa java-client]$ java -Drhq.client.version-check=true -jar my-client.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.IllegalStateException: This client [ undefined ] does not support the remote server [3.2.0.GA]
	at org.rhq.enterprise.clientapi.RemoteClient.checkServerSupported(RemoteClient.java:512)
	at org.rhq.enterprise.clientapi.RemoteClient.doConnect(RemoteClient.java:408)
	at org.rhq.enterprise.clientapi.RemoteClient.connect(RemoteClient.java:200)
	at com.redhat.qe.jon.client.Client.getRemoteClient(Client.java:16)
	at com.redhat.qe.jon.client.Client.main(Client.java:29)
	... 5 more


[jkandasa@jkandasa java-client]$ java -Drhq.client.version-check=false -jar my-client.jar
0 [main] ERROR org.rhq.enterprise.clientapi.RemoteClient  - This client [ undefined ] does not support the remote server [3.2.0.GA] - 'rhq.client.version-check' was not set to true so this client will be allowed to continue but expect errors
11 [main] ERROR org.rhq.enterprise.clientapi.RemoteClient  - This client [ undefined ] does not support the remote server [3.2.0.GA] - 'rhq.client.version-check' was not set to true so this client will be allowed to continue but expect errors
98 [main] INFO com.redhat.qe.jon.client.Client  - IsConnnected?:  true
98 [main] INFO com.redhat.qe.jon.client.Client  - Server Version:  3.2.0.GA
98 [main] INFO com.redhat.qe.jon.client.Client  - Server Build Number:  d18651a:f535707
98 [main] INFO com.redhat.qe.jon.client.Client  - Subject:  Subject[id=2,name=rhqadmin]
------------------------------------------------------------------

2) Tested with "Extract required libraries into generated JAR"
------------------------------------------------------------------
[jkandasa@jkandasa java-client]$ java -Drhq.client.version-check=true -jar my-client.jar
Exception in thread "main" java.lang.IllegalStateException: This client [ undefined ] does not support the remote server [3.2.0.GA]
	at org.rhq.enterprise.clientapi.RemoteClient.checkServerSupported(RemoteClient.java:512)
	at org.rhq.enterprise.clientapi.RemoteClient.doConnect(RemoteClient.java:408)
	at org.rhq.enterprise.clientapi.RemoteClient.connect(RemoteClient.java:200)
	at com.redhat.qe.jon.client.Client.getRemoteClient(Client.java:16)
	at com.redhat.qe.jon.client.Client.main(Client.java:29)


[jkandasa@jkandasa java-client]$ java -Drhq.client.version-check=false -jar my-client.jar
0 [main] ERROR org.rhq.enterprise.clientapi.RemoteClient  - This client [ undefined ] does not support the remote server [3.2.0.GA] - 'rhq.client.version-check' was not set to true so this client will be allowed to continue but expect errors
15 [main] ERROR org.rhq.enterprise.clientapi.RemoteClient  - This client [ undefined ] does not support the remote server [3.2.0.GA] - 'rhq.client.version-check' was not set to true so this client will be allowed to continue but expect errors
58 [main] INFO com.redhat.qe.jon.client.Client  - IsConnnected?:  true
58 [main] INFO com.redhat.qe.jon.client.Client  - Server Version:  3.2.0.GA
59 [main] INFO com.redhat.qe.jon.client.Client  - Server Build Number:  d18651a:f535707
59 [main] INFO com.redhat.qe.jon.client.Client  - Subject:  Subject[id=2,name=rhqadmin]
------------------------------------------------------------------

In both cases it is failing if we pass "-Drhq.client.version-check=true" and it is passing with error message if we pass "-Drhq.client.version-check=false". 

As we have client/server version check, we have to keep client version some where in jar file (like rhq-client.properties). Should be included while chosing the option "Package required libraries into generated JAR" or "Extract required libraries into generated JAR". We can continue as "-Drhq.client.version-check=false", however user do not know which version of remote client is he/she using after some time period. Might lead them in confusion state, like is it new version of client or old one.

Version-Release number of selected component (if applicable):
Server Version:  3.2.0.GA
Server Build Number:  d18651a:f535707
Client version: Same as server (required jars copied from JON server CLI client)

How reproducible:
always

Client side NPE was addressed in https://bugzilla.redhat.com/show_bug.cgi?id=1038364, however still client version is not maintained anywhere locally

Comment 1 Libor Zoubek 2014-04-24 15:24:38 UTC
My suggestion is (per Larry's comment on Bug 1038364) not to move client version to any property file, but instead fix this issue the following way:

1. if rhq-client.version-check=false - do not even try to detect the version and log any message - this is exactly what this property says : "NO version check, please"

2. introduce 'rhq.client.version' system property, that you can set or pass to your client that would take precedence over what could be found in manifest (if it exists). 

For users consuming our classes above way, we could recommend keeping our client version in their own property file or code - because it's their responsibility to know which version they use. If they would have used the recommended way (consuming our JARs, not just classes) they wouldn't have needed this.

I guess 1. is enough to fix this BZ, since there will be no log message about undefined version in case rhq-client.version-check=false

Comment 2 Libor Zoubek 2014-04-25 11:27:54 UTC
in master
commit 33c0cdd238dae97b63ad84fb7b9d89b716facbf0
Author: Libor Zoubek <lzoubek>
Date:   Fri Apr 25 13:24:28 2014 +0200

    [BZ 1075875] remote API client version is 'undefined' when client is
    packaged as executable JAR

    if rhq-client.version-check=false - do not even try to detect the version
    and log any message - this is exactly what this property says : "NO version
    check, please"

    introduced 'rhq.client.version' system property, that you can set or pass to
    your client that would take precedence over what could be found in manifest
    (if it exists).

Comment 3 Libor Zoubek 2014-06-09 12:26:13 UTC
cherry-picked

commit 019b3324dc71defb830aa8e99f43d29c4884b495
Author: Libor Zoubek <lzoubek>
Date:   Fri Apr 25 13:24:28 2014 +0200

    [BZ 1075875] remote API client version is 'undefined' when client is
    packaged as executable JAR

    if rhq-client.version-check=false - do not even try to detect the version
    and log any message - this is exactly what this property says : "NO version
    check, please"

    introduced 'rhq.client.version' system property, that you can set or pass to
    your client that would take precedence over what could be found in manifest
    (if it exists).

    (cherry picked from commit 33c0cdd238dae97b63ad84fb7b9d89b716facbf0)
    Signed-off-by: Libor Zoubek <lzoubek>

Comment 4 Simeon Pinder 2014-06-13 14:39:04 UTC
Moving to DR03 as didn't get included for earlier payload.

Comment 5 Simeon Pinder 2014-06-30 06:03:05 UTC
Moving to ON_QA as available for test in latest build:
http://jon01.mw.lab.eng.bos.redhat.com:8042/dist/release/jon/3.2.2.GA/6-28-2014/

Comment 6 Armine Hovsepyan 2014-07-07 20:17:02 UTC
for a jar with "Extract required libraries into generated JAR" -> exception is visible unless rhq.client.version-check=false is provided

for a jar with "Package required libraries into generated JAR" -> exception is not visible (my example is with external lib)

screen-shot attached

Comment 7 Armine Hovsepyan 2014-07-07 20:17:33 UTC
Created attachment 916186 [details]
version-check-cli

Comment 8 Larry O'Leary 2014-07-29 00:17:06 UTC
This has been verified and released in Red Hat JBoss Operations Network 3.2 Update 02 (3.2.2) available from the Red Hat Customer Portal[1].



[1]: https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=31783


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