Package org.jboss.as.deployment.unit

Examples of org.jboss.as.deployment.unit.DeploymentUnitProcessingException


                 targetContextName = contextNameSuffix;
            } else if(injectionType.isAnnotationPresent(ManagedBean.class)) {
                final ManagedBean managedBean = injectionType.getAnnotation(ManagedBean.class);
                 targetContextName = managedBean.value().isEmpty() ? injectionType.getName() : managedBean.value();
            } else {
                throw new DeploymentUnitProcessingException("Unable to determine mapped name for @Resource injection.");
            }
        }
        return targetContextName;
    }
View Full Code Here


        if(managedBeanConfigurations == null) {
            return; // Skip deployments with no managed beans.
        }
        final ModuleContextConfig moduleContext = context.getAttachment(ModuleContextConfig.ATTACHMENT_KEY);
        if(moduleContext == null) {
            throw new DeploymentUnitProcessingException("Unable to deploy managed beans without a module naming context");
        }

        final BatchBuilder batchBuilder = context.getBatchBuilder();

        final Module module = context.getAttachment(ModuleDeploymentProcessor.MODULE_ATTACHMENT_KEY);
View Full Code Here

        final LinkRef linkRef = new LinkRef(targetContextName.startsWith("java") ? targetContextName : moduleContext.getContextName().append(targetContextName).getAbsoluteName());
        final boolean shouldBind;
        try {
            shouldBind = getNamespaceBindings(deploymentContext).addBinding(localContextName, linkRef);
        } catch (DuplicateBindingException e) {
            throw new DeploymentUnitProcessingException("Unable to process managed bean resource.", e);
        }
        if(shouldBind) {
            final ResourceBinder<LinkRef> resourceBinder = new ResourceBinder<LinkRef>(localContextName, Values.immediateValue(linkRef));

            final BatchServiceBuilder<Object> binderServiceBuilder = batchBuilder.addService(binderName, resourceBinder);
View Full Code Here

            int otherPos = -1;
            int i = 0;
            for (OrderingElementMetaData orderingElementMetaData : absoluteOrderingMetaData.getOrdering()) {
                if (orderingElementMetaData.isOthers()) {
                    if (otherPos >= 0) {
                        throw new DeploymentUnitProcessingException("Duplicate others in absolute ordering");
                    }
                    otherPos = i;
                } else {
                    boolean found = false;
                    for (WebOrdering ordering : orderings) {
                        if (orderingElementMetaData.getName().equals(ordering.getName())) {
                            order.add(ordering.getJar());
                            jarsSet.remove(ordering.getJar());
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                        throw new DeploymentUnitProcessingException("Could not resolve name in absolute ordering: "
                                + orderingElementMetaData.getName());
                }
                i++;
            }
            if (otherPos >= 0) {
                order.addAll(otherPos, jarsSet);
                jarsSet.clear();
            }
        } else if (orderings.size() > 0) {
            // Resolve relative ordering
            try {
                resolveOrder(orderings, order);
            } catch (IllegalStateException e) {
                throw new DeploymentUnitProcessingException("Invalid ordering", e);
            }
            jarsSet.clear();
        } else {
            // No order specified
            order.addAll(jarsSet);
            jarsSet.clear();
            warMetaData.setNoOrder(true);
        }

        Logger log = Logger.getLogger("org.jboss.web");
        if (log.isDebugEnabled()) {
            StringBuilder builder = new StringBuilder();
            builder.append("Resolved order: [ ");
            for (String jar : order) {
                builder.append(jar).append(' ');
            }
            builder.append(']');
            log.debug(builder.toString());
        }

        warMetaData.setOrder(order);
        warMetaData.setOverlays(overlays);
        warMetaData.setScis(scis);

        Map<String, WebMetaData> annotationsMetaData = warMetaData.getAnnotationsMetaData();

        // The fragments and corresponding annotations will need to be merged in
        // order
        // For each JAR in the order:
        // - Merge the annotation metadata into the fragment meta data
        // (unless the fragment exists and is meta data complete)
        // - Merge the fragment metadata into merged fragment meta data
        WebCommonMetaData mergedFragmentMetaData = new WebCommonMetaData();
        if (specMetaData == null) {
            // If there is no web.xml, it has to be considered to be the latest version
            specMetaData = new Web30MetaData();
            specMetaData.setVersion("3.0");
        }
        // Augment with meta data from annotations in /WEB-INF/classes
        WebMetaData classesAnnotatedMetaData = annotationsMetaData.get("");
        if (classesAnnotatedMetaData != null) {
            if (isComplete) {
                // Discard @WebFilter, @WebListener and @WebServlet
                classesAnnotatedMetaData.setFilters(null);
                classesAnnotatedMetaData.setFilterMappings(null);
                classesAnnotatedMetaData.setListeners(null);
                classesAnnotatedMetaData.setServlets(null);
                classesAnnotatedMetaData.setServletMappings(null);
            }
            specMetaData.augment(classesAnnotatedMetaData, null, true);
        }
        // Augment with meta data from fragments and annotations from the
        // corresponding JAR
        for (String jar : order) {
            WebFragmentMetaData webFragmentMetaData = webFragments.get(jar);
            if (webFragmentMetaData == null) {
                webFragmentMetaData = new WebFragmentMetaData();
                // Add non overriding default distributable flag
                webFragmentMetaData.setDistributable(new EmptyMetaData());
            }
            WebMetaData jarAnnotatedMetaData = annotationsMetaData.get(jar);
            if ((isComplete || webFragmentMetaData.isMetadataComplete()) && jarAnnotatedMetaData != null) {
                // Discard @WebFilter, @WebListener and @WebServlet
                jarAnnotatedMetaData.setFilters(null);
                jarAnnotatedMetaData.setFilterMappings(null);
                jarAnnotatedMetaData.setListeners(null);
                jarAnnotatedMetaData.setServlets(null);
                jarAnnotatedMetaData.setServletMappings(null);
            }
            if (jarAnnotatedMetaData != null) {
                // Merge annotations corresponding to the JAR
                webFragmentMetaData.augment(jarAnnotatedMetaData, null, true);
            }
            // Merge fragment meta data according to the conflict rules
            try {
                mergedFragmentMetaData.augment(webFragmentMetaData, specMetaData, false);
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException("Deployment error processing fragment for JAR: " + jar, e);
            }
        }
        // Augment with meta data from annotations from JARs excluded from the
        // order
        for (String jar : jarsSet) {
            WebFragmentMetaData webFragmentMetaData = new WebFragmentMetaData();
            // Add non overriding default distributable flag
            webFragmentMetaData.setDistributable(new EmptyMetaData());
            WebMetaData jarAnnotatedMetaData = annotationsMetaData.get(jar);
            if (jarAnnotatedMetaData != null) {
                // Discard @WebFilter, @WebListener and @WebServlet
                jarAnnotatedMetaData.setFilters(null);
                jarAnnotatedMetaData.setFilterMappings(null);
                jarAnnotatedMetaData.setListeners(null);
                jarAnnotatedMetaData.setServlets(null);
                jarAnnotatedMetaData.setServletMappings(null);
            }
            if (jarAnnotatedMetaData != null) {
                // Merge annotations corresponding to the JAR
                webFragmentMetaData.augment(jarAnnotatedMetaData, null, true);
            }
            // Merge fragment meta data according to the conflict rules
            try {
                mergedFragmentMetaData.augment(webFragmentMetaData, specMetaData, false);
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException("Deployment error processing fragment for JAR: " + jar, e);
            }
        }
        specMetaData.augment(mergedFragmentMetaData, null, true);

        // Override with meta data (JBossWebMetaData)
View Full Code Here

    protected void processDeployment(final String hostName, final WarMetaData warMetaData, final DeploymentUnitContext context) throws DeploymentUnitProcessingException {
        final VirtualFile deploymentRoot = VirtualFileAttachment.getVirtualFileAttachment(context);
        final Module module = context.getAttachment(ModuleDeploymentProcessor.MODULE_ATTACHMENT_KEY);
        if (module == null) {
            throw new DeploymentUnitProcessingException("failed to resolve module for deployment " + deploymentRoot);
        }
        final ClassLoader classLoader = module.getClassLoader();
        final JBossWebMetaData metaData = warMetaData.getMergedJBossWebMetaData();

        // Create the context
        final StandardContext webContext = new StandardContext();
        final ContextConfig config = new JBossContextConfig(context);
        // Set the deployment root
        try {
            webContext.setDocBase(deploymentRoot.getPhysicalFile().getAbsolutePath());
        } catch (IOException e) {
            throw new DeploymentUnitProcessingException(e);
        }
        webContext.addLifecycleListener(config);

        // Set the path name
        final String deploymentName = context.getName();
View Full Code Here

                        final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
                        inputFactory.setXMLResolver(NoopXmlResolver.create());
                        XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
                        webFragments.put(resourceRoot.getName(), WebFragmentMetaDataParser.parse(xmlReader));
                    } catch (Exception e) {
                        throw new DeploymentUnitProcessingException("Failed to parse " + webFragment, e);
                    } finally {
                        try {
                            if (is != null) {
                                is.close();
                            }
View Full Code Here

            final ServiceName sName = ServiceName.JBOSS.append("deployment", context.getName(), "structure");
            builder.addService(sName, new DeploymentStructureService(structure));
            builder.addDependency(sName);

        } catch(IOException e) {
            throw new DeploymentUnitProcessingException(e);
        }
        // Add the war metadata
        final WarMetaData warMetaData = new WarMetaData();
        warMetaData.setSharedWebMetaData(sharedWebMetaData);
        context.putAttachment(WarMetaData.ATTACHMENT_KEY, warMetaData);
View Full Code Here

            for(final VirtualFile archive : archives) {
                try {
                    final Closeable closable = VFS.mountZip(archive, archive, TempFileProviderService.provider());
                    entries.add(new ClassPathEntry(archive, closable));
                } catch (IOException e) {
                    throw new DeploymentUnitProcessingException("failed to process " + archive, e);
                }
            }
        }
    }
View Full Code Here

                final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
                inputFactory.setXMLResolver(NoopXmlResolver.create());
                XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
                warMetaData.setWebMetaData(WebMetaDataParser.parse(xmlReader));
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException("Failed to parse " + webXml, e);
            } finally {
                try {
                    if (is != null) {
                        is.close();
                    }
View Full Code Here

            annotationsMetaData = new HashMap<String, WebMetaData>();
            warMetaData.setAnnotationsMetaData(annotationsMetaData);
        }
        final Module module = context.getAttachment(ModuleDeploymentProcessor.MODULE_ATTACHMENT_KEY);
        if (module == null) {
            throw new DeploymentUnitProcessingException("failed to resolve module for deployment " + context.getName());
        }
        final ClassLoader classLoader = module.getClassLoader();

        // Process web-inf/classes
        if (index.getRootIndex() != null) {
View Full Code Here

TOP

Related Classes of org.jboss.as.deployment.unit.DeploymentUnitProcessingException

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.