geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan <xhh...@gmail.com>
Subject Re: svn commit: r983551 - Possible NPE in MergeHelper now?
Date Wed, 11 Aug 2010 01:12:00 GMT
I will look at it.
Thanks.

2010/8/11 Donald Woods <dwoods@apache.org>

> Seeing a deployment failure on Tomcat assemblies when trying to run the
> stand-alone BVAL TCK and was wondering if it was related to the below
> changes, since a NPE is occurring in MergeHelper.java now?
>
> 2010-08-10 17:19:09,565 WARN  [TomcatModuleBuilder] Web application .
> does not c
> ontain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not
> be a problem, depending on whether you have things like resource
> references that need to
>  be resolved.  You can also give the deployer a separate deployment plan
> file on the command line.
> 2010-08-10 17:19:10,849 ERROR [Deployer] Deployment failed due
> tojava.lang.NullPointerException
>        at
>
> org.apache.geronimo.web25.deployment.merge.MergeHelper.saveOrderedLibAttribute(MergeHelper.java:563)
>        at
>
> org.apache.geronimo.web25.deployment.merge.MergeHelper.relativeOrderWebFragments(MergeHelper.java:479)
>        at
>
> org.apache.geronimo.web25.deployment.merge.MergeHelper.sortWebFragments(MergeHelper.java:555)
>        at
>
> org.apache.geronimo.web25.deployment.merge.MergeHelper.processWebFragmentsAndAnnotations(MergeHelper.java:378)
>        at
>
> org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.basicInitContext(AbstractWebModuleBuilder.java:464)
> . . .
> Deployer operation failed: java.lang.NullPointerException
> org.apache.geronimo.common.DeploymentException:
> java.lang.NullPointerException        at
> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:284)
>        at
> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:138)
>  at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)        at
> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(Refl
> ectionMethodInvoker.java:34)
>        at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperatio
> n.java:131)        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.
> java:872)
>        at
> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
>        at
> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:344)
> . . .
>
>
>
> On 8/9/10 4:18 AM, xuhaihong@apache.org wrote:
> > Author: xuhaihong
> > Date: Mon Aug  9 08:18:04 2010
> > New Revision: 983551
> >
> > URL: http://svn.apache.org/viewvc?rev=983551&view=rev
> > Log:
> > Ignore the mapping configurations from web-fragment.xml and annotations
> while they are configured in web.xml.
> >
> > Modified:
> >
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
> >
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
> >
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
> >
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
> >
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java
> >
> > Modified:
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
> > URL:
> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=983551&r1=983550&r2=983551&view=diff
> >
> ==============================================================================
> > ---
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
> (original)
> > +++
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
> Mon Aug  9 08:18:04 2010
> > @@ -51,7 +51,6 @@ import org.apache.geronimo.components.ja
> >  import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
> >  import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
> >  import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
> > -import org.apache.geronimo.deployment.ClassPathUtils;
> >  import org.apache.geronimo.deployment.ModuleIDBuilder;
> >  import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
> >  import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
> >
> > Modified:
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
> > URL:
> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
> >
> ==============================================================================
> > ---
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
> (original)
> > +++
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
> Mon Aug  9 08:18:04 2010
> > @@ -35,7 +35,7 @@ public class FilterMappingMergeHandler i
> >      private List<SubMergeHandler<FilterMapping, FilterMapping>>
> subMergeHandlers;
> >
> >      public FilterMappingMergeHandler() {
> > -        subMergeHandlers = new ArrayList<SubMergeHandler<FilterMapping,
> FilterMapping>>();
> > +        subMergeHandlers = new ArrayList<SubMergeHandler<FilterMapping,
> FilterMapping>>(3);
> >          subMergeHandlers.add(new FilterMappingUrlPatternMergeHandler());
> >          subMergeHandlers.add(new
> FilterMappingServletNameMergeHandler());
> >          subMergeHandlers.add(new FilterMappingDispatcherMergeHandler());
> > @@ -53,6 +53,9 @@ public class FilterMappingMergeHandler i
> >                      subMergeHandler.add(srcFilterMapping, mergeContext);
> >                  }
> >              } else {
> > +                if (isFilterMappingFromWebXml(filterName, mergeContext))
> {
> > +                    continue;
> > +                }
> >                  if (isFilterMappingFromAnnotation(filterName,
> mergeContext)) {
> >                      //If the current url-patterns configurations are
> from annotations, so let's drop them
> >                      targetFilterMapping.getUrlPattern().clear();
> > @@ -79,6 +82,7 @@ public class FilterMappingMergeHandler i
> >          for (FilterMapping filterMapping : webApp.getFilterMapping()) {
> >              String filterName = filterMapping.getFilterName();
> >              context.setAttribute(createFilterMappingKey(filterName),
> filterMapping);
> > +
>  context.setAttribute(createFilterMappingSourceKey(filterName),
> ElementSource.WEB_XML);
> >          }
> >          for (SubMergeHandler<FilterMapping, FilterMapping>
> subMergeHandler : subMergeHandlers) {
> >              subMergeHandler.preProcessWebXmlElement(webApp, context);
> > @@ -106,6 +110,11 @@ public class FilterMappingMergeHandler i
> >          return elementSource != null &&
> elementSource.equals(ElementSource.ANNOTATION);
> >      }
> >
> > +    public static boolean isFilterMappingFromWebXml(String filterName,
> MergeContext mergeContext) {
> > +        ElementSource elementSource = (ElementSource)
> mergeContext.getAttribute(createFilterMappingSourceKey(filterName));
> > +        return elementSource != null &&
> elementSource.equals(ElementSource.WEB_XML);
> > +    }
> > +
> >      public static void addFilterMapping(FilterMapping filterMapping,
> MergeContext mergeContext) {
> >
>  mergeContext.setAttribute(createFilterMappingKey(filterMapping.getFilterName()),
> filterMapping);
> >      }
> >
> > Modified:
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
> > URL:
> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
> >
> ==============================================================================
> > ---
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
> (original)
> > +++
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
> Mon Aug  9 08:18:04 2010
> > @@ -34,7 +34,7 @@ public class FilterMergeHandler implemen
> >      private List<SubMergeHandler<Filter, Filter>> subMergeHandlers;
> >
> >      public FilterMergeHandler() {
> > -        subMergeHandlers = new ArrayList<SubMergeHandler<Filter,
> Filter>>();
> > +        subMergeHandlers = new ArrayList<SubMergeHandler<Filter,
> Filter>>(1);
> >          subMergeHandlers.add(new FilterInitParamMergeHandler());
> >      }
> >
> >
> > Modified:
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
> > URL:
> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
> >
> ==============================================================================
> > ---
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
> (original)
> > +++
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
> Mon Aug  9 08:18:04 2010
> > @@ -35,7 +35,7 @@ public class ServletMappingMergeHandler
> >      private List<SubMergeHandler<ServletMapping, ServletMapping>>
> subMergeHandlers;
> >
> >      public ServletMappingMergeHandler() {
> > -        subMergeHandlers = new ArrayList<SubMergeHandler<ServletMapping,
> ServletMapping>>();
> > +        subMergeHandlers = new ArrayList<SubMergeHandler<ServletMapping,
> ServletMapping>>(1);
> >          subMergeHandlers.add(new
> ServletMappingUrlPatternMergeHandler());
> >      }
> >
> > @@ -51,6 +51,10 @@ public class ServletMappingMergeHandler
> >                      subMergeHandler.add(srcServletMapping,
> mergeContext);
> >                  }
> >              } else {
> > +                //If the servlet-mapping is configured in the central
> web.xml file, all the configurations from the fragment xml and annotations
> are ignored
> > +                if(isServletMappingFromWebXml(servletName,
> mergeContext)) {
> > +                    continue;
> > +                }
> >                  if (isServletMappingFromAnnotation(servletName,
> mergeContext) && !srcServletMapping.getUrlPattern().isEmpty()) {
> >                      //If the current url-patterns configurations are
> from annotations, so let's drop them
> >                      targetServletMapping.getUrlPattern().clear();
> > @@ -73,8 +77,9 @@ public class ServletMappingMergeHandler
> >      @Override
> >      public void preProcessWebXmlElement(WebApp webApp, MergeContext
> context) throws DeploymentException {
> >          for (ServletMapping servletMapping : webApp.getServletMapping())
> {
> > -            String filterName = servletMapping.getServletName();
> > -            context.setAttribute(createServletMappingKey(filterName),
> servletMapping);
> > +            String servletName = servletMapping.getServletName();
> > +            context.setAttribute(createServletMappingKey(servletName),
> servletMapping);
> > +
>  context.setAttribute(createServletMappingSourceKey(servletName),
> ElementSource.WEB_XML);
> >          }
> >          for (SubMergeHandler<ServletMapping, ServletMapping>
> subMergeHandler : subMergeHandlers) {
> >              subMergeHandler.preProcessWebXmlElement(webApp, context);
> > @@ -101,4 +106,9 @@ public class ServletMappingMergeHandler
> >          ElementSource elementSource = (ElementSource)
> mergeContext.getAttribute(createServletMappingSourceKey(servletName));
> >          return elementSource != null &&
> elementSource.equals(ElementSource.ANNOTATION);
> >      }
> > +
> > +    public static boolean isServletMappingFromWebXml(String servletName,
> MergeContext mergeContext) {
> > +        ElementSource elementSource = (ElementSource)
> mergeContext.getAttribute(createServletMappingSourceKey(servletName));
> > +        return elementSource != null &&
> elementSource.equals(ElementSource.WEB_XML);
> > +    }
> >  }
> >
> > Modified:
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java
> > URL:
> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
> >
> ==============================================================================
> > ---
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java
> (original)
> > +++
> geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java
> Mon Aug  9 08:18:04 2010
> > @@ -34,7 +34,7 @@ public class ServletMergeHandler impleme
> >      private List<SubMergeHandler<Servlet, Servlet>> subMergeHandlers;
> >
> >      public ServletMergeHandler() {
> > -        subMergeHandlers = new ArrayList<SubMergeHandler<Servlet,
> Servlet>>();
> > +        subMergeHandlers = new ArrayList<SubMergeHandler<Servlet,
> Servlet>>(2);
> >          subMergeHandlers.add(new ServletInitParamMergeHandler());
> >          subMergeHandlers.add(new ServletLoadOnStartupMergeHandler());
> >      }
> >
> >
> >
>



-- 
Ivan

Mime
View raw message