예제 #1
0
  public void startBootstrapInstance(MavenPluginContext pluginContext) {
    this.log = pluginContext.getLog();
    this.configuration = pluginContext.getConfiguration();
    List<Stoppable> stoppables = Lists.newArrayList();
    getSetupStepSequence().execute(pluginContext);

    PrintStream originalSystemErr = System.err;

    bootstrap = getBootstrap();
    log.info("Starting Tomcat ...");
    try {
      File catalinaout = new File(configuration.getCatalinaBase(), "/logs/catalina.out");
      CatalinaOutPrintStream catalinaOutputStream =
          new CatalinaOutPrintStream(
              originalSystemErr,
              new FileOutputStream(catalinaout),
              configuration.isSuspendConsoleOutput());
      System.setErr(catalinaOutputStream);
      bootstrap.init();
      final BootstrapShutdownHook shutdownHook = new BootstrapShutdownHook();
      List<Stoppable> stoppableScanner =
          ScannerSetup.configureScanners(shutdownHook, configuration, log);
      stoppables.addAll(stoppableScanner);
      bootstrap.start();
      Runtime.getRuntime().addShutdownHook(shutdownHook);
      log.info("Tomcat started");
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage(), e);
    }
    stoppables.add(new StoppableBootstrapAdapter(bootstrap));
    pluginContext
        .getMojo()
        .getPluginContext()
        .put(AbstractT7BaseMojo.T7_BOOTSTRAP_CONTEXT_ID, stoppables);
  }
예제 #2
0
  /** Start the guvnor app in an installed Tomcat server */
  public static void Start() {
    bootstrap = new Bootstrap();
    String tomcatDir = Workspace.TomcatDir.getPath();
    bootstrap.setCatalinaHome(tomcatDir);
    try {
      bootstrap.start();

    } catch (Exception e) {
      e.printStackTrace();
      System.out.println("Failed Tomcat");
    }
  }
예제 #3
0
 /** Stop the guvnor app in an installed Tomcat server */
 public static void Stop() {
   synchronized (tomcatRun) {
     tomcatRun.notify();
     try {
       bootstrap.stop();
     } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }
예제 #4
0
  @Override
  protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
      // System property not set, use the Tomcat default
      File krb5ConfFile = new File(Bootstrap.getCatalinaBase(), Constants.DEFAULT_KRB5_CONF);
      System.setProperty(Constants.KRB5_CONF_PROPERTY, krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
      // System property not set, use the Tomcat default
      File jaasConfFile = new File(Bootstrap.getCatalinaBase(), Constants.DEFAULT_JAAS_CONF);
      System.setProperty(Constants.JAAS_CONF_PROPERTY, jaasConfFile.getAbsolutePath());
    }
  }