java.lang.NoSuchFieldException: ucp error while running with JetBrainsRuntime 17
Closed this issue · 9 comments
I am running hotswap agent with jbr sdk 17 but getting below exception while adding extraClasspath in hotswap-agent.properties.
Currently I am using latest snapshot release of hotswap-agent.
Same thing is working in trava jdk 11.
HOTSWAP AGENT: 19:17:45.107 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {unkown} - unlimited runtime class redefinition.
HOTSWAP AGENT: 19:17:45.414 ERROR (org.hotswap.agent.util.classloader.URLClassPathHelper) - Unable to add extraClassPath URLs [file:/Users/pankajkumar/.bazel_runner/output_base/execroot/harness_monorepo/bazel-out/k8-fastbuild/bin/120-ng-manager/module.runfiles/harness_monorepo/] to classLoader jdk.internal.loader.ClassLoaders$AppClassLoader@5bc2b487
java.lang.NoSuchFieldException: ucp
at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
at org.hotswap.agent.util.classloader.URLClassPathHelper.getUcpField(URLClassPathHelper.java:195)
at org.hotswap.agent.util.classloader.URLClassPathHelper.prependClassPath(URLClassPathHelper.java:84)
at org.hotswap.agent.config.PluginConfiguration.initExtraClassPath(PluginConfiguration.java:221)
at org.hotswap.agent.config.PluginConfiguration.init(PluginConfiguration.java:193)
at org.hotswap.agent.config.PluginConfiguration.<init>(PluginConfiguration.java:89)
at org.hotswap.agent.config.PluginConfiguration.<init>(PluginConfiguration.java:80)
at org.hotswap.agent.config.PluginConfiguration.<init>(PluginConfiguration.java:76)
at org.hotswap.agent.config.PluginManager.init(PluginManager.java:129)
at org.hotswap.agent.HotswapAgent.premain(HotswapAgent.java:69)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
I have already added these 2 lines in my jvm options
--add-opens java.base/jdk.internal.loader=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
Could you try last SNAPSHOT? It should be fixed now.
That is resolved but now I am getting different issue and application is crashing after this:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Library/Java/JavaVirtualMachines/jbrsdk-17.0.11-osx-aarch64-b1312.2/Contents/Home/lib/libmanagement.dylib: dlopen(/Library/Java/JavaVirtualMachines/jbrsdk-17.0.11-osx-aarch64-b1312.2/Contents/Home/lib/libmanagement.dylib, 0x0001): tried: '/Library/Java/JavaVirtualMachines/jbrsdk-17.0.11-osx-aarch64-b1312.2/Contents/Home/lib/libmanagement.dylib' (open() failed with errno=24), '/System/Volumes/Preboot/Cryptexes/OS/Library/Java/JavaVirtualMachines/jbrsdk-17.0.11-osx-aarch64-b1312.2/Contents/Home/lib/libmanagement.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jbrsdk-17.0.11-osx-aarch64-b1312.2/Contents/Home/lib/libmanagement.dylib' (open() failed with errno=24)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:315)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:285)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2403)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1993)
at java.management/java.lang.management.ManagementFactory.lambda$static$8(ManagementFactory.java:1016)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.management/java.lang.management.ManagementFactory.<clinit>(ManagementFactory.java:1015)
at com.codahale.metrics.jvm.JvmAttributeGaugeSet.<init>(JvmAttributeGaugeSet.java:24)
at io.dropwizard.setup.Bootstrap.registerMetrics(Bootstrap.java:84)
at io.dropwizard.Application.run(Application.java:90)
at io.harness.ng.modules.NextGenApplication.main(NextGenApplication.java:373)
It seems like problem in your OS configuration - too much open files
I have already tried adding this in my .zprofile and .bash_profile file
ulimit -n unlimited
It is happening only when I use hotswap agent. And add extraclasspath. But it is happening with JetBrainsRuntime 17 only,
not with trava jdk 11.
The issue was resolved by using these commands
launchctl limit maxfiles 100000 unlimited
ulimit -n 100000
And this jvm option:
-XX:-MaxFDLimit
Hotswapping didn't work though with JetBrainsRuntime 17.
@skybber is autoHotswapping even possible with JetBrainsRuntime 17 without using intellij degugger, using autoHotswap=true?
Yes, it is working.
With bazel also?
I have no experience with bazel :)