Package com.sun.enterprise.admin.servermgmt

Examples of com.sun.enterprise.admin.servermgmt.InstanceException


                {
                    process = launcher.launch(launcherArgs, securityInfo);
                }
                catch(ASLauncherException e)
                {
                    throw new InstanceException(e);
                }
            }
            else
            {
                final ASLauncher launcher = new ASLauncher();
                launcher.setRefreshConfigContext(_config.getRefreshConfigContext());
                launcher.preProcess(launcherArgs, envProps);
                final String instanceRoot = launcher.getInstanceRoot();
                process = launcher.process(launcherArgs, securityInfo);
               
                // explicitly detect a race condition with system property for instance root
                final String valueNow = System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY);
                if ( ! instanceRoot.equals(valueNow) )
                {
                    throw new IllegalStateException( "RACE CONDITION exists for system property " +
                        SystemPropertyConstants.INSTANCE_ROOT_PROPERTY + ", value changed to " + valueNow);
                }
            }
        }
        catch ( Exception ex )
        {
            throw new InstanceException(
                getMessages().getInstanceStartupExceptionMessage(
                getConfig().getDisplayName()), ex);
        }

        return process;
View Full Code Here


    // If verbose, LauncherBootstrap.main() returns only after
    // the appserver JVM exits.
    mainMethod.invoke(null, argsArray);

      } catch ( Exception ex ) {
    throw new InstanceException(
        getMessages().getInstanceStartupExceptionMessage(
      getConfig().getDisplayName()), ex);
      }

    } else if (System.getProperty("com.sun.aas.processLauncher") != null && verbose) {
        // add arguments to main command, native must come first
        if (nativeLauncher) {
            // use native launcher, add in argument
            alCmd.add("native");
        }
        if (debug) alCmd.add("debug");
        if (verbose) alCmd.add("verbose");
        // addin command line args
        if (commandLineArgs != null) {
            for(int ii=0; ii < commandLineArgs.length; ii++) {
                alCmd.add(commandLineArgs[ii]);
            }
        }

        // extract full command
        command=new String[alCmd.size()];
        command=(String[])alCmd.toArray(command);

        try {
            // exec process directly to exercise needed control
            ProcessExecutor exec = new ProcessExecutor(command, securityInfo);
            // set verbose flag so process error stream get redirected to stderr
            exec.setVerbose(verbose);
            // call execute so it will not be timed out
            exec.execute(false, false);
            process=exec.getSubProcess();
            // this will force process to wait for executing process
            int exitValue=process.waitFor();
            System.exit(exitValue);
        } catch (Exception e) {
            throw new InstanceException(_strMgr.getString("procExecError"), e);
        }

    } else {
        // add arguments to main command, native must come first
        if (nativeLauncher) {
View Full Code Here

        {
            isRestartNeeded = getRMIClient().isRestartNeeded();
        }
        catch (Exception e)
        {
            throw new InstanceException(e.getMessage(), e);
        }
        return isRestartNeeded;
    }
View Full Code Here

    protected void preStart() throws InstanceException
    {
        final int state = getInstanceStatus();
        if (Status.kInstanceNotRunningCode != state)
        {
            throw new InstanceException(
                getMessages().getCannotStartInstanceInvalidStateMessage(
                    getConfig().getDisplayName(),
                    Status.getStatusString(state)));
        }
    }
View Full Code Here

    void postStart() throws InstanceException
    {
        if (isInstanceFailed()) {
            int port = getConflictedPort();
            abortServer();
            throw new InstanceException(
                getMessages().getStartupFailedMessage(
                    getConfig().getDisplayName(), port ));
        }
        if (!isInstanceRunning() &&
            !isInstanceNotRunning())
        {
            /*
                Instance could not be started in TIME_OUT_SECONDS.
                Trying to stop.
             */
            try {
                stopInstance("true");
            } catch (Exception e) {
                throw new InstanceException(
                    getMessages().getStartInstanceTimeOutMessage(
                        getConfig().getDisplayName()), e);
            }
            throw new InstanceException(
               getMessages().getStartInstanceTimeOutMessage(
                   getConfig().getDisplayName()));
        }
        if (isInstanceNotRunning()) {
            throw new InstanceException(
                getMessages().getStartupFailedMessage(
                    getConfig().getDisplayName()));
        }
        setRMIClient(null);
    }
View Full Code Here

    void postStop() throws InstanceException
    {
        if (!isInstanceNotRunning())
        {
            throw new InstanceException(
                getMessages().getCannotStopInstanceMessage(
                    getConfig().getDisplayName()));
        }
        setRMIClient(null);
    }
View Full Code Here

        timer.run(); //synchronous


        if (getInstanceStatus() == Status.kInstanceNotRunningCode)
        {
            throw new InstanceException(
                getMessages().getTimeoutStartingMessage(
                    getConfig().getDisplayName()));
        }
    }
View Full Code Here

                                   new String[] {script.getAbsolutePath()});
            exec.execute();
        }
        catch (Exception e)
        {
            throw new InstanceException(_strMgr.getString("procExecError"), e);
        }
    }
View Full Code Here

            // if it goes on too long, reason for return signature is for SE ProcessManager watchdog
            return exec;
        }
        catch (Exception e)
        {
            throw new InstanceException(_strMgr.getString("procExecError"), e);
        }
    }
View Full Code Here

        // kill the hanging process
        if (!pids.isEmpty())  {
            int exitValue = executeKillServ(pids);
      if (debug) System.out.println("Exit value is = " + exitValue);
            if (exitValue != 0)
                throw new InstanceException(
                    getMessages().getCannotStopInstanceMessage(
                        getConfig().getDisplayName()));           
        } else {
            throw new InstanceException(_strMgr.getString("noPidsToKill"));
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.servermgmt.InstanceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.