Upgrade to Open API3 - org.glassfish.hk2.api.ProxyCtl referenced from a method is not visible
I am new to this community. I am currently working on a project to upgrade from Java 8 to Java 17. Along with Java, I am also upgrading other libraries like Dropwizard, Hibernate, and Swagger. I am using https://github.com/smoketurner/dropwizard-swagger for the Swagger-Dropwizard integration. I updated all the RESP API and DTO annotations, but when I try to start the service, I am getting below runtime error. Has anyone tried upgrading Swagger-Dropwizard integration? Any suggestions or pointer on the following issue are appreciated. Thanks
WARN [2023-03-28 19:25:35,282] org.eclipse.jetty.server.handler.ContextHandler.ROOT: unavailable
! java.lang.IllegalArgumentException: org.glassfish.hk2.api.ProxyCtl referenced from a method is not visible from class loader
! at java.base/java.lang.reflect.Proxy$ProxyBuilder.ensureVisible(Proxy.java:883)
! at java.base/java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Proxy.java:721)
! at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:648)
! at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Proxy.java:440)
! at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
! at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
! at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:438)
! at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1037)
! at org.jvnet.hk2.internal.ProxyUtilities$3.run(ProxyUtilities.java:120)
! at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
! at org.jvnet.hk2.internal.ProxyUtilities.secureCreate(ProxyUtilities.java:115)
! at org.jvnet.hk2.internal.ProxyUtilities.generateProxy(ProxyUtilities.java:194)
! ... 76 common frames omitted
! Causing: org.glassfish.hk2.api.MultiException: A MultiException has 2 exceptions. They are:
! 1. java.lang.IllegalArgumentException: org.glassfish.hk2.api.ProxyCtl referenced from a method is not visible from class loader
! 2. java.lang.IllegalArgumentException: While attempting to create a Proxy for javax.ws.rs.core.HttpHeaders in scope org.glassfish.jersey.process.internal.RequestScoped an error occured while creating the proxy
!
! at org.jvnet.hk2.internal.ProxyUtilities.generateProxy(ProxyUtilities.java:211)
! at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2074)
! at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
! at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
! at org.glassfish.jersey.inject.hk2.ContextInjectionResolverImpl.resolve(ContextInjectionResolverImpl.java:103)
! at org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:988)
! at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:998)
! at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:976)
! at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.inject(AbstractHk2InjectionManager.java:207)
! at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.inject(ImmediateHk2InjectionManager.java:30)
! at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:427)
! 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.servlet.WebComponent.<init>(WebComponent.java:311)
! at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:154)
! at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:339)
! at javax.servlet.GenericServlet.init(GenericServlet.java:203)
! at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:632)
! at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:415)
! at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:750)
! at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
! at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
! at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
! at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
! at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
! at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
! at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:774)
! at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)
! at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)
! at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
! at com.codahale.metrics.jetty9.InstrumentedHandler.doStart(InstrumentedHandler.java:138)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
! at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:426)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
! at org.eclipse.jetty.server.handler.StatisticsHandler.doStart(StatisticsHandler.java:264)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
! at org.eclipse.jetty.server.Server.start(Server.java:423)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
! at org.eclipse.jetty.server.Server.doStart(Server.java:387)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:52)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:68)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
! at io.dropwizard.cli.Cli.run(Cli.java:78)
! at io.dropwizard.Application.run(Application.java:94)