enexusde / vboxjws

Clone of vboxjws plus documentation.
1 stars 0 forks source link

jdk.internal.org.objectweb.asm.MethodTooLargeException: Method too large: jdk/proxy2/$Proxy36.<clinit> ()V #5

Open UncleLiuYe opened 1 month ago

UncleLiuYe commented 1 month ago

I'm having problems running Code Examples using jdk21: Exception in thread "Thread-0" jdk.internal.org.objectweb.asm.MethodTooLargeException: Method too large: jdk/proxy2/$Proxy36. ()V at java.base/jdk.internal.org.objectweb.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2120) at java.base/jdk.internal.org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:543) at java.base/java.lang.reflect.ProxyGenerator.generateClassFile(ProxyGenerator.java:506) at java.base/java.lang.reflect.ProxyGenerator.generateProxyClass(ProxyGenerator.java:178) at java.base/java.lang.reflect.Proxy$ProxyBuilder.defineProxyClass(Proxy.java:544) at java.base/java.lang.reflect.Proxy$ProxyBuilder.build(Proxy.java:657) 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:1034) at com.sun.xml.ws.client.WSServiceDelegate$3.run(WSServiceDelegate.java:709) at java.base/java.security.AccessController.doPrivileged(AccessController.java:319) at com.sun.xml.ws.client.WSServiceDelegate.createProxy(WSServiceDelegate.java:705) at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:783) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:423) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:391) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:373) at javax.xml.ws.Service.getPort(Service.java:139) at org.virtualbox_7_0.jaxws.VboxService.getVboxServicePort(VboxService.java:56) at org.virtualbox_7_0.PortPool.getPort(VirtualBoxManager.java:151) at org.virtualbox_7_0.PortPool.preinit(VirtualBoxManager.java:120) at org.virtualbox_7_0.PortPool.access$200(VirtualBoxManager.java:73) at org.virtualbox_7_0.PortPool$1.run(VirtualBoxManager.java:97) at java.base/java.lang.Thread.run(Thread.java:1583)

Is there a solution?

enexusde commented 1 month ago

Hello UncleLiuYe,

this is a known problem. As you might have noticed, the vboxjws sourcecode have two parts.

  1. The generated SOAP interface.
  2. The Regelwerk overlay written by hand.

The generated SOAP interface have an overlord-interface having more that 1200 methods. This interface is about to be proxied in the stacktrace-element at com.sun.xml.ws.client.WSServiceDelegate$3.run(WSServiceDelegate.java:709).

A interface of this size can not be proxied in certain JVMs without breaking the bytecodesize limitations.

There is no solution for every JVM and I think there never will be a solution since the bytecodesize limitation is written in stone.

What you can do is:

  1. Create your very own vboxjws API based on the original sources,
  2. reduce the original Service-WSDL to your requirements.
  3. regenerate the SOAP interfaces.
  4. Reduce the Regelwerk along the reduced WSDL until the project compiles.

I think this repository will be dead, soon but I will create (or splice) reduced jboxjws library(s).

Kind Regards