/**
   * Create a Axis2 Based Server Environment
   *
   * @param serverConfigurationInformation ServerConfigurationInformation instance
   */
  private void createNewInstance(ServerConfigurationInformation serverConfigurationInformation) {

    try {
      configurationContext =
          ConfigurationContextFactory.createConfigurationContextFromFileSystem(
              serverConfigurationInformation.getAxis2RepoLocation(),
              serverConfigurationInformation.getAxis2Xml());

      configurationContext.setProperty(AddressingConstants.ADDR_VALIDATE_ACTION, Boolean.FALSE);

      startJmxAdapter();

      listenerManager = configurationContext.getListenerManager();
      if (listenerManager == null) {

        // create and initialize the listener manager but do not start
        listenerManager = new ListenerManager();
        listenerManager.init(configurationContext);
      }

      // do not use the listener manager shutdown hook, because it clashes with the
      // SynapseServer shutdown hook.
      listenerManager.setShutdownHookRequired(false);

    } catch (Throwable t) {
      handleFatal("Failed to create a new Axis2 instance...", t);
    }
  }
示例#2
0
  public static synchronized void start(String repository) throws Exception {
    if (count == 0) {
      TestUtils.shutdownFailsafe(TESTING_PORT);
      ConfigurationContext er = getNewConfigurationContext(repository);

      receiver = new SimpleHttpServerExtension(er, TESTING_PORT);

      try {
        receiver.start();
        ListenerManager listenerManager = er.getListenerManager();
        TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_HTTP);
        trsIn.setReceiver(receiver);
        if (listenerManager == null) {
          listenerManager = new ListenerManager();
          listenerManager.init(er);
        }
        listenerManager.addListener(trsIn, true);
        System.out.print("Server started on port " + TESTING_PORT + ".....");
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    try {
      Thread.sleep(2000);
    } catch (InterruptedException e1) {
      throw new AxisFault("Thread interuptted", e1);
    }

    waitForService();

    count++;
  }
  public void start() throws IOException {
    log.info("Starting sample Axis2 server");
    listenerManager = new ListenerManager();
    listenerManager.init(cfgCtx);
    listenerManager.start();
    try {
      Thread.sleep(2000);
    } catch (InterruptedException ignored) {

    }
    started = true;
  }