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

WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.DataSourceProvider] when building with JDK 9 #90

Closed
zivannikolic opened this issue Nov 1, 2017 · 15 comments
Labels

Comments

@zivannikolic
Copy link

When Building docker container with JDK 9, following appears multiple times in the trace. The build succeeds, but the log trace is cluttered and confusing (to me).

[INFO]
[INFO] --- dockerfile-maven-plugin:1.3.6:build (default) @ cloud-dr-dashboard ---
[INFO] Building Docker context /Users/s44259/work/workspace/cloud-dashboard
[INFO]
[INFO] Image will be built as swrepos.auiag.corp/appmon/cloud-dr-dashboard:1.0.1-SNAPSHOT
[INFO]
Nov. 01, 2017 12:39:26 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:3110)
at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2314)
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.(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:1167)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 63 more
MultiException stack 2 of 2
java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
implementation=org.glassfish.jersey.message.internal.DataSourceProvider
contracts={com.spotify.docker.client.shaded.javax.ws.rs.ext.MessageBodyReader,com.spotify.docker.client.shaded.javax.ws.rs.ext.MessageBodyWriter}
scope=com.spotify.docker.client.shaded.javax.inject.Singleton
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=
rank=0
loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@283008df
proxiable=null
proxyForSameScope=null
analysisName=null
id=12
locatorId=1
identityHashCode=277067129
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.(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:1167)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.base/java.lang.Thread.run(Thread.java:844)

@jan-z
Copy link

jan-z commented Nov 19, 2017

You can work around these warnings by adding a dependency to your plugin definition:

            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
[...]
                <dependencies>
                    <dependency>
                        <groupId>javax.activation</groupId>
                        <artifactId>activation</artifactId>
                        <version>1.1.1</version>
                    </dependency>
                </dependencies>
            </plugin>

@zivannikolic
Copy link
Author

zivannikolic commented Nov 19, 2017 via email

njbartlett added a commit to njbartlett/maven-archetypes that referenced this issue Jan 29, 2018
Cleans up spurious build errors on Java 9.
See spotify/dockerfile-maven#90
@udalrich
Copy link

udalrich commented May 3, 2018

Has this been released? I am running with 1.4.0, which was added to the maven repository on Feb 28, 2018, and seeing the same error.

@demaniak
Copy link

demaniak commented Jun 1, 2018

Running 1.4.2 - same error.

@stephen84s
Copy link

Getting the same error for 1.4.3 as well

@nicojs
Copy link

nicojs commented Jul 17, 2018

@jan-z

You can work around these warnings by adding a dependency to your plugin definition:

Can you explain to us why this workaround is needed. Are there plans to fix this out-of-the box?

@jan-z
Copy link

jan-z commented Jul 17, 2018

@nicojs The java.activation module (JavaBeans Activation Framework) is not resolved by default in JDK9 (https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-F640FA9D-FB66-4D85-AD2B-D931174C09A3).

The framework itself is deprecated and will be removed in the future from the JDK: https://docs.oracle.com/javase/9/docs/api/java.activation-summary.html

I guess the solution would be to add the JAF-dependency in the plugin pom.

@sverhagen
Copy link

As suggested here, this can be circumvented by adding the following plugin dependency:

<plugin>
  <artifactId>dockerfile-maven-plugin</artifactId>
...
  <dependencies>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>1.1.1</version>
    </dependency>
  </dependencies>
...
</plugin>

@stale
Copy link

stale bot commented Oct 29, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 29, 2018
@stale stale bot closed this as completed Nov 5, 2018
@Alos
Copy link

Alos commented Nov 28, 2018

I have the same issue running on Java 11

@Zanndorin
Copy link

@Alos Seems like Google still outputs this as the top result. Have you tried with the latest version? Had this issue today as well but the update to 1.4.9 (from 1.4.6 i think) fixed it. Else the workaround with the dependency also works for me.

  <dependencies>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>1.1.1</version>
    </dependency>
  </dependencies>

@Alos
Copy link

Alos commented Nov 28, 2018

@Zanndorin I'm already using 1.4.9 and it did not have the fix. I added the missing dependency as suggested and it worked. Thanks! :)

@manuelAlonsoPerez
Copy link

manuelAlonsoPerez commented May 10, 2019

Same issue using 1.4.10 on java 12. Adding the javax.activation dependency didn't fix it.
But the following dependency did it:

<dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency>

jdbonior21 pushed a commit to jdbonior21/TASQC that referenced this issue May 29, 2019
javax.activation was removed from JDK. Added it back as a dependency.
Similar problem encountered here: spotify/dockerfile-maven#90
@arellano-gustavo
Copy link

@manuelAlonsoPerez your solution worked for me. Thanks !!!

@cepcat
Copy link

cepcat commented Sep 11, 2021

在 java 12 上使用 1.4.10 的相同问题。添加 javax.activation 依赖项并没有解决它。
但以下依赖做到了:

<dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency>

This solution solved my problem, thank you very much, by the way, format the code

         <dependencies>
             <dependency>
                 <groupId>javax.xml.bind</groupId>
                 <artifactId>jaxb-api</artifactId>
                 <version>2.3.1</version>
             </dependency>
         </dependencies>

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

No branches or pull requests