Examples of ManagedLifecycleException


Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

        {
            datagramAcceptor.bind(socketAddress, messageHandler);
        }
        catch (final IOException e)
        {
            throw new ManagedLifecycleException("IOException while trying to bind UdpListerner to '" + socketAddress + "'. Exception was:" + e);
        }
        log.info("Started " + toString());
    }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

        {
            return new ServiceInvoker(serviceCategory, serviceName);
        }
        catch (MessageDeliverException e)
        {
            throw new ManagedLifecycleException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

  @Override
  protected void doInitialise() throws ManagedLifecycleException {
    try {
      jndiContext = NamingContextPool.getNamingContext(jndiEnvironment);
    } catch (NamingContextException nce) {
      throw new ManagedLifecycleException(nce);
    }
    // this allows us to use Camel's property replacement via ref:{{jndiName}} - actually (ref:%7B%7BjndiName%7D%7D)
    camelContext = new DefaultCamelContext(new JndiRegistry(jndiContext));
    // we need to disable JMX so we don't depend on Spring classes
    camelContext.disableJMX();
    // configure correct classloading
    DefaultPackageScanClassResolver packageScanClassResolver = null;
    if (isAS4) {
                    packageScanClassResolver = (DefaultPackageScanClassResolver) camelContext.getPackageScanClassResolver();
                    if (packageScanClassResolver == null) {
                            packageScanClassResolver = new DefaultPackageScanClassResolver();
                            camelContext.setPackageScanClassResolver(packageScanClassResolver);
                    }
    } else if (isAS5) {
      // JBossESB on AS5+ needs this to handle VFS classloading URIs.
      // JBossESB on AS4 will not work if we use this.
      packageScanClassResolver = new JBossPackageScanClassResolver();
      camelContext.setPackageScanClassResolver(packageScanClassResolver);
    } else if (isAS6) {      
        try {
            Class c = Class.forName(AS6_CLASS_RESOLVER);
            Constructor con = c.getConstructor();
            packageScanClassResolver= (DefaultPackageScanClassResolver) con.newInstance();
                        camelContext.setPackageScanClassResolver(packageScanClassResolver);           
        } catch (InstantiationException e) {
            throw new ManagedLifecycleException(e);
        } catch (ClassNotFoundException e) {
                        throw new ManagedLifecycleException(e);
                    } catch (SecurityException e) {
                        throw new ManagedLifecycleException(e);
                    } catch (NoSuchMethodException e) {
                        throw new ManagedLifecycleException(e);
                    } catch (IllegalArgumentException e) {
                        throw new ManagedLifecycleException(e);
                    } catch (IllegalAccessException e) {
                        throw new ManagedLifecycleException(e);
                    } catch (InvocationTargetException e) {
                        throw new ManagedLifecycleException(e);
                    }
               
                    camelContext.setPackageScanClassResolver(packageScanClassResolver);       
    }
    Set<ClassLoader> classLoaders = new HashSet<ClassLoader>();
    classLoaders.add(Thread.currentThread().getContextClassLoader());
    packageScanClassResolver.setClassLoaders(classLoaders);
    // register JndiTypeConverters
    Set<Class<?>> jndiTypes = new HashSet<Class<?>>();
    jndiTypes.add(ConnectionFactory.class);
    jndiTypes.add(DataSource.class);
    // TODO: add classes from comma-separated config property for more jndiTypes that get looked up?
    TypeConverterRegistry typeConverterRegistry = camelContext.getTypeConverterRegistry();
    TypeConverter jndiTypeConverter = new JndiTypeConverter(jndiContext);
    for (Class<?> jndiType : jndiTypes) {
      typeConverterRegistry.addTypeConverter(jndiType, String.class, jndiTypeConverter);
    }
    camelContext.addComponent(JBossESBComponent.JBOSSESB, new JBossESBComponent(getConfig()));
    if (logger.isDebugEnabled()) {
      try {
        StringWriter sw = new StringWriter();
        OutputFormat of = OutputFormat.createPrettyPrint();
        of.setSuppressDeclaration(true);
        new XMLWriter(sw, of).write(DocumentHelper.parseText(routesXML));
        logger.debug("adding routes [" + sw.toString().replaceAll("&amp;", "&") + "]");
      } catch (Exception e) {
        logger.warn("problem pretty-printing routes: " + e.getMessage());
        logger.debug("adding routes [" + routesXML.replaceAll("&amp;", "&") + "]");
      }
    }
    try {
      JAXBContext jaxbContext = JAXBContext.newInstance(Constants.JAXB_CONTEXT_PACKAGES);
      Unmarshaller um = jaxbContext.createUnmarshaller();
      RoutesDefinition rd = (RoutesDefinition)um.unmarshal(new StringReader(routesXML));
     
      camelContext.addRouteDefinitions(rd.getRoutes());
    } catch (Exception e) {
      throw new ManagedLifecycleException("problem adding routes", e);
    }
  }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

  @Override
  protected void doStart() throws ManagedLifecycleException {
    try {
      camelContext.start();
    } catch (Exception e) {
      throw new ManagedLifecycleException("problem starting CamelContext", e);
    }
  }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

  @Override
  protected void doStop() throws ManagedLifecycleException {
    try {
      camelContext.stop();
    } catch (Exception e) {
      throw new ManagedLifecycleException("problem stopping CamelContext", e);
    }
  }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

    camelContext = null;
    if (jndiContext != null) {
      try {
        NamingContextPool.releaseNamingContext(jndiContext);
      } catch (NamingContextException nce) {
        throw new ManagedLifecycleException(nce);
      } finally {
        jndiContext = null;
      }
    }
  }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

     */

    @Override
    protected void doInitialise() throws ManagedLifecycleException {
        if (isInitialised()) {
            throw new ManagedLifecycleException("Unexpected request to initialise JBoss Remoting Gateway listener '" + getConfig().getName() + "'.  Gateway already initialised.");
        }

        try {
            endpointReference = new EPR(getJbrServerLocatorURI());
            messageDeliveryAdapter = createDeliveryAdapter();
            initaliseJBRConnectorConfiguration(connectorConfig);

            String protocol = getConfig().getAttribute(JBR_SERVER_PROTOCOL);
            isHttp = (protocol.equals("http") || protocol.equals("https"));
        } catch (ConfigurationException e) {
            throw new ManagedLifecycleException("Remoting Listener configuration failed.", e);
        }

        initialised = true;
    }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

    }

    @Override
    protected void doStart() throws ManagedLifecycleException {
        if (!isInitialised()) {
            throw new ManagedLifecycleException("Unexpected request to start JBoss Remoting Gateway listener '" + getConfig().getName() + "'.  Gateway not initialised.");
        }
        if (isStarted()) {
            throw new ManagedLifecycleException("Unexpected request to start JBoss Remoting Gateway listener '" + getConfig().getName() + "'.  Gateway already started.");
        }

        // Start the JBR Server...
        startJBRServer();
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

    }

    @Override
    protected void doStop() throws ManagedLifecycleException {
        if (!isStarted()) {
            throw new ManagedLifecycleException("Unexpected request to stop JBoss Remoting Gateway listener '" + getConfig().getName() + "'.  Gateway not running.");
        }

        unregisterEndpoint();
        stopJBRServer();
    }
View Full Code Here

Examples of org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException

            if (connector != null)
            {
                connector.stop() ;
            }
            connector = null;
            throw new ManagedLifecycleException("Unable to start Remoting Listener instsance " + getClass().getName(), throwable);
        }
    }
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.