users@jersey.java.net

Re: [Jersey] Jersey Spring CONTEXT_CONFIG_LOCATION <was> Re: [Jersey] Problems using JerseyTest

From: tarjei <tarjei_at_nu.no>
Date: Wed, 07 Oct 2009 11:47:40 +0200

Hi,

On 10/06/2009 04:09 PM, Paul Sandoz wrote:
>
> I think this is a bug in the Jersey spring configuration and it should
> also fail if using a web.xml. Is that your experience?
I do not wire web.xml the same way but your analysis below seems correct
to me.

I have posted a bug[1] on the issue. Do you think a fix will be included
in the 1.1.4 release?

1. https://jersey.dev.java.net/issues/show_bug.cgi?id=381

kind regards,
Tarjei




>
> The problem is in the following method on the Jersey SpringServlet:
>
> private ConfigurableApplicationContext getChildContext(String
> contextConfigLocation) {
> final ConfigurableWebApplicationContext ctx = new
> XmlWebApplicationContext();
> ctx.setParent(getDefaultContext());
> ctx.setServletContext(getServletContext());
> ctx.setConfigLocations(new String[]{contextConfigLocation}); //
> <-- Problem is here
>
> ctx.refresh();
> return ctx;
> }
>
> It appears that the method call to:
>
> ctx.setConfigLocations(new String[]{contextConfigLocation});
>
> http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/context/ConfigurableWebApplicationContext.html#setConfigLocations%28java.lang.String[]%29
>
>
> is wrong and it should be:
>
> ctx.setConfigLocation(contextConfigLocation);
>
> i.e. the call with the array assumes only one location per element.
>
> Could you log an issue?


-- 
Tarjei Huse
Mobil: 920 63 413