From 5377e03ec363f86276730201276f6e48684a0780 Mon Sep 17 00:00:00 2001 From: lprimak Date: Sun, 7 Dec 2025 19:25:41 -0600 Subject: [PATCH 1/2] bugfix: PostBoot commands now run after server ready event, not during service construction. This is due to the fact that previously, deploy would fail due to server not being ready for deployment fixes #7806 --- .../v3/bootstrap/BootCommandService.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java index f24f15a3aeb..896a94bee0f 100644 --- a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java +++ b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java @@ -42,6 +42,9 @@ import com.sun.enterprise.module.bootstrap.StartupContext; import fish.payara.internal.api.PostBootRunLevel; import fish.payara.boot.runtime.BootCommands; +import org.glassfish.api.event.EventListener; +import org.glassfish.api.event.EventTypes; +import org.glassfish.api.event.Events; import org.glassfish.embeddable.CommandRunner; import org.glassfish.hk2.api.PostConstruct; import org.glassfish.hk2.runlevel.RunLevel; @@ -56,7 +59,7 @@ @Service @RunLevel(value = PostBootRunLevel.VAL) -public class BootCommandService implements PostConstruct { +public class BootCommandService implements PostConstruct, EventListener { private static final Logger LOGGER = Logger.getLogger(BootCommandService.class.getName()); @@ -66,6 +69,9 @@ public class BootCommandService implements PostConstruct { @Inject CommandRunner commandRunner; + @Inject + private Events events; + /** * Runs a series of commands from a file * @param file @@ -86,8 +92,15 @@ public void doBootCommands(String file, boolean expandValues) { } } + @Override + public void event(Event event) { + if (event.is(EventTypes.SERVER_READY)) { + doBootCommands(startupContext.getArguments().getProperty("-postbootcommandfile"), true); + } + } + @Override public void postConstruct() { - doBootCommands(startupContext.getArguments().getProperty("-postbootcommandfile"), true); + events.register(this); } } From 9e68acc762647db24d14ac0b0ffb9a5846943813 Mon Sep 17 00:00:00 2001 From: lprimak Date: Sun, 7 Dec 2025 19:28:43 -0600 Subject: [PATCH 2/2] fix copyright --- .../com/sun/enterprise/v3/bootstrap/BootCommandService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java index 896a94bee0f..49f14705274 100644 --- a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java +++ b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/bootstrap/BootCommandService.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) [2016-2022] Payara Foundation and/or its affiliates. All rights reserved. + * Copyright (c) [2016-2025] Payara Foundation and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development