0

I worked with fitnesse a long time ago, and I am trying to use it again on Windows 11 to test some java code. But I have encountered the following problems:

I have create a fixture called SlimVarDbl, and I can see the SlimVarDbl.class file in the folder C:\Users\Cheng\Documents\Proj\VarianceArithemtic\Java\bin\fitnesse. I am sure that I can call new SlimVarDbl() to construct an instance.

So I created a test page as the following:

!define TEST_SYSTEM {slim} 
!path C:\Users\Cheng\Documents\Proj\VarianceArithemtic\Java\bin\fitnesse\

!|Slim Var Dbl                        |
|value tolerance|dev tolerance|comment|
|3E-15          |3E-15        |52-bit |

But when I try to run the test, the error is:

Could not invoke constructor for SlimVarDbl[0]

As if the fitnesse cannot recognize the class file.

The version for fitnesse-standalone.jar is v20230503. My current java version is 1.8.0_361.

If I upgrade my java version to jdk 20, I got the following error when trying to test the page:

Test system terminated with exception [fitnesse.testsystems.TestExecutionException: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release]

Is this a java version issue or something else?

CPW
  • 175
  • 8

2 Answers2

0

Is this a java version issue or something else?

Yes & No. The problem that occurred when you tried to use JDK 20 is the Java version. The original problem when you were using Java 8 is ... something else.

The version of Fitnesse that you are using depends on the deprecated SecurityManager functionality. From Java 18 onwards, an application can only use the functionality if it is run with special command-line options; see JEP 411: Deprecate the Security Manager for Removal.

If you want to run that version of Fitnesse, it is advisable to use an earlier version of Java. In fact, the Fitnesse download page (currently) says:

FitNesse requires the Java Runtime Environment (JRE) version 8 or 11.

However, according to this issue, Fitnesse seems to work on Java 17 (LTS) albeit with some log messages about security manager deprecation. Fitnesse doesn't actually "break" until Java 18.\


In general, unless you need the features of a non-LTS version of Java. It is advisable to stick with the LTS Java releases. The non-LTS Java releases go end-of-life 6 months after they are released! (Newest is not always best.) The current LTS releases of Java are 8, 11 and 17. Java 21 (due later this year) is also expected to be an LTS release.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

The error Could not invoke constructor for SlimVarDbl[0] is often caused by the fact the Java class is part of a package. If the Java class has a package definition you need to define an import table in FitNesse to indicate fixture classes can come from that package, and the .class file must be placed in a directory structure below the 'path', matching the package.

Can you share the (start of) the source class of SlimVarDbl?

Fried Hoeben
  • 3,247
  • 16
  • 14