Package org.ofbiz.base.start

Examples of org.ofbiz.base.start.StartupException


        this.configFile = config.containerConfig;
        Collection<ContainerConfig.Container> containers = null;
        try {
            containers = ContainerConfig.getContainers(configFile);
            if (UtilValidate.isEmpty(containers)) {
                throw new StartupException("No containers loaded; problem with configuration");
            }
        } catch (ContainerException e) {
            throw new StartupException(e);
        }
        for (ContainerConfig.Container containerCfg : containers) {
            if (this.unloading) {
                return;
            }
            Container tmpContainer = loadContainer(containerCfg, args);
            this.loadedContainers.add(tmpContainer);
            containerMap.put(containerCfg.name, tmpContainer);

            // TODO: Put container-specific code in the container.
            // This is only used in case of OFBiz running in Geronimo or WASCE. It allows to use the RMIDispatcher
            if (containerCfg.name.equals("rmi-dispatcher") && configFile.equals("limited-containers.xml")) {
                try {
                    ContainerConfig.Container.Property initialCtxProp = containerCfg.getProperty("use-initial-context");
                    String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value;
                    if (!useCtx.equalsIgnoreCase("true")) {
                        //system.setProperty("java.security.policy", "client.policy"); maybe used if needed...
                        if (System.getSecurityManager() == null) { // needed by WASCE with a client.policy file.
                            System.setSecurityManager(new java.rmi.RMISecurityManager());
                        }
                        tmpContainer.start();
                    }
                } catch (ContainerException e) {
                    throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                } catch (java.lang.AbstractMethodError e) {
                    throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                }
            }
        }
        if (this.unloading) {
            return;
        }
        // Get hot-deploy container configuration files
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        Enumeration<URL> resources;
        try {
            resources = loader.getResources("hot-deploy-containers.xml");
            while (resources.hasMoreElements() && !this.unloading) {
                URL xmlUrl = resources.nextElement();
                Debug.logInfo("Loading hot-deploy containers from " + xmlUrl, module);
                Collection<ContainerConfig.Container> hotDeployContainers = ContainerConfig.getContainers(xmlUrl);
                for (ContainerConfig.Container containerCfg : hotDeployContainers) {
                    if (this.unloading) {
                        return;
                    }
                    Container tmpContainer = loadContainer(containerCfg, args);
                    this.loadedContainers.add(tmpContainer);
                    containerMap.put(containerCfg.name, tmpContainer);
                }
            }
        } catch (Exception e) {
            Debug.logError(e, "Could not load hot-deploy-containers.xml", module);
            throw new StartupException(e);
        }
        loaded = true;
    }
View Full Code Here


        }
        Class<?> containerClass = null;
        try {
            containerClass = loader.loadClass(containerCfg.className);
        } catch (ClassNotFoundException e) {
            throw new StartupException("Cannot locate container class", e);
        }
        if (containerClass == null) {
            throw new StartupException("Component container class not loaded");
        }

        // create a new instance of the container object
        Container containerObj = null;
        try {
            containerObj = (Container) containerClass.newInstance();
        } catch (InstantiationException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        } catch (IllegalAccessException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        } catch (ClassCastException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        }

        if (containerObj == null) {
            throw new StartupException("Unable to create instance of component container");
        }

        // initialize the container object
        try {
            containerObj.init(args, configFile);
        } catch (ContainerException e) {
            throw new StartupException("Cannot init() " + containerCfg.name, e);
        } catch (java.lang.AbstractMethodError e) {
            throw new StartupException("Cannot init() " + containerCfg.name, e);
        }

        return containerObj;
    }
View Full Code Here

                return;
            }
            try {
                container.start();
            } catch (ContainerException e) {
                throw new StartupException("Cannot start() " + container.getClass().getName(), e);
            } catch (java.lang.AbstractMethodError e) {
                throw new StartupException("Cannot start() " + container.getClass().getName(), e);
            }
        }
    }
View Full Code Here

        this.configFile = config.containerConfig;
        Collection<ContainerConfig.Container> containers = null;
        try {
            containers = ContainerConfig.getContainers(configFile);
            if (UtilValidate.isEmpty(containers)) {
                throw new StartupException("No containers loaded; problem with configuration");
            }
        } catch (ContainerException e) {
            throw new StartupException(e);
        }
        for (ContainerConfig.Container containerCfg : containers) {
            if (this.unloading) {
                return;
            }
            Container tmpContainer = loadContainer(containerCfg, args);
            this.loadedContainers.add(tmpContainer);
            containerMap.put(containerCfg.name, tmpContainer);

            // TODO: Put container-specific code in the container.
            // This is only used in case of OFBiz running in Geronimo or WASCE. It allows to use the RMIDispatcher
            if (containerCfg.name.equals("rmi-dispatcher") && configFile.equals("limited-containers.xml")) {
                try {
                    ContainerConfig.Container.Property initialCtxProp = containerCfg.getProperty("use-initial-context");
                    String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value;
                    if (!useCtx.equalsIgnoreCase("true")) {
                        //system.setProperty("java.security.policy", "client.policy"); maybe used if needed...
                        if (System.getSecurityManager() == null) { // needed by WASCE with a client.policy file.
                            System.setSecurityManager(new java.rmi.RMISecurityManager());
                        }
                        tmpContainer.start();
                    }
                } catch (ContainerException e) {
                    throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                } catch (java.lang.AbstractMethodError e) {
                    throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                }
            }
        }
        if (this.unloading) {
            return;
        }
        // Get hot-deploy container configuration files
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        Enumeration<URL> resources;
        try {
            resources = loader.getResources("hot-deploy-containers.xml");
            while (resources.hasMoreElements() && !this.unloading) {
                URL xmlUrl = resources.nextElement();
                Debug.logInfo("Loading hot-deploy containers from " + xmlUrl, module);
                Collection<ContainerConfig.Container> hotDeployContainers = ContainerConfig.getContainers(xmlUrl);
                for (ContainerConfig.Container containerCfg : hotDeployContainers) {
                    if (this.unloading) {
                        return;
                    }
                    Container tmpContainer = loadContainer(containerCfg, args);
                    this.loadedContainers.add(tmpContainer);
                    containerMap.put(containerCfg.name, tmpContainer);
                }
            }
        } catch (Exception e) {
            Debug.logError(e, "Could not load hot-deploy-containers.xml", module);
            throw new StartupException(e);
        }
        loaded = true;
    }
View Full Code Here

        }
        Class<?> containerClass = null;
        try {
            containerClass = loader.loadClass(containerCfg.className);
        } catch (ClassNotFoundException e) {
            throw new StartupException("Cannot locate container class", e);
        }
        if (containerClass == null) {
            throw new StartupException("Component container class not loaded");
        }

        // create a new instance of the container object
        Container containerObj = null;
        try {
            containerObj = (Container) containerClass.newInstance();
        } catch (InstantiationException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        } catch (IllegalAccessException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        } catch (ClassCastException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        }

        if (containerObj == null) {
            throw new StartupException("Unable to create instance of component container");
        }

        // initialize the container object
        try {
            containerObj.init(args, configFile);
        } catch (ContainerException e) {
            throw new StartupException("Cannot init() " + containerCfg.name, e);
        } catch (java.lang.AbstractMethodError e) {
            throw new StartupException("Cannot init() " + containerCfg.name, e);
        }

        return containerObj;
    }
View Full Code Here

                return;
            }
            try {
                container.start();
            } catch (ContainerException e) {
                throw new StartupException("Cannot start() " + container.getClass().getName(), e);
            } catch (java.lang.AbstractMethodError e) {
                throw new StartupException("Cannot start() " + container.getClass().getName(), e);
            }
        }
    }
View Full Code Here

        Collection<ContainerConfig.Container> containers = null;
        try {
            containers = ContainerConfig.getContainers(configFile);
        } catch (ContainerException e) {
            throw new StartupException(e);
        }

        if (containers != null) {
            for (ContainerConfig.Container containerCfg: containers) {
                Container tmpContainer = loadContainer(containerCfg, args);
                loadedContainers.add(tmpContainer);

                // This is only used in case of OFBiz running in Geronimo or WASCE. It allows to use the RMIDispatcher
                if (containerCfg.name.equals("rmi-dispatcher") && configFile.equals("limited-containers.xml")) {
                    try {
                        ContainerConfig.Container.Property initialCtxProp = containerCfg.getProperty("use-initial-context");
                        String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value;
                        if (!useCtx.equalsIgnoreCase("true")) {
                            //system.setProperty("java.security.policy", "client.policy"); maybe used if needed...
                            if (System.getSecurityManager() == null) { // needed by WASCE with a client.policy file.
                                System.setSecurityManager(new java.rmi.RMISecurityManager());
                            }
                            tmpContainer.start();
                            rmiLoadedContainer = tmpContainer; // used in Geronimo/WASCE to allow to deregister
                        }
                    } catch (ContainerException e) {
                        throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                    } catch (java.lang.AbstractMethodError e) {
                        throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                    }
                }
            }
        }
    }
View Full Code Here

        // start each container object
        for (Container container: loadedContainers) {
            try {
                container.start();
            } catch (ContainerException e) {
                throw new StartupException("Cannot start() " + container.getClass().getName(), e);
            } catch (java.lang.AbstractMethodError e) {
                throw new StartupException("Cannot start() " + container.getClass().getName(), e);
            }
        }
    }
View Full Code Here

        }
        Class containerClass = null;
        try {
            containerClass = loader.loadClass(containerCfg.className);
        } catch (ClassNotFoundException e) {
            throw new StartupException("Cannot locate container class", e);
        }
        if (containerClass == null) {
            throw new StartupException("Component container class not loaded");
        }

        // create a new instance of the container object
        Container containerObj = null;
        try {
            containerObj = (Container) containerClass.newInstance();
        } catch (InstantiationException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        } catch (IllegalAccessException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        } catch (ClassCastException e) {
            throw new StartupException("Cannot create " + containerCfg.name, e);
        }

        if (containerObj == null) {
            throw new StartupException("Unable to create instance of component container");
        }

        // initialize the container object
        try {
            containerObj.init(args, configFile);
        } catch (ContainerException e) {
            throw new StartupException("Cannot init() " + containerCfg.name, e);
        } catch (java.lang.AbstractMethodError e) {
            throw new StartupException("Cannot init() " + containerCfg.name, e);
        }

        return containerObj;
    }
View Full Code Here

        this.configFile = config.containerConfig;
        Collection<ContainerConfig.Container> containers = null;
        try {
            containers = ContainerConfig.getContainers(configFile);
            if (UtilValidate.isEmpty(containers)) {
                throw new StartupException("No containers loaded; problem with configuration");
            }
        } catch (ContainerException e) {
            throw new StartupException(e);
        }
        for (ContainerConfig.Container containerCfg : containers) {
            if (this.unloading) {
                return;
            }
            Container tmpContainer = loadContainer(containerCfg, args);
            this.loadedContainers.add(tmpContainer);
            containerMap.put(containerCfg.name, tmpContainer);

            // TODO: Put container-specific code in the container.
            // This is only used in case of OFBiz running in Geronimo or WASCE. It allows to use the RMIDispatcher
            if (containerCfg.name.equals("rmi-dispatcher") && configFile.equals("limited-containers.xml")) {
                try {
                    ContainerConfig.Container.Property initialCtxProp = containerCfg.getProperty("use-initial-context");
                    String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value;
                    if (!useCtx.equalsIgnoreCase("true")) {
                        //system.setProperty("java.security.policy", "client.policy"); maybe used if needed...
                        if (System.getSecurityManager() == null) { // needed by WASCE with a client.policy file.
                            System.setSecurityManager(new java.rmi.RMISecurityManager());
                        }
                        tmpContainer.start();
                    }
                } catch (ContainerException e) {
                    throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                } catch (java.lang.AbstractMethodError e) {
                    throw new StartupException("Cannot start() " + tmpContainer.getClass().getName(), e);
                }
            }
        }
        if (this.unloading) {
            return;
        }
        // Get hot-deploy container configuration files
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        Enumeration<URL> resources;
        try {
            resources = loader.getResources("hot-deploy-containers.xml");
            while (resources.hasMoreElements() && !this.unloading) {
                URL xmlUrl = resources.nextElement();
                Debug.logInfo("Loading hot-deploy containers from " + xmlUrl, module);
                Collection<ContainerConfig.Container> hotDeployContainers = ContainerConfig.getContainers(xmlUrl);
                for (ContainerConfig.Container containerCfg : hotDeployContainers) {
                    if (this.unloading) {
                        return;
                    }
                    Container tmpContainer = loadContainer(containerCfg, args);
                    this.loadedContainers.add(tmpContainer);
                    containerMap.put(containerCfg.name, tmpContainer);
                }
            }
        } catch (Exception e) {
            Debug.logError(e, "Could not load hot-deploy-containers.xml", module);
            throw new StartupException(e);
        }
        loaded = true;
    }
View Full Code Here

TOP

Related Classes of org.ofbiz.base.start.StartupException

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.