Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55202

Performance Signature Plugin: JAXB API is missing with Java 11

      JAXB dependencies seems to be missing on classpath, while using jenkins/jenkins:jdk11:

      hudson.remoting.ProxyException: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
      	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1374)
      	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1327)
      	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1080)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      	at java.xml.bind/javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
      	at java.xml.bind/javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
      	at java.xml.bind/javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
      Caused: hudson.remoting.ProxyException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
       - with linked exception:
      [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
      	at java.xml.bind/javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
      	at java.xml.bind/javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
      	at java.xml.bind/javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
      	at java.xml.bind/javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
      	at retrofit2.converter.jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:74)
      Caused: hudson.remoting.ProxyException: java.lang.IllegalArgumentException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
       - with linked exception:
      [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
      	at retrofit2.converter.jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:76)
      	at retrofit2.converter.jaxb.JaxbConverterFactory.responseBodyConverter(JaxbConverterFactory.java:67)
      	at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:330)
      	at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:313)
      	at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:739)
      Caused: hudson.remoting.ProxyException: java.lang.IllegalArgumentException: Unable to create converter for class de.tsystems.mms.apm.performancesignature.dynatrace.rest.xml.model.LicenseInformation
          for method CustomXMLApi.getServerLicense
      	at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:755)
      	at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:741)
      	at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:172)
      	at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:170)
      	at retrofit2.Retrofit$1.invoke(Retrofit.java:147)
      	at com.sun.proxy.$Proxy85.getServerLicense(Unknown Source)
      	at de.tsystems.mms.apm.performancesignature.dynatrace.rest.DTServerConnection.getServerLicense(DTServerConnection.java:253)
      Caused: hudson.remoting.ProxyException: de.tsystems.mms.apm.performancesignature.dynatrace.rest.xml.CommandExecutionException: error while querying server license: Unable to create converter for class de.tsystems.mms.apm.performancesignature.dynatrace.rest.xml.model.LicenseInformation
          for method CustomXMLApi.getServerLicense
      	at de.tsystems.mms.apm.performancesignature.dynatrace.rest.DTServerConnection.getServerLicense(DTServerConnection.java:256)
      	at de.tsystems.mms.apm.performancesignature.dynatrace.PerfSigStartRecording.perform(PerfSigStartRecording.java:89)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
      	at hudson.security.ACL.impersonate(ACL.java:290)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

          [JENKINS-55202] Performance Signature Plugin: JAXB API is missing with Java 11

          I am about the same, just that I used the system property over the jaxb.properties file. Result is the same.

          I'm afraid this is because of the fact that the JAXB requirement is not in the plugin but in th Retrofit2 library used by the plugin.

          I tested the same configuration on the Sloccount plugin and it's working fine on this plugin. I run in both case mvnDebug -Djenkins.version=2.164.1 -Djavax.xml.bind.context.factory=com.sun.xml.bind.v2.ContextFactory hpi:run (with -pl dynatrace-appmon here) and for sloccount I could get it to work fine (not going into the catch here) and in Performace Signature Dynatrace I still have the same exception.

          The "only" difference between the two plugins is that JAXB is a transitive dependency here but not in Sloccount plugin. It makes no sense. I can see in both case the JAXB plugin installed on the instance. I can even run import com.sun.xml.bind.v2.ContextFactory; in the script console of both instances and it's working fine.

          Adrien Lecharpentier added a comment - I am about the same, just that I used the system property over the jaxb.properties file. Result is the same. I'm afraid this is because of the fact that the JAXB requirement is not in the plugin but in th Retrofit2 library used by the plugin. I tested the same configuration on the Sloccount plugin and it's working fine on this plugin. I run in both case mvnDebug -Djenkins.version=2.164.1 -Djavax.xml.bind.context.factory=com.sun.xml.bind.v2.ContextFactory hpi:run (with -pl dynatrace-appmon here) and for sloccount I could get it to work fine (not going into the catch here ) and in Performace Signature Dynatrace I still have the same exception. The "only" difference between the two plugins is that JAXB is a transitive dependency here but not in Sloccount plugin. It makes no sense. I can see in both case the JAXB plugin installed on the instance. I can even run import com.sun.xml.bind.v2.ContextFactory; in the script console of both instances and it's working fine.

          I'm that the retrofit library is creating the problem: https://github.com/square/retrofit/blob/fc14b32026a5a7b487f27483c18b2263d84bcf60/retrofit/src/main/java/retrofit2/Retrofit.java#L134.

          As mentioned in java9.wft/class-loading, this could be prevented by using ClassLoader.getPlatformClassLoader which is only available in Java 9+.

          Adrien Lecharpentier added a comment - I'm that the retrofit library is creating the problem: https://github.com/square/retrofit/blob/fc14b32026a5a7b487f27483c18b2263d84bcf60/retrofit/src/main/java/retrofit2/Retrofit.java#L134 . As mentioned in java9.wft/class-loading , this could be prevented by using ClassLoader.getPlatformClassLoader which is only available in Java 9+.

          Raphael Pionke added a comment - - edited

          I tried to use the moxy implementation of jaxb by using the org.eclipse.persistence:eclipselink:2.7.4 maven dependency in the dynatrace-appmon maven module and a jaxb.properties file with the following content:

          javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
          

          Same result, i get the following exception:

          javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
           - with linked exception:
          [java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory]

          So, it has to be something to do with the transitive dependency i think, cause the direct calls from the Unit tests are working in a java 11 environment.

          Raphael Pionke added a comment - - edited I tried to use the moxy implementation of jaxb by using the org.eclipse.persistence:eclipselink:2.7.4 maven dependency in the dynatrace-appmon maven module and a jaxb.properties file with the following content: javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory Same result, i get the following exception: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath. - with linked exception: [java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory] So, it has to be something to do with the transitive dependency i think, cause the direct calls from the Unit tests are working in a java 11 environment.

          Raphael Pionke added a comment - - edited

          Raphael Pionke added a comment - - edited I created a java 11 unit test with a mock server but i passes. I don't know why ... https://github.com/jenkinsci/performance-signature-dynatrace-plugin/blob/master/dynatrace-appmon/src/test/java/de/tsystems/mms/apm/performancesignature/dynatrace/Java11Test.java

          rpionke I don't know what change in the classpath or how the class are loaded, but in step-by-step debug of the test you added, I'm going through methods of Retrofit lib that I didn't see in the "real case" usage.

          Adrien Lecharpentier added a comment - rpionke I don't know what change in the classpath or how the class are loaded, but in step-by-step debug of the test you added, I'm going through methods of Retrofit lib that I didn't see in the "real case" usage.

          alecharp do you think, i might help to just get rid of the com.squareup.retrofit2:converter-jaxb dependency and copy those 4 classes into the dynatrace-appmon module?

          Raphael Pionke added a comment - alecharp do you think, i might help to just get rid of the com.squareup.retrofit2:converter-jaxb dependency and copy those 4 classes into the dynatrace-appmon module?

          rpionke at this moment, I trully believe that getting ride on this dependency is the better solution. You could still be using another converter.

          Adrien Lecharpentier added a comment - rpionke at this moment, I trully believe that getting ride on this dependency is the better solution. You could still be using another converter.

          Raphael Pionke added a comment - - edited

          alecharp i created a new branch and added the needed classes, but with no luck. the unit tests are passing but my test instance displays the same error: 

          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindSearching jaxb.properties
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindChecking system property javax.xml.bind.JAXBContextFactory
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bind  not found
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindChecking system property javax.xml.bind.context.factory
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bind  not found
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindChecking system property javax.xml.bind.JAXBContext
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bind  not found
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindSearching META-INF/services
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindUnable to load:META-INF/services/javax.xml.bind.JAXBContext
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindTrying to create the platform default provider
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindUnable to find from OSGi: [javax.xml.bind.JAXBContext]
          java.lang.ClassNotFoundException: org.glassfish.hk2.osgiresourcelocator.ServiceLoader
          	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1373)
          	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
          	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
          	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          	at java.base/java.lang.Class.forName0(Native Method)
          	at java.base/java.lang.Class.forName(Class.java:315)
          	at javax.xml.bind.ServiceLoaderUtil.lookupUsingOSGiServiceLoader(ServiceLoaderUtil.java:86)
          	at javax.xml.bind.ContextFinder.find(ContextFinder.java:413)
          	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
          	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
          	at jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:85)
          	at jaxb.JaxbConverterFactory.responseBodyConverter(JaxbConverterFactory.java:78)
          	at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:328)
          	at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:311)
          	at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:68)
          	at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:46)
          	at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:36)
          	at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:168)
          	at retrofit2.Retrofit$1.invoke(Retrofit.java:147)
          	at com.sun.proxy.$Proxy110.getServerLicense(Unknown Source)
          	at de.tsystems.mms.apm.performancesignature.dynatrace.rest.DTServerConnection.getServerLicense(DTServerConnection.java:255)
          	at de.tsystems.mms.apm.performancesignature.dynatrace.PerfSigStartRecording.perform(PerfSigStartRecording.java:83)
          	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
          	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
          	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          	at java.base/java.lang.Thread.run(Thread.java:834)
          
          Apr 23, 2019 12:37:33 PM FINE javax.xml.bindTrying to create the platform default provider

          Here is the diff: https://github.com/jenkinsci/performance-signature-dynatrace-plugin/compare/master...jaxb-converter

          Raphael Pionke added a comment - - edited alecharp i created a new branch and added the needed classes, but with no luck. the unit tests are passing but my test instance displays the same error:  Apr 23, 2019 12:37:33 PM FINE javax.xml.bindSearching jaxb.properties Apr 23, 2019 12:37:33 PM FINE javax.xml.bindChecking system property javax.xml.bind.JAXBContextFactory Apr 23, 2019 12:37:33 PM FINE javax.xml.bind not found Apr 23, 2019 12:37:33 PM FINE javax.xml.bindChecking system property javax.xml.bind.context.factory Apr 23, 2019 12:37:33 PM FINE javax.xml.bind not found Apr 23, 2019 12:37:33 PM FINE javax.xml.bindChecking system property javax.xml.bind.JAXBContext Apr 23, 2019 12:37:33 PM FINE javax.xml.bind not found Apr 23, 2019 12:37:33 PM FINE javax.xml.bindSearching META-INF/services Apr 23, 2019 12:37:33 PM FINE javax.xml.bindUnable to load:META-INF/services/javax.xml.bind.JAXBContext Apr 23, 2019 12:37:33 PM FINE javax.xml.bindTrying to create the platform default provider Apr 23, 2019 12:37:33 PM FINE javax.xml.bindUnable to find from OSGi: [javax.xml.bind.JAXBContext] java.lang.ClassNotFoundException: org.glassfish.hk2.osgiresourcelocator.ServiceLoader at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1373) at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326) at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:315) at javax.xml.bind.ServiceLoaderUtil.lookupUsingOSGiServiceLoader(ServiceLoaderUtil.java:86) at javax.xml.bind.ContextFinder.find(ContextFinder.java:413) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662) at jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:85) at jaxb.JaxbConverterFactory.responseBodyConverter(JaxbConverterFactory.java:78) at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:328) at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:311) at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:68) at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:46) at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:36) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:168) at retrofit2.Retrofit$1.invoke(Retrofit.java:147) at com.sun.proxy.$Proxy110.getServerLicense(Unknown Source) at de.tsystems.mms.apm.performancesignature.dynatrace.rest.DTServerConnection.getServerLicense(DTServerConnection.java:255) at de.tsystems.mms.apm.performancesignature.dynatrace.PerfSigStartRecording.perform(PerfSigStartRecording.java:83) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Apr 23, 2019 12:37:33 PM FINE javax.xml.bindTrying to create the platform default provider Here is the diff: https://github.com/jenkinsci/performance-signature-dynatrace-plugin/compare/master...jaxb-converter

          Raphael Pionke added a comment - PR with a proper fix: https://github.com/jenkinsci/performance-signature-dynatrace-plugin/pull/81

          released as 3.1.5

          Raphael Pionke added a comment - released as 3.1.5

            rpionke Raphael Pionke
            rpionke Raphael Pionke
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: