Can you try to set the following options and then rerun the TCK to see if it works?
--add-opens=java.base/
java.io=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED
--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED
--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
--add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED
See this example for running an EJB Lite test:
@Test
public void test() {
ExecTSTestCmd cmd = new ExecTSTestCmd();
System.getProperties().entrySet().stream().forEach(entry -> System.out.println(entry.getKey() + "=" + entry.getValue()));
List<String> arguments = new ArrayList<>();
arguments.addAll(getEnvOptions());
arguments.addAll(getJavaOptions());
arguments.addAll(getTestOptions());
PrintWriter log = new PrintWriter(new OutputStreamWriter(System.err));
PrintWriter ref = new PrintWriter(new OutputStreamWriter(System.out));
try {
Status status = cmd.run(arguments.toArray(String[]::new), log, ref);
if (!status.isPassed()) {
fail(status.getReason());
}
} finally {
log.flush();
ref.flush();
}
}
List<String> getEnvOptions() {
return List.of(
"-v",
"CLASSPATH=" + getClassPath(),
"DISPLAY=:0.0",
"HOME=" + System.getProperty("user.home"),
"TMP=" + System.getProperty("java.io.tmpdir"),
"windir=",
"SYSTEMROOT=");
}
List<String> getJavaOptions() {
List<String> javaOptions = List.of(
System.getProperty("java.home") + "/bin/java",
"-Dcts.tmp=" + System.getProperty("java.io.tmpdir"),
"-Djava.util.logging.config.file=" + System.getProperty("glassfish.home") + "/glassfish/domains/domain1/config/logging.properties",
"-Dtest.ejb.stateful.timeout.wait.seconds=180 ",
"-Ddeliverable.class=com.sun.ts.lib.deliverable.cts.CTSDeliverable",
"--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED",
"--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED")
;
return javaOptions;
}