Examples of LifecycleException


Examples of org.apache.tomcat.LifecycleException

     */
    public void start() throws LifecycleException {

  // Validate and update our current component state
  if (started)
      throw new LifecycleException
    (sm.getString("containerBase.alreadyStarted"));
  started = true;
  fireLifecycleEvent(START_EVENT, null);

  // Start our subordinate components, if any
View Full Code Here

Examples of org.apache.tomcat.LifecycleException

     */
    public void stop() throws LifecycleException {

  // Validate and update our current component state
  if (!started)
      throw new LifecycleException
    (sm.getString("containerBase.notStarted"));
  started = false;
  fireLifecycleEvent(STOP_EVENT, null);

  // Stop the Valves in our pipeline (including the basic), if any
View Full Code Here

Examples of org.glassfish.api.embedded.LifecycleException

            }

            return server.getDeployer().deploy(file, params);
        } catch (IOException ioe) {
            ioe.printStackTrace();
            throw new LifecycleException(ioe);
        }
    }
View Full Code Here

Examples of org.huihoo.willow.LifecycleException

   */
  public void start() throws LifecycleException
  {
    if (started)
    {
      throw new LifecycleException(sm.getString("workflowLoader.alreadyStarted"));
    }

    log.debug(sm.getString("workflowLoader.starting"));

    lifecycle.fireLifecycleEvent(START_EVENT, null);
    started = true;

    // Construct a class loader based on our current repositories list
    try
    {

      classLoader = createClassLoader();
      classLoader.setDebug(this.debug);
      classLoader.setDelegate(this.delegate);

      for (int i = 0; i < repositories.length; i++)
      {
        classLoader.addRepository(repositories[i]);
      }

      // Configure our repositories
      setRepositories();
      setClassPath();

      setPermissions();

      if (classLoader instanceof Lifecycle)
      {
        ((Lifecycle) classLoader).start();
      }

    }
    catch (Throwable t)
    {
      log.error("LifecycleException ", t);
      throw new LifecycleException("start: ", t);
    }

  }
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.container.LifecycleException

        } catch (TimeoutException ex) {
            // ignore
        }

        if (mbeanServer != null && !config.isAllowConnectingToRunningServer()) {
            throw new LifecycleException(
                    "The server is already running! Managed containers does not support connecting to running server instances due to the " +
                    "possible harmful effect of connecting to the wrong server. Please stop server before running or change to another type of container.\n" +
                    "To disable this check and allow Arquillian to connect to a running server, set allowConnectingToRunningServer to true in the container configuration");
        }

        // Start the Karaf process
        if (mbeanServer == null) {
            String karafHome = config.getKarafHome();
            if (karafHome == null)
                throw new IllegalStateException("karafHome cannot be null");

            File karafHomeDir = new File(karafHome).getAbsoluteFile();
            if (!karafHomeDir.isDirectory())
                throw new IllegalStateException("Not a valid Karaf home dir: " + karafHomeDir);

            String java = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
            _logger.info(String.format("Using java: %s", java));

            List<String> cmd = new ArrayList<String>();
            cmd.add(java);

            // JavaVM args
            String javaArgs = config.getJavaVmArguments();
            if (!javaArgs.contains("-Xmx")) {
                javaArgs = KarafManagedContainerConfiguration.DEFAULT_JAVAVM_ARGUMENTS + " " + javaArgs;
            }
            cmd.addAll(Arrays.asList(javaArgs.split("\\s")));

            // Karaf properties
            cmd.add("-Dkaraf.home=" + karafHomeDir);
            cmd.add("-Dkaraf.base=" + karafHomeDir);
            cmd.add("-Dkaraf.etc=" + karafHomeDir + "/etc");
            cmd.add("-Dkaraf.data=" + karafHomeDir + "/data");
            cmd.add("-Dkaraf.instances=" + karafHomeDir + "/instances");
            cmd.add("-Dkaraf.startLocalConsole=false");
            cmd.add("-Dkaraf.startRemoteShell=false");

            // Java properties
            cmd.add("-Djava.io.tmpdir=" + new File(karafHomeDir, "data/tmp"));
            cmd.add("-Djava.util.logging.config.file=" + new File(karafHomeDir, "etc/java.util.logging.properties"));
            cmd.add("-Djava.endorsed.dirs=" + new File(karafHomeDir, "lib/endorsed"));

            // Classpath
            StringBuilder classPath = new StringBuilder();
            File karafLibDir = new File(karafHomeDir, "lib");
            String[] libs = karafLibDir.list(new FilenameFilter() {
                @Override
                public boolean accept(File dir, String name) {
                    return name.startsWith("karaf");
                }
            });
            for (String lib : libs) {
                String separator = classPath.length() > 0 ? File.pathSeparator : "";
                classPath.append(separator).append(new File(karafHomeDir, "lib/" + lib));
            }
            cmd.add("-classpath");
            cmd.add(classPath.toString());

            // Main class
            cmd.add("org.apache.karaf.main.Main");

            // Output the startup command
            StringBuffer cmdstr = new StringBuffer();
            for (String tok : cmd) {
                cmdstr.append(tok).append(" ");
            }
            _logger.debug("Starting Karaf with: {}", cmdstr);

            try {
                ProcessBuilder processBuilder = new ProcessBuilder(cmd);
                processBuilder.directory(karafHomeDir);
                processBuilder.redirectErrorStream(true);
                process = processBuilder.start();
                new Thread(new ConsoleConsumer()).start();
            } catch (Exception ex) {
                throw new LifecycleException("Cannot start managed Karaf container", ex);
            }

            // Get the MBeanServerConnection
            try {
                mbeanServer = getMBeanServerConnection(30, TimeUnit.SECONDS);
            } catch (Exception ex) {
                destroyKarafProcess();
                throw new LifecycleException("Cannot obtain MBean server connection", ex);
            }
        }

        mbeanServerInstance.set(mbeanServer);

        try {
            // Get the FrameworkMBean
            ObjectName oname = ObjectNameFactory.create("osgi.core:type=framework,*");
            frameworkMBean = getMBeanProxy(mbeanServer, oname, FrameworkMBean.class, 30, TimeUnit.SECONDS);

            // Get the BundleStateMBean
            oname = ObjectNameFactory.create("osgi.core:type=bundleState,*");
            bundleStateMBean = getMBeanProxy(mbeanServer, oname, BundleStateMBean.class, 30, TimeUnit.SECONDS);

            // Get the BundleStateMBean
            oname = ObjectNameFactory.create("osgi.core:type=serviceState,*");
            serviceStateMBean = getMBeanProxy(mbeanServer, oname, ServiceStateMBean.class, 30, TimeUnit.SECONDS);

            // Install the arquillian bundle to become active
            installArquillianBundle();

            // Await the arquillian bundle to become active
            awaitArquillianBundleActive(30, TimeUnit.SECONDS);

            // Await the beginning start level
            Integer beginningStartLevel = config.getKarafBeginningStartLevel();
            if (beginningStartLevel != null)
                awaitBeginningStartLevel(beginningStartLevel, 30, TimeUnit.SECONDS);

            // Await bootsrap complete services
            awaitBootstrapCompleteServices();

        } catch (RuntimeException rte) {
            destroyKarafProcess();
            throw rte;
        } catch (Exception ex) {
            destroyKarafProcess();
            throw new LifecycleException("Cannot start Karaf container", ex);
        }
    }
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.container.LifecycleException

        try {
            final Properties jndiProps = new Properties();
            jndiProps.setProperty(Context.URL_PKG_PREFIXES, JBOSS_URL_PKG_PREFIX);
            jndiContext.set(new InitialContext(jndiProps));
        } catch (final NamingException ne) {
            throw new LifecycleException("Could not set JNDI Naming Context", ne);
        }

        try {
            startInternal();
        } catch (LifecycleException e) {
View Full Code Here

Examples of org.jboss.arquillian.spi.LifecycleException

               containerConfig.getDeploymentUsername(),
               containerConfig.getDeploymentPassword());
      }
      catch (Exception e)
      {
         throw new LifecycleException("Could not connect to container", e);
      }
   }
View Full Code Here

Examples of org.jboss.arquillian.spi.client.container.LifecycleException

    public void start() throws LifecycleException {
        final String xmlResponse = prepareClient().get(String.class);

        try {
            if (!isCallSuccessful(xmlResponse)) {
                throw new LifecycleException("Server is not running");
            }
        } catch (XPathExpressionException e) {
            throw new LifecycleException("Error verifying the sever is running", e);
        }
    }
View Full Code Here

Examples of org.jboss.gravia.runtime.LifecycleException

        state = State.CREATED;

        try {
            doConfigure();
        } catch (Exception ex) {
            throw new LifecycleException("Cannot configure container", ex);
        }
    }
View Full Code Here

Examples of org.mule.api.lifecycle.LifecycleException

        {
            throw ce;
        }
        catch (Exception e)
        {
            throw new LifecycleException(CoreMessages.failedToStartInboundEndpoint(this), e, this);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.