Bug Report: [7.2024.1.Alpha3] NPE on initial deployment
Brief Summary
Hello, We are anticipating Payara 7 and therefore we try to deploy our application with the latest version payara-embedded-all 7.2024.1.Alpha3.
Without changing anything else that the Payara version, we hit a NPE during deployment.
Dec 19, 2024 3:17:59 PM org.glassfish.api.ActionReport failure
SEVERE: Exception while preparing the app
Dec 19, 2024 3:17:59 PM com.sun.enterprise.v3.server.ApplicationLifecycle prepare
SEVERE: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: Error in generating security policy for app -- Error in generating security policy for app-ws-war -- Cannot invoke "jakarta.security.jacc.PolicyFactory.getPolicy()" because the return value of "jakarta.security.jacc.PolicyFactory.getPolicyFactory()" is null
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:188)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:1255)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:514)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:567)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:558)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:554)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/javax.security.auth.Subject.doAs(Subject.java:453)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:553)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:584)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:576)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/javax.security.auth.Subject.doAs(Subject.java:453)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1499)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1881)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1757)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:131)
at ch.saierp.sainet.embedded.server.SAINetServer.start(SAINetServer.java:2073)
at ch.saierp.sainet.embedded.server.cli.SAINetServerMain.lambda$startServer$27(SAINetServerMain.java:1354)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.RuntimeException: Error in generating security policy for app -- Error in generating security policy for app-ws-war -- Cannot invoke "jakarta.security.jacc.PolicyFactory.getPolicy()" because the return value of "jakarta.security.jacc.PolicyFactory.getPolicyFactory()" is null
at org.glassfish.deployment.common.SimpleDeployer.prepare(SimpleDeployer.java:93)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:1255)
at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:301)
at org.glassfish.javaee.full.deployment.EarDeployer.lambda$prepare$0(EarDeployer.java:164)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:221)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:233)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:259)
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:162)
... 23 more
Caused by: org.glassfish.deployment.common.DeploymentException: Error in generating security policy for app -- Error in generating security policy for app-ws-war -- Cannot invoke "jakarta.security.jacc.PolicyFactory.getPolicy()" because the return value of "jakarta.security.jacc.PolicyFactory.getPolicyFactory()" is null
at com.sun.enterprise.security.ee.authorization.WebAuthorizationManagerService.<init>(WebAuthorizationManagerService.java:137)
at com.sun.enterprise.security.ee.web.integration.WebSecurityManagerFactory.createManager(WebSecurityManagerFactory.java:101)
at com.sun.enterprise.security.ee.SecurityDeployer.loadWebPolicy(SecurityDeployer.java:266)
at com.sun.enterprise.security.ee.SecurityDeployer.generateArtifacts(SecurityDeployer.java:207)
at org.glassfish.deployment.common.SimpleDeployer.prepare(SimpleDeployer.java:88)
... 30 more
We tried to reinstate the jacc="simple" in the <security-service> node as stated in #1596 but the outcome is still the same.
Our JACC provider is configured like this (also I'm not sure it is related to the problem):
<jacc-provider policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl" policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default"></jacc-provider>
Expected Outcome
The deployment succeeds.
Current Outcome
A NullPointerException is thrown wile deploying the app.
Reproducer
None.
Operating System
Linux Debian
JDK Version
OpenJDK 21
Payara Distribution
Payara Embedded All
@ctabin, provide a simple, self-contained reproducer that we can test.
Hi @artur-mal,
Here is the reproducer in the payara-7-alpha branch:
git clone https://github.com/ctabin/gf-test.git payara-7141
cd payara-7141
git checkout payara-7-alpha
mvn clean package
You'll get the error printed and the deployment fails. If you try with mvn clean package -Dappserver.version=6.2024.12, the deployment works correctly.
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.
Greetings, It's been more than 5 days since this issue was identified as abandoned. We have closed this issue due to inactivity, please feel free to re-open it if you have more information to share.
@artur-mal Can you please open this issue again ? The response has been provided with an example.
We're aware of the issue and have created a JIRA task (FISH-10138) to address it.
FYI the problem is still present in version 7.2025.1.Alpha1.
FYI the problem remains with version 72025.1.Beta1:
SEVERE: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: Error in committing security policy for ejbs of SNV4SRV -- Cannot invoke "jakarta.security.jacc.PolicyFactory.getPolicy()" because the return value of "jakarta.security.jacc.PolicyFactory.getPolicyFactory()" is null
at com.sun.enterprise.security.ee.SecurityUtil.generatePolicyFile(SecurityUtil.java:205)
at com.sun.enterprise.security.ee.SecurityDeployer.commitEjbPolicies(SecurityDeployer.java:316)
at com.sun.enterprise.security.ee.SecurityDeployer$AppDeployEventListener.event(SecurityDeployer.java:168)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:135)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:344)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:571)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:567)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:558)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:554)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/javax.security.auth.Subject.doAs(Subject.java:453)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:553)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:584)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:576)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/javax.security.auth.Subject.doAs(Subject.java:453)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1499)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1881)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1757)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:131)
at ...
Solved in 7.2025.1 by updating the jacc configuration in domain.xml by:
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory" />
And adding this in <jvm-options>:
<jvm-options>-Djakarta.security.jacc.PolicyFactory.provider=org.glassfish.exousia.modules.def.DefaultPolicyFactory</jvm-options>