예제 #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");
    }
  }