Package org.jboss.as.server.deployment

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


    for (String deploymentDescriptor : deploymentDescriptors) {
      Enumeration<URL> resources = null;
      try {
        resources = module.getClassLoader().getResources(deploymentDescriptor);
      } catch (IOException e) {
        throw new DeploymentUnitProcessingException("Could not load processes.xml resource: ", e);
      }
      while (resources.hasMoreElements()) {
        deploymentDescriptorURLs.add((URL) resources.nextElement());
      }
    }
View Full Code Here


    Class<?> paClass = null;
    try {
      paClass = (Class<?>) module.getClassLoader().loadClass(paClassName);
    } catch (ClassNotFoundException e) {
      throw new DeploymentUnitProcessingException("Unable to load process application class '"+paClassName+"'.");
    }

    ProcessApplication annotation = paClass.getAnnotation(ProcessApplication.class);

    if(annotation == null) {
View Full Code Here

  protected Enumeration<URL> getProcessesXmlResources(Module module, String[] deploymentDescriptors) throws DeploymentUnitProcessingException {
    try {
      return module.getClassLoader().getResources(PROCESSES_XML);
    } catch (IOException e) {
      throw new DeploymentUnitProcessingException(e);
    }
  }
View Full Code Here

  protected VirtualFile getFile(URL processesXmlResource) throws DeploymentUnitProcessingException {
    try {
      return VFS.getChild(processesXmlResource.toURI());
    } catch(Exception e) {
      throw new DeploymentUnitProcessingException(e);
    }
  }
View Full Code Here

      // no pa found, this is not a process application deployment.
      return null;
     
    } else if(processApplicationAnnotations.size() > 1) {
      // found multiple PAs -> unsupported.     
      throw new DeploymentUnitProcessingException("Detected multiple classes annotated with @" + ProcessApplication.class.getSimpleName()
          + ". A deployment must only provide a single @" + ProcessApplication.class.getSimpleName()
          + " class.");
     
    } else {
      // found single PA
     
      AnnotationInstance annotationInstance = processApplicationAnnotations.get(0);     
      ClassInfo paClassInfo = (ClassInfo) annotationInstance.target();
      String paClassName = paClassInfo.name().toString();
     
      ComponentDescription paComponent = null;
     
      // it can either be a Servlet Process Application or a Singleton Session Bean Component or
      if(servletProcessApplications.contains(paClassInfo)) {
       
        // Servlet Process Applications can only be deployed inside Web Applications
        if(warMetaData == null) {
          throw new DeploymentUnitProcessingException("@ProcessApplication class is a ServletProcessApplication but deployment is not a Web Application.");
        }
       
        // check whether it's already a servlet context listener:
        JBossWebMetaData mergedJBossWebMetaData = warMetaData.getMergedJBossWebMetaData();
        List<ListenerMetaData> listeners = mergedJBossWebMetaData.getListeners();
        if(listeners == null) {
          listeners = new ArrayList<ListenerMetaData>();
          mergedJBossWebMetaData.setListeners(listeners);
        }
       
        boolean isListener = false;
        for (ListenerMetaData listenerMetaData : listeners) {
          if(listenerMetaData.getListenerClass().equals(paClassInfo.name().toString())) {
            isListener = true;
          }
        }
       
        if(!isListener) {
          // register as Servlet Context Listener
          ListenerMetaData listener = new ListenerMetaData();
          listener.setListenerClass(paClassName);
          listeners.add(listener);
       
          // synthesize WebComponent
          WebComponentDescription paWebComponent = new WebComponentDescription(paClassName,
              paClassName,
              eeModuleDescription,
              deploymentUnit.getServiceName(),
              eeApplicationClasses);
                       
          eeModuleDescription.addComponent(paWebComponent);
         
          deploymentUnit.getAttachment(WebAttachments.WEB_COMPONENT_INSTANTIATORS).put(paWebComponent.getComponentClassName(), new WebComponentInstantiator(deploymentUnit, paWebComponent));
         
          paComponent = paWebComponent;
         
        } else {
          // lookup the existing component         
          paComponent = eeModuleDescription.getComponentsByClassName(paClassName).get(0);         
        }
       
        // deactivate sci
       
                       
      } else {
       
        // if its not a ServletProcessApplication it must be a session bean component
           
        List<ComponentDescription> componentsByClassName = eeModuleDescription.getComponentsByClassName(paClassName);  
       
        if (!componentsByClassName.isEmpty() && (componentsByClassName.get(0) instanceof SessionBeanComponentDescription)) {         
          paComponent = componentsByClassName.get(0);

        } else {         
          throw new DeploymentUnitProcessingException("Class " + paClassName + " is annotated with @" + ProcessApplication.class.getSimpleName()
              + " but is neither a ServletProcessApplication nor an EJB Session Bean Component.");

        }

      }     
     
      // attach additional metadata to the deployment unit
     
      if(!postDeployAnnnotations.isEmpty()) {
        if(postDeployAnnnotations.size()==1) {
          ProcessApplicationAttachments.attachPostDeployDescription(deploymentUnit, postDeployAnnnotations.get(0));         
        } else {
          throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PostDeploy. Found ["+postDeployAnnnotations+"]");
        }   
      }
     
      if(!preUndeployAnnnotations.isEmpty()) {
        if(preUndeployAnnnotations.size()==1) {
          ProcessApplicationAttachments.attachPreUndeployDescription(deploymentUnit, preUndeployAnnnotations.get(0));         
        } else {
          throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PreUndeploy. Found ["+preUndeployAnnnotations+"]");
        }   
      }
     
      return paComponent;
    }
View Full Code Here

            xmlMapper.parseDocument(result, reader);
            final KernelDeploymentXmlDescriptor xmlDescriptor = result.getResult();
            if(xmlDescriptor != null)
                phaseContext.getDeploymentUnit().putAttachment(KernelDeploymentXmlDescriptor.ATTACHMENT_KEY, xmlDescriptor);
            else
                throw new DeploymentUnitProcessingException("Failed to parse MC beans xml [" + beansXmlFile + "]");
        } catch(Exception e) {
            throw new DeploymentUnitProcessingException("Failed to parse MC beans xml [" + beansXmlFile + "]", e);
        } finally {
            VFSUtils.safeClose(xmlStream);
        }
    }
View Full Code Here

        if(kdXmlDescriptor == null)
            return;

        final Module module = phaseContext.getDeploymentUnit().getAttachment(Attachments.MODULE);
        if(module == null)
            throw new DeploymentUnitProcessingException("Failed to get module attachment for " + phaseContext.getDeploymentUnit());
        final DeploymentReflectionIndex index = phaseContext.getAttachment(Attachments.REFLECTION_INDEX);
        final List<BeanMetaDataConfig> beanConfigs = kdXmlDescriptor.getBeans();
        final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
        for(final BeanMetaDataConfig beanConfig : beanConfigs) {
            final String className = beanConfig.getBeanClass();
            try {
                addBean(serviceTarget, beanConfig, Class.forName(className, false, module.getClassLoader()), index);
            } catch (ClassNotFoundException e) {
                throw new DeploymentUnitProcessingException("Bean class " + className + " not found", e);
            }
        }
    }
View Full Code Here

        for (final ComponentDescription component : moduleDescription.getComponentDescriptions()) {
            Class<?> componentClass = null;
            try {
                componentClass = loader.loadClass(component.getComponentClassName());
            } catch (ClassNotFoundException e) {
                throw new DeploymentUnitProcessingException(e);
            }
            if (!GetRestful.isRootResource(componentClass)) continue;

            if (component instanceof WebComponentDescription) {
                continue;
View Full Code Here

            addServlet(webdata, servlet);
            servletName = JAX_RS_SERVLET_NAME;

        } else {
            if (servletMappingsExist(webdata, JAX_RS_SERVLET_NAME)) {
                throw new DeploymentUnitProcessingException(MESSAGES.conflictUrlMapping());

            }

            //now there are two options.
            //if there is already a servlet defined with an init param
View Full Code Here

                scanWebDeployment(deploymentUnit, warMetaData.getMergedJBossWebMetaData(), module.getClassLoader(), resteasyDeploymentData);
                scan(deploymentUnit, module.getClassLoader(), resteasyDeploymentData, serviceController.getValue(), true);
            }
            deploymentUnit.putAttachment(JaxrsAttachments.RESTEASY_DEPLOYMENT_DATA, resteasyDeploymentData);
        } catch (ModuleLoadException e) {
            throw new DeploymentUnitProcessingException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.server.deployment.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.