Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign of GlassFish bootstrap #25183

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ad12f19
Improved Derby and CommonClassLoader initialization
dmatej Oct 6, 2024
d5ae053
Simplified CommonClassLoaderServiceImplTest - using HK2
dmatej Oct 9, 2024
51290ba
ASenvPropertyReader now supports trivial bash expressions
dmatej Oct 9, 2024
31b04f0
asenv.conf now supports external env properties
dmatej Oct 9, 2024
87f500f
Disabled automatic class path in manifest
dmatej Oct 9, 2024
65b8e05
AdminMain revisited
dmatej Oct 9, 2024
4e4dd0e
Fixed log messages - throwable is not a parameter
dmatej Oct 9, 2024
cf57af1
Added log manager to domain.xml files, maintenance
dmatej Oct 9, 2024
eec1f0f
Boot classpath reconstruction - separation of layers
dmatej Oct 9, 2024
21ae0cd
Updated POM and assembly files
dmatej Oct 9, 2024
9e285ae
All GlassFish classloaders are parallelCapable and have names
dmatej Oct 9, 2024
8de2e0e
Add missing JVM options when doing migration of older domain.xml
dmatej Oct 9, 2024
c865439
Updated osgi.properties
dmatej Oct 9, 2024
954e436
Updated GlassFishMainLauncher
dmatej Oct 9, 2024
ea2da7f
Updated scripts to use GJULE (is always on classpath)
dmatej Oct 9, 2024
1ec6c2a
Reproducer test for the issue when GC logging disabled glassfish logging
dmatej Oct 9, 2024
07e2770
We have one logger less
dmatej Oct 9, 2024
e81588a
Added module-info files + resolved dependency on LogFacade of glassfi…
dmatej Oct 10, 2024
88b35a2
LocalStringsImpl - JPMS
dmatej Oct 12, 2024
e4148fd
Deleted unused LocalStrings class
dmatej Oct 13, 2024
e5408a9
Added logging keys too as Java doesn't do that
dmatej Oct 13, 2024
b78b2c2
Added missing `uses org.glassfish.embeddable.spi.RuntimeBuilder`
dmatej Oct 13, 2024
ccf4500
Removed usages of private class of gjule: GlassFishLoggingTracer
dmatej Oct 13, 2024
fbde9a1
Implemented support for modulepath - bootstrap libs use it.
dmatej Oct 14, 2024
cf9be1a
Fixed bootstrap's module-info
dmatej Oct 14, 2024
14b4e1a
Fixed classpaths and env variables
dmatej Oct 16, 2024
b3f19b5
TemplateInfoHolder - do not hide the cause of the problem!
dmatej Oct 16, 2024
42d3b01
Using ASADMIN_CLASSPATH to limit list of extensions.
dmatej Oct 16, 2024
26ccdef
Apostrophes and eval brought back to appclient
dmatej Oct 17, 2024
7f58b33
Fixed glassfish-embedded-static classpath
dmatej Oct 17, 2024
1356964
Fixed ejb embedded tests + in master passes 32 tests, here 33
dmatej Oct 17, 2024
cdd51af
Jar index removed again - support was removed in JDK18
dmatej Oct 18, 2024
78cfac7
GLASSFISH_HOME replaced by S1AS_HOME as the first is not always set
dmatej Nov 7, 2024
60ef45f
Fixed resolving Windows paths
dmatej Nov 8, 2024
4093d24
Fixed asadmin verify-domain-xml command + added test
dmatej Nov 10, 2024
70ae204
Adapted webservices-scripts
dmatej Nov 10, 2024
280c10d
System property should have higher priority than env option
dmatej Nov 10, 2024
7a9173b
Fixing appclient and Ant tests
dmatej Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

package com.sun.enterprise.backup;

import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.util.ColumnFormatter;
import com.sun.enterprise.util.io.FileUtils;

Expand All @@ -33,6 +32,8 @@
import java.util.List;
import java.util.TreeSet;

import org.glassfish.main.jdke.i18n.LocalStringsImpl;


/**
*
Expand Down
16 changes: 2 additions & 14 deletions appserver/admin/cli-optional/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
<groupId>org.glassfish.main.admin</groupId>
<artifactId>admin-cli</artifactId>
<version>${project.version}</version>
</dependency> <dependency>
</dependency>
<dependency>
<groupId>org.glassfish.main.core</groupId>
<artifactId>glassfish</artifactId>
<version>${project.version}</version>
Expand Down Expand Up @@ -138,18 +139,5 @@
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
+ <classpathPrefix>../../modules</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.sun.enterprise.admin.servermgmt.cli.LocalDomainCommand;
import com.sun.enterprise.backup.BackupRequest;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.util.ObjectAnalyzer;

import java.io.File;
Expand All @@ -28,6 +27,7 @@
import org.glassfish.api.Param;
import org.glassfish.api.admin.CommandException;
import org.glassfish.api.admin.CommandValidationException;
import org.glassfish.main.jdke.i18n.LocalStringsImpl;

import static com.sun.enterprise.util.Utility.isEmpty;
import static com.sun.enterprise.util.io.DomainDirs.getDefaultDomainsDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.sun.enterprise.backup.BackupException;
import com.sun.enterprise.backup.BackupManager;
import com.sun.enterprise.backup.BackupWarningException;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.universal.process.ProcessUtils;
import com.sun.enterprise.util.ObjectAnalyzer;

Expand All @@ -30,6 +29,7 @@
import org.glassfish.api.Param;
import org.glassfish.api.admin.CommandException;
import org.glassfish.hk2.api.PerLookup;
import org.glassfish.main.jdke.i18n.LocalStringsImpl;
import org.jvnet.hk2.annotations.Service;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Contributors to the Eclipse Foundation
* Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -19,16 +19,16 @@

import com.sun.enterprise.admin.cli.CLICommand;
import com.sun.enterprise.admin.cli.ClassPathBuilder;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.util.OS;

import java.io.File;

import org.glassfish.api.Param;
import org.glassfish.api.admin.CommandException;
import org.glassfish.api.admin.CommandValidationException;
import org.glassfish.main.jdke.i18n.LocalStringsImpl;

import static com.sun.enterprise.util.SystemPropertyConstants.DERBY_ROOT_PROPERTY;
import static com.sun.enterprise.glassfish.bootstrap.cfg.BootstrapKeys.DERBY_ROOT_PROP_NAME;
import static com.sun.enterprise.util.SystemPropertyConstants.INSTALL_ROOT_PROPERTY;
import static com.sun.enterprise.util.SystemPropertyConstants.JAVA_ROOT_PROPERTY;

Expand All @@ -55,6 +55,7 @@ public abstract class DatabaseCommand extends CLICommand {
@Param(name = "dbport", optional = true, defaultValue = DB_PORT_DEFAULT)
protected String dbPort;

protected final ClassPathBuilder modulepath = new ClassPathBuilder();
protected final ClassPathBuilder sClasspath = new ClassPathBuilder();
protected final ClassPathBuilder sDatabaseClasspath = new ClassPathBuilder();

Expand All @@ -77,10 +78,11 @@ protected void prepareProcessExecutor() throws Exception {
}

javaHome = new File(getSystemProperty(JAVA_ROOT_PROPERTY));
dbLocation = new File(getSystemProperty(DERBY_ROOT_PROPERTY));
dbLocation = new File(getSystemProperty(DERBY_ROOT_PROP_NAME));
checkIfDbInstalled(dbLocation);

sClasspath.add(new File(installRoot, "lib/asadmin/cli-optional.jar"));
modulepath.addAll(new File(installRoot, "lib/bootstrap"), f -> f.isFile());
sClasspath.add(new File(installRoot, System.getProperty("java.class.path")));
sDatabaseClasspath.add(dbLocation, "lib", "derby.jar")
.add(dbLocation, "lib", "derbyshared.jar")
.add(dbLocation, "lib", "derbytools.jar")
Expand Down Expand Up @@ -133,22 +135,28 @@ protected String[] pingDatabaseCmd(boolean bRedirect) throws Exception {
getJavaExe().toString(),
"-Djava.library.path=" + installRoot + File.separator + "lib",
"-Dderby.storage.fileSyncTransactionLog=True",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + File.pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"ping",
dbHost, dbPort, Boolean.valueOf(bRedirect).toString() };
dbHost, dbPort, Boolean.toString(bRedirect) };

}

return new String[] {
getJavaExe().toString(),
"-Djava.library.path=" + installRoot + File.separator + "lib",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + File.pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"ping",
dbHost, dbPort, Boolean.valueOf(bRedirect).toString() };
dbHost, dbPort, Boolean.toString(bRedirect) };
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import com.sun.enterprise.backup.BackupException;
import com.sun.enterprise.backup.BackupWarningException;
import com.sun.enterprise.backup.ListManager;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.util.ObjectAnalyzer;

import java.io.File;

import org.glassfish.api.admin.CommandException;
import org.glassfish.hk2.api.PerLookup;
import org.glassfish.main.jdke.i18n.LocalStringsImpl;
import org.jvnet.hk2.annotations.Service;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.sun.enterprise.backup.BackupRequest;
import com.sun.enterprise.backup.BackupWarningException;
import com.sun.enterprise.backup.RestoreManager;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.universal.process.ProcessUtils;
import com.sun.enterprise.util.ObjectAnalyzer;

Expand All @@ -32,6 +31,7 @@
import org.glassfish.api.admin.CommandException;
import org.glassfish.api.admin.CommandValidationException;
import org.glassfish.hk2.api.PerLookup;
import org.glassfish.main.jdke.i18n.LocalStringsImpl;
import org.jvnet.hk2.annotations.Service;

import static com.sun.enterprise.util.Utility.isAllNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.sun.enterprise.admin.cli.CLIProcessExecutor;
import com.sun.enterprise.universal.glassfish.GFLauncherUtils;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.util.OS;

import java.io.File;
Expand All @@ -30,6 +29,7 @@
import org.glassfish.api.admin.CommandException;
import org.glassfish.api.admin.CommandValidationException;
import org.glassfish.hk2.api.PerLookup;
import org.glassfish.main.jdke.i18n.LocalStringsImpl;
import org.jvnet.hk2.annotations.Service;

import static com.sun.enterprise.admin.cli.optional.DerbyControl.DB_LOG_FILENAME;
Expand Down Expand Up @@ -92,6 +92,11 @@ public String[] startDatabaseCmd() {
cmd.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:9011");
}

cmd.add("--module-path");
cmd.add(modulepath.toString());
cmd.add("--add-modules");
cmd.add("ALL-MODULE-PATH");

cmd.add("-cp");
cmd.add(sClasspath + pathSeparator + sDatabaseClasspath);
if (jvmoptions != null) {
Expand All @@ -117,8 +122,11 @@ public String[] sysinfoCmd() throws Exception {
javaHome + separator + "bin" + separator + "java",
"-Djava.library.path=" + installRoot + separator + "lib",
"-Dderby.storage.fileSyncTransactionLog=True",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"sysinfo",
dbHost, dbPort, "false" };
Expand All @@ -127,8 +135,11 @@ public String[] sysinfoCmd() throws Exception {
return new String[] {
javaHome + separator + "bin" + separator + "java",
"-Djava.library.path=" + installRoot + separator + "lib",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"sysinfo",
dbHost, dbPort, "false" };
Expand All @@ -144,6 +155,11 @@ public String[] executeSQLCmd() throws Exception {
cmd.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:9012");
}

cmd.add("--module-path");
cmd.add(modulepath.toString());
cmd.add("--add-modules");
cmd.add("ALL-MODULE-PATH");

cmd.add("-cp");
cmd.add(sClasspath + pathSeparator + sDatabaseClasspath);

Expand All @@ -158,7 +174,7 @@ public String[] executeSQLCmd() throws Exception {
cmd.add(dbPassword);
}

return cmd.toArray(new String[cmd.size()]);
return cmd.toArray(String[]::new);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.sun.enterprise.admin.cli.CLIProcessExecutor;
import com.sun.enterprise.admin.cli.Environment;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.util.OS;

import java.io.File;
Expand All @@ -29,6 +28,7 @@
import org.glassfish.api.admin.CommandException;
import org.glassfish.api.admin.CommandValidationException;
import org.glassfish.hk2.api.PerLookup;
import org.glassfish.main.jdke.i18n.LocalStringsImpl;
import org.jvnet.hk2.annotations.Service;

import static com.sun.enterprise.admin.cli.CLIUtil.readPasswordFileOptions;
Expand Down Expand Up @@ -81,8 +81,11 @@ public String[] stopDatabaseCmd() throws Exception {
javaHome + separator + "bin" + separator + "java",
"-Djava.library.path=" + installRoot + separator + "lib",
"-Dderby.storage.fileSyncTransactionLog=True",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"shutdown",
dbHost, dbPort, "false" };
Expand All @@ -91,19 +94,25 @@ public String[] stopDatabaseCmd() throws Exception {
return new String[] {
javaHome + separator + "bin" + separator + "java",
"-Djava.library.path=" + installRoot + separator + "lib",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"shutdown",
dbHost, dbPort, "false" };
}

if (OS.isDarwin()) {
return new String[] { javaHome + separator + "bin" + separator + "java",
"-Djava.library.path=" + installRoot + separator +
"lib", "-Dderby.storage.fileSyncTransactionLog=True",
"-Djava.library.path=" + installRoot + separator + "lib",
"-Dderby.storage.fileSyncTransactionLog=True",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"shutdown",
dbHost, dbPort, "false", dbUser, dbPassword };
Expand All @@ -112,8 +121,11 @@ public String[] stopDatabaseCmd() throws Exception {
return new String[] {
javaHome + separator + "bin" + separator + "java",
"-Djava.library.path=" + installRoot + separator + "lib",
"--module-path",
modulepath.toString(),
"--add-modules",
"ALL-MODULE-PATH",
"-cp", sClasspath + pathSeparator + sDatabaseClasspath,

"com.sun.enterprise.admin.cli.optional.DerbyControl",
"shutdown",
dbHost, dbPort, "false", dbUser, dbPassword };
Expand Down
7 changes: 1 addition & 6 deletions appserver/admin/cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>org.glassfish.main.admin</groupId>
<artifactId>admin-cli</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
</dependencies>

Expand All @@ -59,12 +59,7 @@
<archive>
<manifest>
<mainClass>org.glassfish.admin.cli.AsadminMain</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>../../modules</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>../../lib/bootstrap/glassfish-jul-extension.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -29,13 +30,17 @@ public static void main(String[] args) {
// Metrix.event("START");
Environment.setPrefix("AS_ADMIN_");
Environment.setShortPrefix("AS_");
int code = new AsadminMain().doMain(args);

AsadminMain main = new AsadminMain();
int code = main.doMain(args);
// Metrix.event("DONE");
// System.out.println("METRIX:");
// System.out.println(Metrix.getInstance().toString());
System.exit(code);
}


@Override
protected String getCommandName() {
return "asadmin";
}
Expand Down
Loading