Description
(Credit to David Smiley for bringing this up and for the repro steps.)
In certain circumstances, Jersey application initialization runs into a NoClassDefFoundError, usually for the "javax.activation.DataSource" class.
From the stacktrace (see below) what appears to be happening is that Jersey uses this class somehow in looking for custom "MessageBodyWriter" and "MessageBodyReader" implementations. (MBR and MBW are two interfaces that Jersey provides to allow serialization/deserialization of request and response bodies, respectively.) Somewhere in this process, Jersey runs into the NoClassDefFoundError.
It's unclear why this stacktrace only occurs with the 'extraction' jars on the classpath. And it's surprising that it occurs at all - classpath scanning and plugin "auto-detection" should be disabled in our Jersey apps via the "jersey.config.server.disableAutoDiscovery" and "jersey.config.server.disableMetainfServicesLookup" properties that are set on all apps.
AFAICT, the warning and stacktrace is largely just noise. Jersey fails to register whatever custom component we're picking up in the "extraction" jars, but since we're not trying to register any components from those in the first place, this isn't really a problem.
But it's still worth understanding better why this occurs and at the least suppressing the stack trace to avoid distracting users.
It can be reproduced trivially with the docker command: "docker run --rm -p 8983:8983 -e SOLR_MODULES=extraction solr:9.4 solr-demo"
The stacktrace/warning in the logs can be seen below:
2023-11-29 15:03:58.172 WARN (coreLoadExecutor-11-thread-1) [ x:demo] o.g.j.i.Errors 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(Unknown Source) at java.base/java.lang.Class.getDeclaredConstructors(Unknown Source) at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1354) at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1350) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1350) at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1293) at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:60) at org.glassfish.jersey.inject.hk2.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:124) at org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:156) at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:105) at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:156) at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:716) at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:670) at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:442) at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2300) at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:106) at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1385) at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1380) at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:105) at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1442) at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1368) at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1356) at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:135) at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:30) at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:307) at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:151) at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:219) at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:114) at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$2(ApplicationHandler.java:353) at java.base/java.util.Arrays$ArrayList.forEach(Unknown Source) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:353) at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:292) at org.glassfish.jersey.internal.Errors.process(Errors.java:274) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:232) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:296) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:261) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:236) at org.apache.solr.core.SolrCore.lambda$new$2(SolrCore.java:1158) at org.apache.solr.jersey.JerseyAppHandlerCache.lambda$computeIfAbsent$0(JerseyAppHandlerCache.java:53) at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2688) at java.base/java.util.concurrent.ConcurrentHashMap.compute(Unknown Source) at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2686) at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2669) at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112) at com.github.benmanes.caffeine.cache.LocalManualCache.get(LocalManualCache.java:62) at org.apache.solr.jersey.JerseyAppHandlerCache.computeIfAbsent(JerseyAppHandlerCache.java:53) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1151) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1056) at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1705) at org.apache.solr.core.CoreContainer.lambda$loadInternal$12(CoreContainer.java:1043) at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:234) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:294) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource at java.base/java.net.URLClassLoader.findClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:460) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ... 59 more Suppressed: java.lang.ClassNotFoundException: javax.activation.DataSource at java.base/java.net.URLClassLoader.findClass(Unknown Source) at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:581) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:484) ... 60 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.MessageBodyWriter,javax.ws.rs.ext.MessageBodyReader} scope=javax.inject.Singleton qualifiers={} descriptorType=CLASS descriptorVisibility=NORMAL metadata= rank=0 loader=null proxiable=null proxyForSameScope=null analysisName=null id=91 locatorId=1 identityHashCode=1840961605 reified=false) at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:681) at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:442) at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2300) at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:106) at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1385) at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1380) at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:105) at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1442) at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1368) at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1356) at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:135) at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:30) at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:307) at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:151) at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:219) at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:114) at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$2(ApplicationHandler.java:353) at java.base/java.util.Arrays$ArrayList.forEach(Unknown Source) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:353) at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:292) at org.glassfish.jersey.internal.Errors.process(Errors.java:274) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:232) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:296) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:261) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:236) at org.apache.solr.core.SolrCore.lambda$new$2(SolrCore.java:1158) at org.apache.solr.jersey.JerseyAppHandlerCache.lambda$computeIfAbsent$0(JerseyAppHandlerCache.java:53) at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2688) at java.base/java.util.concurrent.ConcurrentHashMap.compute(Unknown Source) at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2686) at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2669) at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112) at com.github.benmanes.caffeine.cache.LocalManualCache.get(LocalManualCache.java:62) at org.apache.solr.jersey.JerseyAppHandlerCache.computeIfAbsent(JerseyAppHandlerCache.java:53) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1151) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1056) at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1705) at org.apache.solr.core.CoreContainer.lambda$loadInternal$12(CoreCon...
Attachments
Issue Links
- links to