Open charleech opened 1 year ago
Surprisingly, it works fine with JDK 11 !
openjdk version "11.0.20" 2023-07-18 OpenJDK Runtime Environment Temurin-11.0.20+8 (build 11.0.20+8) OpenJDK 64-Bit Server VM Temurin-11.0.20+8 (build 11.0.20+8, mixed mode)
<my.java.version>11</my.java.version>
<maven.compiler.release>${my.java.version}</maven.compiler.release>
<maven.compiler.source>${my.java.version}</maven.compiler.source>
<maven.compiler.target>${my.java.version}</maven.compiler.target>
There is a failure as the following: -
Jul 29, 2023 10:53:33 AM com.sun.appserv.ClassLoaderUtil releaseLoader
WARNING: classloaderutil.errorReleasingLoader
java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.ArrayList jdk.internal.loader.URLClassPath.loaders accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @89959b
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:170)
at com.sun.appserv.ClassLoaderUtil.getField(ClassLoaderUtil.java:301)
at com.sun.appserv.ClassLoaderUtil.initForClosingJars(ClassLoaderUtil.java:283)
at com.sun.appserv.ClassLoaderUtil.init(ClassLoaderUtil.java:261)
at com.sun.appserv.ClassLoaderUtil.releaseLoader(ClassLoaderUtil.java:137)
at com.sun.appserv.ClassLoaderUtil.releaseLoader(ClassLoaderUtil.java:109)
at org.glassfish.web.loader.WebappClassLoader.stop(WebappClassLoader.java:2032)
at org.glassfish.web.loader.WebappClassLoader.preDestroy(WebappClassLoader.java:1997)
at org.glassfish.deployment.common.DeploymentContextImpl.getClassLoader(DeploymentContextImpl.java:293)
at org.glassfish.deployment.common.DeploymentContextImpl.getClassLoader(DeploymentContextImpl.java:235)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:568)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:613)
export JAVA_TOOL_OPTIONS=--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED
The build is success !
After searching through the internet with trial and error, I'm able to make it works with JDK 17
by adding the JVM argument as the following: -
export JAVA_TOOL_OPTIONS="-Djdk.util.zip.disableZip64ExtraFieldValidation=true \
-Djdk.attach.allowAttachSelf=true \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED \
--add-opens=java.base/java.net=ALL-UNNAMED \
--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED"
mvn clean install -Darq-mode=payara-embedded -am
Even the test is success, the stopping process is too slow. It takes around 2+ minutes.
I also have a chance to dig deeper and found that the slowness is from the method named undeploy
of the fish.payara.arquillian.container.payara.embedded.PayaraContainer
(branch = Payara6).
@Override
public void undeploy(Archive<?> archive) throws DeploymentException {
try {
glassfish.getDeployer().undeploy(createDeploymentName(archive.getName())); // <---- This line !
} catch (Exception e) {
throw new DeploymentException("Could not undeploy " + archive.getName(), e);
}
}
Again, the slowness only occurs for JDK 17
. While the JDK 11
has no any issue and quite fast as usual.
I have a chance to add the failure test case as the following: -
@Test
@Order(2)
@DisplayName(
"When greeting as failure by Jakarta EE should be failed."
)
void whenGreetAsFailure() {
String expected = null;
String actual = null;
expected = "Hello JUnit";
actual = this.greeter.greet("UNKNOWN");
BDDAssertions.then(actual).
as("The greeting must be valid.").
isNotNull().
isNotEmpty().
isEqualTo(expected);
}
The expected is, there should 1 failure case as the same from payara-micro
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] GreeterIT.whenGreetAsFailure:83 [The greeting must be valid.]
expected: "Hello JUnit"
but was: "Hello UNKNOWN"
[INFO]
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
but the result from payara-embedded-all
is all success !
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
Furthermore, I also have tried to print debug for both test methods, but there is no any printed on the console. It looks like they are not executed.
Hello @charleech,
I have tested the reproducer according to your instructions, and I can see the issue with the test being shown as passed rather than failed. Just to understand the problem: you are saying that the same tests in Payara Micro give the correct results (one pass one fail), compared to Payara Embedded which passes both of the tests (which I can confirm)?
Yes, correct.
Regarding to the README
payara-micro
please use the following command: -export JAVA_TOOL_OPTIONS="-Djdk.util.zip.disableZip64ExtraFieldValidation=true \
-Djdk.attach.allowAttachSelf=true \
--add-opens=java.base/java.io=ALL-UNNAMED"
mvn clean install -Darq-mode=payara-micro
payara-embedded-all
please use the following command: -export JAVA_TOOL_OPTIONS="-Djdk.util.zip.disableZip64ExtraFieldValidation=true \
-Djdk.attach.allowAttachSelf=true \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED \
--add-opens=java.base/java.net=ALL-UNNAMED \
--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED"
mvn clean install -Darq-mode=payara-embedded
Furthermore, testing against the payara-ml
is also an expected as the same as payara-micro
payara-ml
(aka managed
) please use the following command: -export JAVA_TOOL_OPTIONS="-Djdk.util.zip.disableZip64ExtraFieldValidation=true \
-Djdk.attach.allowAttachSelf=true \
--add-opens=java.base/java.io=ALL-UNNAMED"
mvn clean install
-Dxxx
since it is a default active Maven profile.simple-cdi/target/container/payara6/glassfish/domains/domain1/logs/server.log
Greetings, It's been more than 5 days since we requested more information or an update from you on the details of this issue. Could you provide an update soon, please? We're afraid that if we do not receive an update, we'll have to close this issue due to inactivity.
Hi @felixif
Do you need any information to re-produce ?
Hello @charleech,
No, apologies for the automation that set the issue as abandoned. The reproducer you provided and the instructions are excellent. I was able to confirm that payara-micro
provides the correct test results, and payara-embedded
passes both tests, but in my case, the same is true for payara-ml
(which in your case behaves like payara-micro
).
Nevertheless, I have created an internal issue FISH-7730
, and our development team is going to have a look as soon as they can. I mentioned the discrepancy between our test results in the case of payara-ml,
in case they will have to take a deeper look at both payara-ml
andpayara-embedded
.
Thank you very much for reporting this bug!
Best regards, Felix
Brief Summary
Cannot test the simple CDI bean with JUnit5, Arquillian, arquillian-payara-server-embedded and payara-embedded-all.
The system shows the error as the following: -
Then I had added the JVM options as
--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED
, there were failures to add more and more, then I ended up with the following:-The Arquillian archive had been deployed, but there was another failure as the following: -
Expected Outcome
The Arquilian archive have to be deployed to the payara-embedded-all and the test have to be success.
Current Outcome
By using the following: -
fish.payara.arquillian:arquillian-payara-server-embedded
version3.0.alpha8
fish.payara.extras:payara-embedded-all
version6.2023.7
There is a failure as the following: -
Then I had added the JVM options as
--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED
, there were failures to add more and more, then I ended up with the following:-The Arquillian archive had been deployed, but there was another failure as the following: -
Reproducer
I've created the reproducer at the following: -
Note
With Payara Micro: Succcess
fish.payara.arquillian:arquillian-payara-micro-managed
version 3.0.alpha8version
6.2023.7`With Payara Managed: Success
fish.payara.arquillian:arquillian-payara-server-managed
version3.0.alpha8
fish.payara.distributions:payara-ml:zip
version6.2023.7
Operating System
Windows 11 Home Single Language 22H2 22621.1992
JDK Version
openjdk version "17.0.8" 2023-07-18 OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7) OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (build 17.0.8+7, mixed mode, sharing)
Payara Distribution
Payara Embedded All