Back Forum Reply New

OsgiBundleXmlWebApplicationContext problem

I've had some small success with a simple Spring-DM application (using v1.1.0-m2), but now I'm trying to OSGi-ify a much larger application and am encountering problems with OsgiBundleXmlWebApplicationContext.

Specifically, I get this stack trace (abridged for readability's sake):

SEVERE: Exception sending context initialized event to listener instance of class org..web.context.ContextLoaderListe  ner
java.lang.NullPointerException       at org..osgi.util.internal.MapBasedDic  tionary.put(MapBasedDictionary.java:142)       at org..osgi.web.context.support.OsgiB  undleXmlWebApplicationContext.customizeApplication  ContextServiceProperties(OsgiBundleXmlWebApplicati  onContext.java:176)       at org..osgi.context.support.AbstractO  sgiBundleApplicationContext.publishContextAsOsgiSe  rviceIfNecessary(AbstractOsgiBundleApplicationCont  ext.java:283)       at org..osgi.context.support.AbstractD  elegatedExecutionApplicationContext.finishrcfresh(  AbstractDelegatedExecutionApplicationContext.java:  307)       at org..context.support.AbstractApplic  ationContext.refresh(AbstractApplicationContext.ja  va:384)
...

Upon inspecting the source code, I find that OsgiBundleXmlWebApplicationContext is trying to put a String known as quot;namespacequot; into a map. The problem is that the namespace String is null. So, my question: Why would the namespace be null and what can I do to make it not null?

Okay...I just realized that the namespace String is set from the setNamespace() method which is ultimately specified by ConfigurableWebApplicationContext (duh)...

My question still remains: Why would the namespace be null? Any clues?

And, in case it makes a difference...

I'm only using ContextLoaderListener to load my application context and do not have a DispatcherServlet configured. That's because I'm not using Spring MVC for the web layer (but still need a Spring context loaded for Wicket's sake).

Craig, you probably know by now but just for the record, the issue has been addressed in the TRUNK. See:
browse/OSGI-476

I'm getting this same exception. My war is Spring-MVC based, and does have a DispaterServlet configured. Am I leaving some configuration piece out? If not, is there a way to work around this without getting the fix in the source and building it myself?

Thanks,
Michael-

Sure - try one of the nightly builds (see the official home page for the Maven repo information).

But this seems like a bug that would prevent anyone from using Spring-DM. Wouldn't it blocking even releasing the milestone build? Is there some configuration that I can add that will prevent this? I like using the tested/milestone builds.

Thanks,
Michael-

The bug appears if one is using the Spring-MVC integration w/o Spring-MVC, that is the application context w/o the DispatcherServlet. You can alleviate the problem by setting up the namespace property for OsgiBundleXmlWebApplicationContext.

Thanks for all the help. I finally have a simple Spring-MVC web application working with equinox/catalina. Looking forward to making progress on our real app!
¥
Back Forum Reply New