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
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
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).
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>
Moving to DR03 as didn't get included for earlier payload.
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/
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
Created attachment 916186 [details] version-check-cli
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