ikvm icon indicating copy to clipboard operation
ikvm copied to clipboard

There are some problems when running WAS (Tomcat).

Open kdaek21 opened this issue 1 year ago • 4 comments

Thank you for creating a JVM that runs on .NET.

When I tried to run WAS (Web Application Server) on IKVM and set Tomcat to run on IKVM, it crashed with a StackOverflowException. So I tested it by removing the option parts created in the batch file used when running Tomcat one by one, and confirmed that it crashed with the exception when the '-Djava.protocol.handler.pkgs=org.apache.catalina.webresources' option was entered. The comment for the option part is as follows.

rem Register custom URL handlers rem Do this here so custom URL handles (specifically 'war:...') can be used in the security policy

It seems that a class inside the 'org.apache.catalina.webresources' package inside Tomcat is doing some work and causing a StackOverflowException. In the net472 version, it only displays the message 'Process is terminated due to StackOverflowException.' and dies, but in the net8.0 version, it shows a detailed call stack, so you can check where the exception occurs. The original Java made in C or C++ does not cause this exception. Is there a possibility that this issue will be resolved in a future version?

Also, when the WAS (Tomcat) starts and the first connection is made, it takes a long time to compile the JSP. Is there a possibility that this issue will be resolved?

kdaek21 avatar Nov 01 '24 18:11 kdaek21

Going to need more information, such as the stack trace, etc.

wasabii avatar Nov 01 '24 18:11 wasabii

The net472 version only shows the message 'Process is terminated due to StackOverflowException.', so I attached the Stacktrace from running it on the net8.0 version.

IKVM-8.10.3-jre-net8.0-win-x64-Tomcat9-stackoverflow.txt

kdaek21 avatar Nov 02 '24 03:11 kdaek21

After some checking, I confirmed that the Stack Overflow exception occurs unconditionally when trying to use the java.protocol.handler.pkgs property in IKVM, not when running Tomcat.

In a standard JVM, a StackOverflowError exception is raised only when you try to use a URL object with an illegal value in java.protocol.handler.pkgs, as shown below.

스크린샷 2024-12-10 223417 스크린샷 2024-12-10 223443

Full text of the StackOverflowError exception raised in standard Java Error related to java.protocol.handler.pkgs property.txt

However, in IKVM, even if you put any value in the java.protocol.handler.pkgs property, it will throw a stack overflow exception before even executing the user code, as shown below.

  • Test in the screenshot below is a fictional class name that does not actually exist.

스크린샷 2024-12-10 224859

I think we need to check the part that uses the java.protocol.handler.pkgs property within the IKVM JVM.

I've run some tests and it appears that this isn't a problem with Tomcat, but rather a problem with itself. Should I close this issue and register a new one?

kdaek21 avatar Dec 10 '24 14:12 kdaek21

You can rename the issue if you want.

A reproducible test case would be nice as well.

wasabii avatar May 28 '25 02:05 wasabii