dev@grizzly.java.net

Re: About web.xml's <context-param>

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 21 Sep 2009 11:38:43 -0400

+1 as well

Thanls Bongjae!

-- Jeanfrancois

Hubert Iwaniuk wrote:
> +1
>
> Thanks.
>
> 2009/9/21 Bongjae Chang <bongjae.chang_at_gmail.com
> <mailto:bongjae.chang_at_gmail.com>>
>
> Hi,
>
> When I deployed a web application which included spring-security
> library with grizzly servlet deployer, I met the following exceptions.
>
> ---
> Caused by: java.lang.IllegalArgumentException: No authentication
> providers were found in the applica
> tion context
> at org.springframework.util.Assert.notEmpty(Assert.java:268)
> at
> org.springframework.security.config.NamespaceAuthenticationManager.afterPropertiesSet(Nam
> espaceAuthenticationManager.java:31)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe
> thods(AbstractAutowireCapableBeanFactory.java:1369)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBe
> an(AbstractAutowireCapableBeanFactory.java:1335)
> ... 85 more
> ---
>
> When I debugged the error, I could know that this error was related
> to web.xml's <context-param>.
>
> It seems that the grizzly servlet deployer doesn't have processed
> web.xml's <context-param>.
>
> Actually, I didn't tested it with the refactoring version but the
> old grizzly servlet deployer version.
>
> But I could know that the new version also missed <context-param>'s
> process when I reviewed the new version(svn trunk).
>
> So I added the logic simply and attached the proposed patch.
>
>
> The proposed patch is here:
> ---
>
> Index: com/sun/grizzly/http/servlet/deployer/WebAppAdapter.java
> ===================================================================
> ---
> com/sun/grizzly/http/servlet/deployer/WebAppAdapter.java (revision 3649)
> +++
> com/sun/grizzly/http/servlet/deployer/WebAppAdapter.java (working copy)
> @@ -109,6 +109,9 @@
> ServletAdapter sa = adapterAliases.getKey();
> sa.setClassLoader(webAppCL);
>
> + // set context params
> + setContextParams(webApp, sa);
> +
> // set Filters for this context if there are some
> setFilters(webApp, sa);
>
> @@ -398,6 +401,21 @@
> }
> }
>
> + protected static void setContextParams(WebApp webApp,
> ServletAdapter sa) {
> + if(webApp == null || sa == null) {
> + return;
> + }
> +
> + // Add the context param
> + List<ContextParam> contextParmas = webApp.getContextParam();
> +
> + if(contextParmas != null) {
> + for(ContextParam element : contextParmas) {
> + sa.addContextParameter(element.getParamName(),
> element.getParamValue());
> + }
> + }
> + }
> +
> /**
> * @param sa ServletAdapter
> * @param aliases contains the list of UrlPattern for this
> ServletAdapter
>
> ---
>
> When I deployed the application with this patch, it worked well.
>
> Could you review this patch?
>
> Thanks!
>
> PS)
> I changed my email address because carryel_at_korea.com
> <mailto:carryel_at_korea.com> couldn't receive some mails and had some
> problems.
> So, new my email address is bongjae.chang_at_gmail.com
> <mailto:bongjae.chang_at_gmail.com>. :)
> --
> Bongjae Chang
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> <mailto:dev-unsubscribe_at_grizzly.dev.java.net>
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
> <mailto:dev-help_at_grizzly.dev.java.net>
>
>