Examples of DeployerException


Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

                List<URL> urls = new ArrayList<URL>();
                for (EJB21Deployable ejb21Deployable : ejbs) {
                    try {
                        urls.add(ejb21Deployable.getArchive().getURL());
                    } catch (ArchiveException e) {
                        throw new DeployerException("Cannot get the URL for the archive '" + ejb21Deployable.getArchive()
                                + "'", e);
                    }
                }


                // Get classpath of the EJBs
                URL[] compilationURLs = null;

                // content of the ear loader (application wide resources)
                URL[] myApplicationJars = earClassLoader.getURLs();

                // content of the apps loader (system wide resources)
                URL[] appsJars = ((URLClassLoader) earClassLoader.getParent()).getURLs();

                // merge the 3 Set of URLs
                compilationURLs = new URL[myApplicationJars.length + appsJars.length + urls.size()];
                System.arraycopy(urls.toArray(new URL[urls.size()]), 0, compilationURLs, 0, urls.size());
                System.arraycopy(appsJars, 0, compilationURLs, urls.size(), appsJars.length);
                System.arraycopy(myApplicationJars, 0, compilationURLs, urls.size() + appsJars.length, myApplicationJars.length);

                // Call automatic GenIC on the URLs of the EJB 2.1
                if (this.checkGenICMethod != null) {
                    for (EJB21Deployable ejb : ejbs) {
                        URL ejbURL = null;
                        try {
                            ejbURL = ejb.getArchive().getURL();
                        } catch (ArchiveException e) {
                            throw new DeployerException("Cannot get the URL on the deployable '" + ejb + "'", e);
                        }
                        logger.debug("Calling GenIC on the EJB ''{0}'' with compilation URL ''{1}''.", ejbURL, Arrays
                                .asList(compilationURLs));
                        invoke(this.checkGenICMethod, this.ejb21Service, ejbURL.getFile(), compilationURLs);
                    }
                }


                // Deploy EJB 2.1 on JOnAS service
                Context ctx = new ContextImpl(earURL.toExternalForm());
                try {
                    ctx.rebind("earUrl", earURL);
                    ctx.rebind("earRootUrl", earURL);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the EAR URL parameter '" + earURL + "'", e);
                }

                try {
                    ctx.rebind("jarURLs", urls.toArray(new URL[urls.size()]));
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the urls parameter '" + urls + "'", e);
                }
                try {
                    ctx.rebind("earClassLoader", earClassLoader);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the earClassLoader parameter '" + earClassLoader + "'", e);
                }

                // Bind the EJB classloader
                try {
                    ctx.rebind("ejbClassLoader", ejbClassLoader);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the ejbClassLoader parameter '" + ejbClassLoader + "'", e);
                }

                // Role names
                try {
                    ctx.rebind("roleNames", new String[0]);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the altDDs parameter.'", e);
                }

                try {
                    this.deployMethodejb21Service.invoke(this.ejb21Service, ctx);
                } catch (IllegalArgumentException e) {
                    throw new DeployerException("Cannot deploy the EJB 2.1'", e);
                } catch (IllegalAccessException e) {
                    throw new DeployerException("Cannot deploy the EJB 2.1'", e);
                } catch (InvocationTargetException e) {
                    throw new DeployerException("Cannot deploy the EJB 2.1'", e.getTargetException());
                }
            }
        }

    }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

     * @param deployable the deployable that needs to be deployed
     * @throws DeployerException if this deployable is not supported.
     */
    private void checkSupportedDeployable(final IDeployable deployable) throws DeployerException {
        if (!(deployable instanceof EARDeployable || deployable instanceof EJBDeployable)) {
            throw new DeployerException("The deployable '" + deployable + "' is not supported by this deployer");
        }
    }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

                        toBeLinkedPC.linkConfiguration(linkedPC);
                    }
                }
            }
        } catch (PolicyContextException pce) {
            throw new DeployerException("Cannot retrieve a policy configuration", pce);
        }

    }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

        if (ejbDeployables != null) {
            for (EJBDeployable ejbDeployable : ejbDeployables) {
                try {
                    urls.add(ejbDeployable.getArchive().getURL());
                } catch (ArchiveException e) {
                    throw new DeployerException("Cannot get URL on the deployable '" + ejbDeployable + "'.", e);
                }
            }
        }

        URL[] jarUrls = urls.toArray(new URL[urls.size()]);

        // Get contextID of EJB
        for (int u = 0; u < jarUrls.length; u++) {
            String ctxId = jarUrls[u].getPath();
            // reset the policy configuration associated to this context ID.
            if (resetPolicyConfiguration) {
                try {
                    getPolicyConfigurationFactory().getPolicyConfiguration(ctxId, true);
                } catch (PolicyContextException pce) {
                    throw new DeployerException("Cannot retrieve a policy configuration", pce);
                }
            }
            contextIDs.add(ctxId);
        }
    }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

            for (WARDeployable warDeployable : warDeployables) {
                URL warURL = null;
                try {
                    warURL = warDeployable.getArchive().getURL();
                } catch (ArchiveException e) {
                    throw new DeployerException("Cannot get URL on the deployable '" + warDeployable + "'.", e);
                }

                // build context ID of war
                String ctxId = warURL.getFile() + warDeployable.getContextRoot();
                // reset the policy configuration associated to this context ID.
                if (resetPolicyConfiguration) {
                    try {
                        getPolicyConfigurationFactory().getPolicyConfiguration(ctxId, true);
                    } catch (PolicyContextException pce) {
                        throw new DeployerException("Cannot retrieve a policy configuration", pce);
                    }
                }
                contextIDs.add(ctxId);
            }
        }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

    private PolicyConfigurationFactory getPolicyConfigurationFactory() throws DeployerException {
        PolicyConfigurationFactory pcFactory = null;
        try {
            pcFactory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
        } catch (Exception cnfe) {
            throw new DeployerException("Cannot retrieve current policy configuration factory", cnfe);
        }
        return pcFactory;
    }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

                ctxId = (String) itCtxId.next();
                PolicyConfiguration pc = getPolicyConfigurationFactory().getPolicyConfiguration(ctxId, false);
                pc.commit();
            }
        } catch (PolicyContextException pce) {
            throw new DeployerException("Cannot commit policy configuration with Id '" + ctxId + "'", pce);
        }

        // refresh policy
        Policy.getPolicy().refresh();
    }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

            // Resolve container
            try {
                container.resolve();
            } catch (EZBContainerException e) {
                throw new DeployerException("Cannot resolve the container '" + container.getArchive() + "'.", e);
            }
        }

        // Start containers
        for (EZBContainer container : containers) {
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

     * @param deployable the deployable that needs to be deployed
     * @throws DeployerException if this deployable is not supported.
     */
    private void checkSupportedDeployable(final IDeployable deployable) throws DeployerException {
        if (!(deployable instanceof EARDeployable || deployable instanceof EJBDeployable)) {
            throw new DeployerException("The deployable '" + deployable + "' is not supported by this deployer");
        }
    }
View Full Code Here

Examples of org.ow2.util.ee.deploy.api.deployer.DeployerException

    public JettyDeployer() throws DeployerException {
        super();

        // Check if this deployer has been initialized correctly
        if (jettyServer == null) {
            throw new DeployerException("This deployer has not be initialized correctly as the Jetty server is null");
        }

        // Load the class
        this.webAppContextClass = loadClass(WEB_APP_CONTEXT_CLASS_NAME, getClassLoader());

        // get Handler collection from jetty
        Method getChildHandlerByClassMethod = getMethod(jettyServer.getClass(), GET_CHILD_HANDLER_METHOD_NAME, Class.class);
        Class handlerCollectionClass = loadClass(HANDLER_COLLECTION_CLASS_NAME, getClassLoader());
        Object handlerCollection = invoke(getChildHandlerByClassMethod, jettyServer, handlerCollectionClass);
        if (handlerCollection == null) {
            throw new DeployerException("No handler collection has been defined on the jetty server object '" + jettyServer
                    + "'.");
        }
        this.contexts = invoke(getChildHandlerByClassMethod, handlerCollection, handlerCollectionClass);

        // add/remove/get Handler method
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.