Closed rambangaru closed 4 months ago
What specific issues are you running into with '20231029'?
I have to admit I have not tried the latest versions of Java yet, but that version upgraded the build process to Java 11 and includes its own JavaScript engine. These were the 2 issues I was aware of preventing usage on recent Java versions. So please make specific what still needs to happen.
I'm no facing any specific issue; however, my company would prefer to stay on modern frameworks and tools. It is not blocking me today but may be in few years, so I was curious to know the plan.
One issue I am currently facing is this error when launching with java 21.
"Test system terminated with exception [fitnesse.testsystems.TestExecutionException: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release]"
This error is present when trying to launch with java 18+.
Before that, with java 17 for example, it was only a warning: "WARNING: System::setSecurityManager will be removed in a future release"
Here is a link to a SO question: https://stackoverflow.com/questions/76394319/which-java-version-does-fitnesse-slim-works-with
This error comes from the fact that The Security Manager has been depecreated from java17, it was raising a warning in java 17. But starting from java18, an exception is being raised even though the class is still present.
A solution to this is to add -Djava.security.manager=allow
to your java command that starts the tests.
One issue I am currently facing is this error when launching with java 21. "Test system terminated with exception [fitnesse.testsystems.TestExecutionException: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release]" This error is present when trying to launch with java 18+. Before that, with java 17 for example, it was only a warning: "WARNING: System::setSecurityManager will be removed in a future release" Here is a link to a SO question: https://stackoverflow.com/questions/76394319/which-java-version-does-fitnesse-slim-works-with This error comes from the fact that The Security Manager has been depecreated from java17, it was raising a warning in java 17. But starting from java18, an exception is being raised even though the class is still present. A solution to this is to add
-Djava.security.manager=allow
to your java command that starts the tests.
We are facing the same issue and are thinking about migrating to another framework rather than forcing deprecated method calls via command line argument.
Technically it is no big change to remove the usage of the security manager, I believe.
As far as I'm aware it is only used to prevent Java code invoked in tests (in the System Under Test) to be able to kill the whole test process by doing a System.exit()
.
Some users may however be relying on this feature, so it would be good if this could be kept (possibly as an opt-in, plugin, thing they could add to their configuration).
Other than that I would be open to merge a PR removing the usage of the security manager. @MaikHerrmann @Voyinno @rambangaru does one of you have some time to look at creating such a PR?
I started https://stackoverflow.com/questions/76394319/which-java-version-does-fitnesse-slim-works-with. Now I have to find a solution to it.
For the latest version of fitnesse, I have started an issue https://github.com/unclebob/fitnesse/issues/1509: The latest fitnesse jar cannot start in the latest java.
!define TEST_SYSTEM {slim} !path fitnesse-standalone.jar !path C:\Users\Cheng\OneDrive\Documents\Proj\VarianceArithemtic\Java\bin\fitnesse
// Source code is decompiled from a .class file using FernFlower decompiler. package fitnesse;
class SlimVarDbl { public String comment;
Could not invoke constructor for SlimVarDbl[0]
Test page: | Fitnesse.VarianceArithmetic.VarDblInitiation -- | -- java -cp fitnesse-standalone.jar;C:\Users\Cheng\OneDrive\Documents\Proj\VarianceArithemtic\Java\bin\fitnesse;lib/*.jar;C:\Users\Cheng\OneDrive\Documents\Proj\VarianceArithemtic\Fitnesse\fitnesse-standalone.jar fitnesse.slim.SlimService 1====
What could be wrong?
I think you also have to add -Djava.security.manager=allow
to this command
java -cp fitnesse-standalone.jar;C:\Users\Cheng\OneDrive\Documents\Proj\VarianceArithemtic\Java\bin\fitnesse;lib/*.jar;C:\Users\Cheng\OneDrive\Documents\Proj\VarianceArithemtic\Fitnesse\fitnesse-standalone.jar fitnesse.slim.SlimService 1
To do that, just add the following line !define COMMAND_PATTERN {java -Djava.security.manager=allow -cp %p %m}
to your file which contains !path fitnesse-standalone.jar
Hi, I had the same issue trying to upgrade to jdk21; there is also a System property inside fitnesse to disable the feature the trap System.exit()
calls using -Dprevent.system.exit=false
or @FitNesseRunner.PreventSystemExit(false)
when using the FitnesseRunner
I prefer this workaround as I do not call System.exit in my tests.
I also checked on the JDK side but there is apparently no other way to ignore exit calls in recent JDKs (https://bugs.openjdk.org/browse/JDK-8199704)
Until there is a proper way to fix this, I think we could catch the UnsupportedOperationException
exception thrown when System.setSecurityManager
is called in SystemExitSecurityManager and show an error message explaining how to fix this with -Djava.security.manager or disabling it with -Dprevent.system.exit
Something similar is already done if a SecurityException
(an error is logged but the tests keep on running)
Have you looked at possible resources for answers?
Please check one of the following resources for help. In particular, questions asked on stack overflow.com will get a lot more viewership than an issue here.
If your answer isn't out there, please describe your question
General Description
It would be nice to have fitnesse supports latest version of Java.
What have you tried?