Package org.apache.geronimo.common

Examples of org.apache.geronimo.common.DeploymentException


        } catch (OpenEJBException e) {
            Throwable t = e.getCause();
            if (t instanceof UnknownModuleTypeException || t instanceof UnsupportedModuleTypeException) {
                return null;
            }
            throw new DeploymentException(e);
        }

        // did we find a ejb jar?
        if (appModule.getEjbModules().size() == 0) {
            return null;
        }

        // get the module
        org.apache.openejb.config.EjbModule ejbModule = appModule.getEjbModules().get(0);

        // add the ejb-jar.xml altDD plan
        if (specDDUrl != null) {
            ejbModule.setEjbJar(null);
            ejbModule.getAltDDs().put("ejb-jar.xml", specDDUrl);
        }

        // convert the vendor plan object to the ejbModule altDD map
        XmlObject unknownXmlObject = null;
        if (plan instanceof XmlObject) {
            unknownXmlObject = (XmlObject) plan;
        } else if (plan != null) {
            try {
                unknownXmlObject = XmlBeansUtil.parse(((File) plan).toURL(), XmlUtil.class.getClassLoader());
            } catch (Exception e) {
                throw new DeploymentException(e);
            }
        }

        if (unknownXmlObject != null) {
            XmlCursor xmlCursor = unknownXmlObject.newCursor();
            //
            QName qname = xmlCursor.getName();
            if (qname == null) {
                xmlCursor.toFirstChild();
                qname = xmlCursor.getName();
            }
            if (qname.getLocalPart().equals("openejb-jar")) {
                ejbModule.getAltDDs().put("openejb-jar.xml", xmlCursor.xmlText());
            } else if (qname.getLocalPart().equals("ejb-jar") && qname.getNamespaceURI().equals("http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0")) {
                ejbModule.getAltDDs().put("geronimo-openejb.xml", xmlCursor.xmlText());
            }
        }

        // Read in the deploument desiptor files
        ReadDescriptors readDescriptors = new ReadDescriptors();
        try {
            readDescriptors.deploy(appModule);
        } catch (OpenEJBException e) {
            throw new DeploymentException("Failed parsing descriptors for module: " + moduleFile.getName(), e);
        }

        // Get the geronimo-openejb.xml tree
        boolean standAlone = earEnvironment == null;
        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getAltDDs().get("geronimo-openejb.xml");
View Full Code Here


        JarFile moduleFile = module.getModuleFile();
        try {
            // extract the ejbJar file into a standalone packed jar file and add the contents to the output
            earContext.addIncludeAsPackedJar(URI.create(module.getTargetPath()), moduleFile);
        } catch (IOException e) {
            throw new DeploymentException("Unable to copy ejb module jar into configuration: " + moduleFile.getName(), e);
        }
    }
View Full Code Here

                for (ValidationFailure e : set.getFailures()) {
                    sb.append(e.getPrefix()).append(" ... ").append(e.getComponentName()).append(":\t").append(e.getMessage(2));
                }

                throw new DeploymentException(sb.toString());
            } catch (OpenEJBException e) {
                throw new DeploymentException(e);
            }

            // add all of the modules to the ear data
            for (EjbJarInfo ejbJar : appInfo.ejbJars) {
                earData.addEjbJar(ejbJar);
            }

            // add the cmp jar
            CmpJarBuilder cmp2Builder = new CmpJarBuilder(appInfo, classLoader);
            try {
                File generatedJar = cmp2Builder.getJarFile();
                if (generatedJar != null) {
                    String generatedPath = ejbModule.getTargetPath();
                    if (generatedPath.endsWith(".jar")) {
                        generatedPath = generatedPath.substring(0, generatedPath.length() - 4);
                    }
                    generatedPath += "-cmp2.jar";
                    earContext.addInclude(URI.create(generatedPath), generatedJar);
                }
            } catch (IOException e) {
                throw new DeploymentException(e);
            }

            // add the cmp persistence unit if needed
            if (appInfo.cmpMappingsXml != null) {
                addGeronimmoOpenEJBPersistenceUnit(ejbModule);
View Full Code Here

                                          ejbModule.getSharedContext(), cl)) {

                try {
                    earContext.addGBean(ejbWebServiceGBean);
                } catch (GBeanAlreadyExistsException e) {
                    throw new DeploymentException(
                            "Could not add ejb web service gbean to context",
                            e);
                }
               
                if (this.listener != null) {
View Full Code Here

            ejbModuleGBeanData.setReferencePattern("OpenEjbSystem", new AbstractNameQuery(null, Collections.EMPTY_MAP, OpenEjbSystem.class.getName()));
            ejbModuleGBeanData.setAttribute("ejbJarInfo", ejbModule.getEjbJarInfo());

            earContext.addGBean(ejbModuleGBeanData);
        } catch (Exception e) {
            throw new DeploymentException("Unable to initialize EJBModule GBean " + ejbModuleGBeanData.getAbstractName(), e);
        }

        // add a depdendency on the ejb module object
        ejbDeploymentBuilder.addEjbModuleDependency(ejbModuleGBeanData.getAbstractName());
View Full Code Here

                // containerId already set
                continue;
            }

            if (bean.getResourceAdapter() == null) {
                throw new DeploymentException("No Resource Adapter defined for MDB '" + bean.getEjbName() + "'");
            }

            AbstractNameQuery resourceAdapterNameQuery = getResourceAdapterNameQuery(bean.getResourceAdapter());
            AbstractName resourceAdapterAbstractName;
            try {
                resourceAdapterAbstractName = earContext.findGBean(resourceAdapterNameQuery);
            } catch (GBeanNotFoundException e) {
                throw new DeploymentException("Resource Adapter for MDB '" + bean.getEjbName() + "'not found: " + resourceAdapterNameQuery, e);
            }

            String resourceAdapterId = getResourceAdapterId(resourceAdapterAbstractName);
            messageDrivenBeanInfo.containerId = resourceAdapterId + "-" + messageDrivenBeanInfo.mdbInterface;
View Full Code Here

                for (URL url: files) {
                    String path = toFileName(url);
                    classpath.append(path).append(File.pathSeparator);
                }
            } catch (MalformedURLException e) {
                throw new DeploymentException("Could not resolve pattern: " + pattern, e);
            } catch (NoSuchConfigException e) {
                throw new DeploymentException("Could not resolve pattern: " + pattern, e);
            }
        }
    }
View Full Code Here

        File baseDir;
       
        try {
            baseDir = createTempDirectory(moduleBaseDir);
        } catch (IOException e) {
            throw new DeploymentException(e);
        }

        URL[] urls;
        StringBuilder classPath = new StringBuilder();
        //let's figure out the classpath for wsgen tools
        try {
             urls = getWsgenClasspath(context);
        } catch (Exception e) {
            throw new DeploymentException("Failed to generate the wsdl file using wsgen: unable to get the location of the required artifact(s).", e);
        }
        //let's figure out the classpath string for the module and wsgen tools.
        if (urls != null && urls.length > 0) {
            for (URL url : urls) {
                classPath.append(toFile(url).getAbsolutePath()).append(File.pathSeparator);
            }
        }
        getModuleClasspath(module, context, classPath);

        //create arguments;
        String[] arguments = buildArguments(serviceClass, classPath.toString(), baseDir, portInfo);
       
        try {
            boolean result = false;
           
            if (this.forkWsgen) {
                result = forkWsgen(classPath, arguments);
            } else {
                result = invokeWsgen(urls, arguments);
            }
           
            if (result) {
                //check to see if the file is created.
                File wsdlFile = findWsdlFile(baseDir, portInfo);
                if (wsdlFile == null) {
                    throw new DeploymentException("Unable to find the service wsdl file");
                }
                return getRelativeNameOrURL(moduleBase, wsdlFile);
            } else {
                throw new DeploymentException("wsgen failed");
            }           
                                
        } catch (DeploymentException e) {
            throw e;
        } catch (Exception e) {
            throw new DeploymentException("Unable to generate the wsdl file using wsgen.", e);
        }
    }
View Full Code Here

                try {
                    Thread.sleep(FORK_POLL_FREQUENCY);
                } catch (InterruptedException ee) {
                    // interrupted
                    process.destroy();
                    throw new DeploymentException("wsgen interrupted");
                }
                sleepTime += FORK_POLL_FREQUENCY;
            }
        }
       
        // timeout;
        process.destroy();     
        throw new DeploymentException("wsgen timed out");
    }
View Full Code Here

    private Map<String, PortInfo> discoverWebServices(Module module,
                                                      boolean isEJB,
                                                      Map correctedPortLocations)
            throws DeploymentException {
        if (this.webServiceFinder == null) {
            throw new DeploymentException("WebServiceFinder not configured");
        }
        return this.webServiceFinder.discoverWebServices(module, isEJB, correctedPortLocations);
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.common.DeploymentException

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.