Package com.opensymphony.xwork2.config

Examples of com.opensymphony.xwork2.config.ConfigurationException


                try {
                    Class cls = ClassLoaderUtils.loadClass(cname, this.getClass());
                    ConfigurationProvider prov = (ConfigurationProvider)cls.newInstance();
                    configurationManager.addConfigurationProvider(prov);
                } catch (InstantiationException e) {
                    throw new ConfigurationException("Unable to instantiate provider: "+cname, e);
                } catch (IllegalAccessException e) {
                    throw new ConfigurationException("Unable to access provider: "+cname, e);
                } catch (ClassNotFoundException e) {
                    throw new ConfigurationException("Unable to locate provider class: "+cname, e);
                }
            }
        }
    }
View Full Code Here


    }

    protected void mergeTemplate(Writer writer, Template template) throws Exception {
        final TemplateEngine engine = TemplateEngineManager.getTemplateEngine(template, templateSuffix);
        if (engine == null) {
            throw new ConfigurationException("Unable to find a TemplateEngine for template " + template);
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Rendering template " + template);
        }
View Full Code Here

            }

            if (o instanceof org.apache.struts2.spi.Interceptor)
                return new InterceptorAdapter((org.apache.struts2.spi.Interceptor) o);

            throw new ConfigurationException(
                    "Class [" + className + "] does not implement Interceptor", interceptorConfig);
        } catch (InstantiationException e) {
            throw new ConfigurationException(
                    "Unable to instantiate an instance of Interceptor class [" + className + "].",
                    e, interceptorConfig);
        } catch (IllegalAccessException e) {
            throw new ConfigurationException(
                    "IllegalAccessException while attempting to instantiate an instance of Interceptor class ["
                            + className + "].",
                    e, interceptorConfig);
        } catch (Exception e) {
            throw new ConfigurationException(
                    "Caught Exception while registering Interceptor class " + className,
                    e, interceptorConfig);
        } catch (NoClassDefFoundError e) {
            throw new ConfigurationException(
                    "Could not load class " + className
                            + ". Perhaps it exists but certain dependencies are not available?",
                    e, interceptorConfig);
        }
    }
View Full Code Here

            return (Result) result;

        if (result instanceof org.apache.struts2.spi.Result)
            return new ResultAdapter((org.apache.struts2.spi.Result) result);

        throw new ConfigurationException(result.getClass().getName() + " does not implement Result.");
    }
View Full Code Here

        //setup reload class loader based on dev settings
        initReloadClassLoader();
       
        if (!disableActionScanning) {
            if (actionPackages == null && packageLocators == null) {
                throw new ConfigurationException("At least a list of action packages or action package locators " +
                        "must be given using one of the properties [struts.convention.action.packages] or " +
                        "[struts.convention.package.locators]");
            }

            if (LOG.isTraceEnabled()) {
View Full Code Here

                        for (Action action : actions) {

                            // Check if there are duplicate action names in the annotations.
                            String actionName = action.value().equals(Action.DEFAULT_VALUE) ? defaultActionName : action.value();
                            if (actionNames.contains(actionName)) {
                                throw new ConfigurationException("The action class [" + actionClass +
                                        "] contains two methods with an action name annotation whose value " +
                                        "is the same (they both might be empty as well).");
                            } else {
                                actionNames.add(actionName);
                            }
View Full Code Here

        List<Action> actions = new ArrayList<Action>();
        for (Action ann : actionArray) {
            if (ann.value().equals(Action.DEFAULT_VALUE) && !valuelessSeen) {
                valuelessSeen = true;
            } else if (ann.value().equals(Action.DEFAULT_VALUE)) {
                throw new ConfigurationException("You may only add a single Action " +
                        "annotation that has no value parameter.");
            }

            actions.add(ann);
        }
View Full Code Here

        if (parentName == null) {
            parentName = defaultParentPackage;
        }

        if (parentName == null) {
            throw new ConfigurationException("Unable to determine the parent XWork package for the action class [" +
                    actionClass.getName() + "]");
        }

        PackageConfig parentPkg = configuration.getPackageConfig(parentName);
        if (parentPkg == null) {
            throw new ConfigurationException("Unable to locate parent package [" + parentName + "]");
        }

        // Grab based on package-namespace and if it exists, we need to ensure the existing one has
        // the correct parent package. If not, we need to create a new package config
        String name = actionPackage + "#" + parentPkg.getName() + "#" + actionNamespace;
View Full Code Here

        .getAttribute("strict-method-invocation"));
    boolean strictDMI = Boolean.parseBoolean(strictDMIVal);

    if (StringUtils.isNotEmpty(packageElement
        .getAttribute("externalReferenceResolver"))) {
      throw new ConfigurationException(
          "The 'externalReferenceResolver' attribute has been removed.  Please use "
              + "a custom ObjectFactory or Interceptor.",
          packageElement);
    }

    PackageConfig.Builder cfg = new PackageConfig.Builder(name)
        .namespace(namespace).isAbstract(isAbstract)
        .strictMethodInvocation(strictDMI)
        .location(DomHelper.getLocationObject(packageElement));

    if (StringUtils.isNotEmpty(StringUtils.defaultString(parent))) { // has
                                      // parents,
                                      // let's
                                      // look
                                      // it
                                      // up
      List<PackageConfig> parents = new ArrayList<PackageConfig>();
      for (String parentPackageName : ConfigurationUtil
          .buildParentListFromString(parent)) {

        if (configuration.getPackageConfigNames().contains(
            parentPackageName)) {
          parents.add(configuration
              .getPackageConfig(parentPackageName));
        } else if (declaredPackages.containsKey(parentPackageName)) {
          if (configuration.getPackageConfig(parentPackageName) == null) {
            addPackage(declaredPackages.get(parentPackageName));
          }
          parents.add(configuration
              .getPackageConfig(parentPackageName));
        } else {
          throw new ConfigurationException(
              "Parent package is not defined: "
                  + parentPackageName);
        }

      }
View Full Code Here

          resultType = packageContext.getFullDefaultResultType();

          // now check if there is a result type now
          if (StringUtils.isEmpty(resultType)) {
            // uh-oh, we have a problem
            throw new ConfigurationException(
                "No result type specified for result named '"
                    + resultName
                    + "', perhaps the parent package does not specify the result type?",
                resultElement);
          }
        }

        ResultTypeConfig config = packageContext
            .getResultType(resultType);

        if (config == null) {
          throw new ConfigurationException(
              "There is no result type defined for type '"
                  + resultType + "' mapped with name '"
                  + resultName + "'." + "  Did you mean '"
                  + guessResultType(resultType) + "'?",
              resultElement);
        }

        @SuppressWarnings("deprecation")
        String resultClass = config.getClazz();

        // invalid result type specified in result definition
        if (resultClass == null) {
          throw new ConfigurationException("Result type '"
              + resultType + "' is invalid");
        }

        Map<String, String> resultParams = XmlHelper
            .getParams(resultElement);
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.config.ConfigurationException

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.