Google Groups Home
Help | Sign in
Message from discussion Problem with OsgiBundleXmlWebApplicationCon text
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Craig Walls  
View profile
 More options May 6, 11:28 am
From: Craig Walls <hab...@gmail.com>
Date: Tue, 6 May 2008 08:28:21 -0700 (PDT)
Local: Tues, May 6 2008 11:28 am
Subject: Re: Problem with OsgiBundleXmlWebApplicationContext

None that I could see...but I'm *super-willing* to be proven
wrong. :-)

On May 6, 9:29 am, "Matt Raible" <mrai...@gmail.com> wrote:

> Just a thought - but is there a way to set the namespace as a <context-param>?

> Matt

> On Tue, May 6, 2008 at 7:21 AM, Craig Walls <hab...@gmail.com> wrote:

> >  Clarifying one point I made in my last post: The setNamespace() method
> >  appears to only be called from three places:
> >    - FrameworkServlet (and therefore from DispatcherServlet)
> >    - FrameworkPortlet
> >    - ContextLoaderPlugin (for Struts apps)

> >  This would be no problem if my web layer were developed in Spring MVC
> >  and I chose to pack all of the configuration for that layer in a
> >  single XML file. But the web layer of at least one of my projects is
> >  Wicket, thus there's no need for DispatcherServlet and I must load the
> >  context with ContextLoaderListener. Unfortunately, as I've already
> >  pointed out, that does not work, yielding the aforementioned
> >  exception.

> >  This appears to be a bug. Either ContextLoaderListener needs to be
> >  changed to call setNamespace() or Spring-DM needs to be changed to be
> >  more forgiving of the fact that there is no namespace set when all you
> >  have is ContextLoaderListener.

> >  On May 6, 9:03 am, Craig Walls <hab...@gmail.com> wrote:
> >  > Seeing as how everyone's silent on this issue (probably living it up
> >  > at JavaOne), I'll continue the discussion on my own. Pipe in if you
> >  > have anything to offer. :-)

> >  > On one of my small-scale example apps, I got this to work without the
> >  > aforementioned exceptions. I did this by loading the context entirely
> >  > from DispatcherServlet (that is, I added DispatcherServlet to web.xml
> >  > and a corresponding Spring config). What led me to this "solution" is
> >  > that I had discovered (by digging around in the Spring source code)
> >  > that DispatcherServlet calls setNamespace() on the context, but
> >  > ContextLoaderListener does not. Is this expected behavior?

> >  > Once I added ContextLoaderListener back to my XML file, I started
> >  > getting the exceptions again. Here's what my non-working web.xml file
> >  > looks like:

> >  > <!DOCTYPE web-app PUBLIC
> >  >  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> >  >  "http://java.sun.com/dtd/web-app_2_3.dtd" >

> >  > <web-app>
> >  >   <display-name>My Application</display-name>

> >  >   <context-param>
> >  >     <param-name>contextClass</param-name>
> >  >     <param-
> >  > value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicat ionContext</
> >  > param-value>
> >  >   </context-param>

> >  >   <listener>
> >  >     <listener-
> >  > class>org.springframework.web.context.ContextLoaderListener</listener-
> >  > class>
> >  >   </listener>

> >  >   <servlet>
> >  >     <servlet-name>spring</servlet-name>
> >  >     <servlet-class>org.springframework.web.servlet.DispatcherServlet</
> >  > servlet-class>
> >  >     <init-param>
> >  >       <param-name>contextClass</param-name>
> >  >       <param-
> >  > value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicat ionContext</
> >  > param-value>
> >  >     </init-param>
> >  >     <load-on-startup>1</load-on-startup>
> >  >   </servlet>
> >  > </web-app>

> >  > And yes, there is an applicationContext.xml file under WEB-INF with a
> >  > single stupid-simple bean declared in it. Note that this is not
> >  > significantly different than what is described in Section 8.7 of the
> >  > reference documentation.

> >  > So, what can I do to make this work and still be able to use
> >  > ContextLoaderListener? Is this a bug? I'll be happy to report in in
> >  > JIRA, but want to make sure that I'm not doing something wrong first.

> --http://raibledesigns.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google