Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

build on jdk10, fix java 9+ incompatibilities #1068

Merged
merged 4 commits into from
Oct 4, 2018
Merged

Conversation

mattnworb
Copy link
Member

No description provided.

@mattnworb
Copy link
Member Author

I intended to update the Travis config to build on Java 10 and/or 11, but it looks like neither are available yet.

We should consider dropping some of the docker versions used in the build matrix, as building with several additional JDKs just multiples the number of builds to 15 now - Docker 1.12.6 was released on 2017-01-10 for instance.

@caipre
Copy link
Contributor

caipre commented Sep 8, 2018

Looks like jdk10 is supported via install-jdk.sh: https://docs.travis-ci.com/user/languages/java/#using-java-10-and-later

@codecov-io
Copy link

codecov-io commented Sep 10, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@66a1de3). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master    #1068   +/-   ##
=========================================
  Coverage          ?   70.14%           
  Complexity        ?      786           
=========================================
  Files             ?      177           
  Lines             ?     3762           
  Branches          ?      390           
=========================================
  Hits              ?     2639           
  Misses            ?      959           
  Partials          ?      164

@mattnworb
Copy link
Member Author

Looks like I misread the docs, openjdk10 seems to be supported.

davidxia added a commit that referenced this pull request Oct 2, 2018
This library was originally using Java 7. Java 7 had `Date` objects
with only millisecond resolution.

This was a problem when translating timestamps with nanosecond
precision from the Docker API to `Date`.

This library is on Java 8 now which supports nanosecond resolution.

This PR fixes the findbugs error here #1068.
See build logs https://travis-ci.org/spotify/docker-client/jobs/426781589.
davidxia added a commit that referenced this pull request Oct 2, 2018
This library was originally using Java 7. Java 7 had `Date` objects
with only millisecond precision.

This was a problem when translating timestamps with nanosecond
precision from the Docker API to `Date`.

This library is on Java 8 now whose `Date` translates a timestamp with
nanosecond precision correctly.

Removing `DockerDateFormat` fixes the findbugs error here
#1068.
See build logs https://travis-ci.org/spotify/docker-client/jobs/426781589.
@mattnworb mattnworb force-pushed the modern-jdks branch 2 times, most recently from 0174b1a to d713e54 Compare October 3, 2018 19:03
@mattnworb mattnworb changed the title build on jdk8, jdk9 build on jdk10 Oct 3, 2018
@mattnworb
Copy link
Member Author

re-did this PR to just add openjdk10 and skip 9 - doesn't seem to be much point in testing on both 9 and 10.

@mattnworb
Copy link
Member Author

Seems like the only real issue with Java 9 (fixed in a commit above) is that Jersey classes throw an Exception when loaded - Java 9 removes the javax.activation package from Java SE

Running com.spotify.docker.client.ConnectionPoolTest
Oct 03, 2018 3:10:58 PM org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.DataSourceProvider] with an exception:
MultiException stack 1 of 2
java.lang.NoClassDefFoundError: javax/activation/DataSource
        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3090)
        at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2316)
        at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1310)
        at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1306)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1306)
        at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1249)
        at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:83)
        at org.glassfish.jersey.internal.inject.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:144)
        at org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:178)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:128)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:179)
        at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:723)
        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:678)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:458)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2205)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:122)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1350)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1345)
        at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:116)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1407)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1332)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1321)
        at org.glassfish.jersey.internal.inject.Providers.getServiceHandles(Providers.java:354)
        at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:201)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:221)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1350)
        at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:271)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:365)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
        at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
        at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:765)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getUnqualifiedService(ServiceLocatorImpl.java:772)
        at org.jvnet.hk2.internal.IterableProviderImpl.get(IterableProviderImpl.java:111)
        at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:97)
        at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:67)
        at org.glassfish.jersey.process.internal.Stages$LinkedStage.apply(Stages.java:308)
        at org.glassfish.jersey.process.internal.Stages.process(Stages.java:171)
        at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:158)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340)
        at org.glassfish.jersey.client.ClientRuntime$3.run(ClientRuntime.java:210)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 63 more
MultiException stack 2 of 2
java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
        implementation=org.glassfish.jersey.message.internal.DataSourceProvider
        contracts={javax.ws.rs.ext.MessageBodyReader,javax.ws.rs.ext.MessageBodyWriter}
        scope=javax.inject.Singleton
        qualifiers={}
        descriptorType=CLASS
        descriptorVisibility=NORMAL
        metadata=
        rank=0
        loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@6b4936e2
        proxiable=null
        proxyForSameScope=null
        analysisName=null
        id=12
        locatorId=4
        identityHashCode=1366398858
        reified=false)
        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:689)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:458)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2205)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:122)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1350)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1345)
        at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:116)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1407)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1332)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1321)
        at org.glassfish.jersey.internal.inject.Providers.getServiceHandles(Providers.java:354)
        at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:201)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:221)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1350)
        at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:271)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:365)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
        at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
        at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:765)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getUnqualifiedService(ServiceLocatorImpl.java:772)
        at org.jvnet.hk2.internal.IterableProviderImpl.get(IterableProviderImpl.java:111)
        at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:97)
        at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:67)
        at org.glassfish.jersey.process.internal.Stages$LinkedStage.apply(Stages.java:308)
        at org.glassfish.jersey.process.internal.Stages.process(Stages.java:171)
        at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:158)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340)
        at org.glassfish.jersey.client.ClientRuntime$3.run(ClientRuntime.java:210)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:844)

@mattnworb mattnworb mentioned this pull request Oct 4, 2018
@mattnworb
Copy link
Member Author

the failing test is for a single build in the test matrix with a known-flaky test. Otherwise I think this change will unblock some other projects from addressing Java 9 compatibility problems.

@mattnworb
Copy link
Member Author

after re-running some flaky tests 10x, the build is green ✅

@mattnworb mattnworb merged commit db79534 into master Oct 4, 2018
@mattnworb mattnworb deleted the modern-jdks branch October 4, 2018 11:01
@renannprado
Copy link

renannprado commented Nov 20, 2018

same problem as @mattnworb with Java 11 (tried with shaded jar as well)

openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

@mattnworb
Copy link
Member Author

@renannprado have you tried version 8.14.0 of the library? https://github.com/spotify/docker-client/blob/master/CHANGELOG.md#8140

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants