Package org.apache.catalina.core

Examples of org.apache.catalina.core.StandardServer


            host.addChild(context);
            host.fireContainerEvent(INSTALL_EVENT, context);

            // save context info into configFile
            Engine engine = (Engine)host.getParent();
            StandardServer server = (StandardServer) engine.getService().getServer();
            server.storeContext(context);
        } catch (Exception e) {
            log.error(sm.getString("standardHost.installError", contextPath),
                      e);
            throw new IOException(e.toString());
        }
View Full Code Here


     *  that prevents it from being started
     */
    public synchronized void start() throws LifecycleException {

        try {
            StandardServer server = (StandardServer) ServerFactory.getServer();
            Context context = server.getGlobalNamingContext();
            database = (UserDatabase) context.lookup(resourceName);
        } catch (Throwable e) {
            e.printStackTrace();
            log(sm.getString("userDatabaseRealm.lookup", resourceName), e);
            database = null;
View Full Code Here

     * @return Connection to the database
     */
    private Connection open() {

        try {
            StandardServer server = (StandardServer) ServerFactory.getServer();
            Context context = server.getGlobalNamingContext();
            DataSource dataSource = (DataSource)context.lookup(dataSourceName);
            return dataSource.getConnection();
        } catch (Exception e) {
            // Log the problem for posterity
            log(sm.getString("dataSourceRealm.exception"), e);
View Full Code Here

            Context context = null;
            if (localDataSource) {
                context = ContextBindings.getClassLoader();
                context = (Context) context.lookup("comp/env");
            } else {
                StandardServer server =
                    (StandardServer) ServerFactory.getServer();
                context = server.getGlobalNamingContext();
            }
            DataSource dataSource = (DataSource)context.lookup(dataSourceName);
      return dataSource.getConnection();
        } catch (Exception e) {
            // Log the problem for posterity
View Full Code Here

     */
    public TomcatWebAppBuilder() {
     
      // TODO: re-write this bit, so this becomes part of the listener, and we register this with the mbean server.
     
        StandardServer standardServer = TomcatHelper.getServer();
        globalListenerSupport = new GlobalListenerSupport(standardServer, this);

        // could search mbeans
       
        //Getting host config listeners
        for (Service service : standardServer.findServices()) {
            if (service.getContainer() instanceof Engine) {
                Engine engine = (Engine) service.getContainer();
                for (Container engineChild : engine.findChildren()) {
                    if (engineChild instanceof StandardHost) {
                        StandardHost host = (StandardHost) engineChild;
View Full Code Here

        ejbServerProps.putAll(properties);
        ejbServerProps.setProperty("openejb.ejbd.uri", "http://127.0.0.1:8080/openejb/ejb");
        ejbServer.init(ejbServerProps);

        // Add our naming context listener to the server which registers all Tomcat resources with OpenEJB
        StandardServer standardServer = TomcatHelper.getServer();
        OpenEJBNamingContextListener namingContextListener = new OpenEJBNamingContextListener(standardServer);
        // Standard server has no state property, so we check global naming context to determine if server is started yet
        if (standardServer.getGlobalNamingContext() != null) {
            namingContextListener.start();
        }
        standardServer.addLifecycleListener(namingContextListener);

        // Process all applications already started.  This deploys EJBs, PersistenceUnits
        // and modifies JNDI ENC references to OpenEJB managed objects such as EJBs.
        processRunningApplications(tomcatWebAppBuilder, standardServer);

        if (Boolean.getBoolean("openejb.servicemanager.enabled")) {
            manager = ServiceManager.getManager();
            manager.init();
            manager.start(false);
        } else {
            // WS
            try {
                ServerService cxfService = (ServerService) Class.forName("org.apache.openejb.server.cxf.CxfService").newInstance();
                cxfService.start();
                services.add(cxfService);
            } catch (ClassNotFoundException ignored) {
            } catch (Exception e) {
                Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, getClass());
                logger.error("Webservices failed to start", e);
            }

            // REST
            try {
                ServerService restService = (ServerService) Class.forName("org.apache.openejb.server.cxf.rs.CxfRSService").newInstance();
                restService.start();
                services.add(restService);
            } catch (ClassNotFoundException ignored) {
            } catch (Exception e) {
                logger.error("REST failed to start", e);
            }
        }

        standardServer.addLifecycleListener(new LifecycleListener() {
            public void lifecycleEvent(LifecycleEvent event) {
                String type = event.getType();
                if (Lifecycle.AFTER_STOP_EVENT.equals(type)) {
                    TomcatLoader.this.destroy();
                }
View Full Code Here

  public static void setStopping(boolean stopping) {
    TomcatHelper.stopping = stopping;
  }

  public static StandardServer getServer() {
    StandardServer server = null;

        Class<?> systemInstanceClass = null;
        try {
            // server = SystemInstance.get().getComponent(StandardServer.class)
            systemInstanceClass = Thread.currentThread().getContextClassLoader().loadClass("org.apache.openejb.loader.SystemInstance");
View Full Code Here

            String type = event.getType();
            if (Lifecycle.PERIODIC_EVENT.equals(type)) {
                contextListener.checkHost(standardHost);
            }
        } else if (source instanceof StandardServer) {
            StandardServer standardServer = (StandardServer) source;
            String type = event.getType();

            if (Lifecycle.BEFORE_STOP_EVENT.equals(type)) {
              TomcatHelper.setStopping(true);
            }
View Full Code Here

    /**
     * Return the singleton <code>Server</code> instance for this JVM.
     */
    public static Server getServer() {
        if( server==null )
            server=new StandardServer();
        return (server);

    }
View Full Code Here

            Context context = null;
            if (localDataSource) {
                context = ContextBindings.getClassLoader();
                context = (Context) context.lookup("comp/env");
            } else {
                StandardServer server =
                    (StandardServer) ServerFactory.getServer();
                context = server.getGlobalNamingContext();
            }
            DataSource dataSource = (DataSource)context.lookup(dataSourceName);
      return dataSource.getConnection();
        } catch (Exception e) {
            // Log the problem for posterity
View Full Code Here

TOP

Related Classes of org.apache.catalina.core.StandardServer

Copyright © 2018 www.massapicom. 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.