Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-12235

WS-MAN doesn't work with JDK 11



    • Horizon 2019 - September 4th, Horizon 2019 - September 11th


      I was playing with a test environment to get some statistics via WinRM from Windows Servers and Windows 10, and I found that even if everything was working on Meridian 2018, I never got it to work on Horizon 24 or latest Snapshot of develop (H25 build 94).

      As the only difference between the Meridian vs both Horizon deployments was the fact that I was using OpenJDK 11 for H24 and H25-Snapshot, I decided to re-test everything again with the latest OpenJDK 8 in Horizon.

      With OpenJDK 8 in place, WS-Man works without issues on H24 and H25.

      Also, I found that the test JAR from https://github.com/OpenNMS/wsman, in other words org.opennms.core.wsman.cli-1.2.3.jar didn't work with OpenJDK 11, and this is the error I got:

      [root@horizon24 ~]# /usr/lib/jvm/java-11/bin/java -jar org.opennms.core.wsman.cli-1.2.3.jar -vvv -w WSMAN_1_0 -r -u operator -p operator -resourceUri http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_OperatingSystem
      [INFO ] org.opennms.core.wsman.WSManCli 2019-08-14 14:39:54.285 [main] WSManCli - Using endpoint: WSManEndpoint[url='', isGSSAuth='false', isBasicAuth='true', isStrictSSL='false', serverVersion='WSMAN_1_0',  maxElements='100', maxEnvelopeSize='null'connectionTimeout='null', receiveTimeout='null']
      [INFO ] org.opennms.core.wsman.WSManCli 2019-08-14 14:39:54.292 [main] WSManCli - Enumerating and pulling on 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_OperatingSystem'...
      Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBElement
          at schemas.dmtf.org.wbem.wsman.v1.ObjectFactory.createOptimizeEnumeration(ObjectFactory.java:688)
          at org.opennms.core.wsman.cxf.CXFWSManClient.enumerate(CXFWSManClient.java:178)
          at org.opennms.core.wsman.cxf.CXFWSManClient.enumerateAndPull(CXFWSManClient.java:209)
          at org.opennms.core.wsman.cxf.CXFWSManClient.enumerateAndPull(CXFWSManClient.java:284)
          at org.opennms.core.wsman.WSManCli.doMain(WSManCli.java:137)
          at org.opennms.core.wsman.WSManCli.main(WSManCli.java:91)
      Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBElement
          at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
          at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          ... 6 more

      But, if I use OpenJDK 8, it works as expected:

      [root@horizon24 ~]# /usr/lib/jvm/java-1.8.0/bin/java -jar org.opennms.core.wsman.cli-1.2.3.jar -vvv -w WSMAN_1_0 -r -u operator -p operator -resourceUri http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_OperatingSystem | grep Caption
                <p:Caption>Microsoft Windows 10 Enterprise N</p:Caption>
          Caption = Microsoft Windows 10 Enterprise N

      Unfortunately, I never got errors on H24 or H25 with OpenJDK 11 when I've tried WS-Man.




            cgorantla Chandra Gorantla
            agalue Alejandro Galue
            0 Vote for this issue
            3 Start watching this issue