Search in sources :

Example 6 with MiniXmlParserException

use of com.sun.enterprise.universal.xml.MiniXmlParserException in project Payara by payara.

the class GFLauncher method launchInstance.

void launchInstance() throws GFLauncherException, MiniXmlParserException {
    if (isFakeLaunch()) {
        return;
    }
    List<String> cmds = null;
    // See GLASSFISH-21343
    if (OS.isDarwin() && useLaunchCtl(System.getProperty("os.version")) && (!getInfo().isVerboseOrWatchdog())) {
        // On MacOS we need to start long running process with
        // StartupItemContext. See IT 12942
        cmds = new ArrayList<String>();
        // cmds.add("/usr/libexec/StartupItemContext");
        // In MacOS 10.10 they removed StartupItemContext
        // so call launchctl directly doing what StartupItemContext did
        // See GLASSFISH-21113
        // remove bsexec as from 10.10.3 bsexec requires sudo
        cmds.add("nohup");
        cmds.addAll(getCommandLine());
    } else {
        cmds = getCommandLine();
    }
    ProcessBuilder pb = new ProcessBuilder(cmds);
    // default.
    try {
        File newDir = getInfo().getConfigDir();
        pb.directory(newDir);
    } catch (Exception e) {
    }
    // run the process and attach Stream Drainers
    try {
        closeStandardStreamsMaybe();
        process = pb.start();
        final String name = getInfo().getDomainName();
        // verbose trumps watchdog.
        if (getInfo().isVerbose()) {
            psd = ProcessStreamDrainer.redirect(name, process);
        } else if (getInfo().isWatchdog()) {
            psd = ProcessStreamDrainer.dispose(name, process);
        } else {
            psd = ProcessStreamDrainer.save(name, process);
        }
        writeSecurityTokens(process);
    } catch (Exception e) {
        throw new GFLauncherException("jvmfailure", e, e);
    }
    // if verbose, hang around until the domain stops
    if (getInfo().isVerboseOrWatchdog())
        wait(process);
}
Also used : SmartFile(com.sun.enterprise.universal.io.SmartFile) MiniXmlParserException(com.sun.enterprise.universal.xml.MiniXmlParserException)

Aggregations

MiniXmlParserException (com.sun.enterprise.universal.xml.MiniXmlParserException)6 MiniXmlParser (com.sun.enterprise.universal.xml.MiniXmlParser)3 HostAndPort (com.sun.enterprise.util.HostAndPort)3 GFLauncherException (com.sun.enterprise.admin.launcher.GFLauncherException)2 SmartFile (com.sun.enterprise.universal.io.SmartFile)2 File (java.io.File)2 CommandException (org.glassfish.api.admin.CommandException)2 GFLauncher (com.sun.enterprise.admin.launcher.GFLauncher)1 GFLauncherInfo (com.sun.enterprise.admin.launcher.GFLauncherInfo)1 StartServerHelper (com.sun.enterprise.admin.servermgmt.cli.StartServerHelper)1 IOException (java.io.IOException)1 FileRealmHelper (org.glassfish.security.common.FileRealmHelper)1