
|
If you were logged in you would be able to see more operations.
|
|
|
|
I'm not sure if this is a Spring-DM issue or a Spring MVC issue, but since it was Spring-DM that exposed it, I'll post it here.
If I load my Spring context through DispatcherServlet, everything works fine. But if I use ContextLoaderListener, I get the following stack trace:
[Timer-1] ERROR org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - Refresh error
java.lang.NullPointerException
at org.springframework.osgi.util.internal.MapBasedDictionary.put(MapBasedDictionary.java:142)
at org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext.customizeApplicationContextServiceProperties(OsgiBundleXmlWebApplicationContext.java:176)
at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.publishContextAsOsgiServiceIfNecessary(AbstractOsgiBundleApplicationContext.java:283)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.finishRefresh(AbstractDelegatedExecutionApplicationContext.java:307)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:384)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.normalRefresh(AbstractDelegatedExecutionApplicationContext.java:143)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$NoDependenciesWaitRefreshExecutor.refresh(AbstractDelegatedExecutionApplicationContext.java:70)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:131)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer.startCatalinaContext(TomcatWarDeployer.java:144)
at org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer.startDeployment(TomcatWarDeployer.java:133)
at org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:93)
at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.run(WarLoaderListener.java:141)
at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
It seems that MapBasedDictionary throws a NullPointerException (at line 142) if either the key or value is null. When OsgiBundleXmlWebApplicationContext tries to add the context's namespace to MapBasedDictionary (line 176), it will fail if the namespace is null.
The problem is that the only three places where setNamespace() are called on a web application context are:
- FrameworkServlet (and thus DispatcherServlet)
- FrameworkPortlet
- ContextLoaderPlugin (for Struts apps)
In my app, I don't need DispatcherServlet because the front-end is Wicket. But I still need ContextLoaderListener to load the context. Even if I add DispatcherServlet to web.xml, I still get the error. The only way I can get rid of the error is to remove ContextLoaderListener from my web.xml file altogether.
So, either (1) ContextLoaderListener needs to be changed to call setNamespace() on the web application context or (2) OsgiBundleXmlWebApplicationContext/MapBasedDictionary needs to be changed to be more forgiving of a null namespace.
|
|
Description
|
I'm not sure if this is a Spring-DM issue or a Spring MVC issue, but since it was Spring-DM that exposed it, I'll post it here.
If I load my Spring context through DispatcherServlet, everything works fine. But if I use ContextLoaderListener, I get the following stack trace:
[Timer-1] ERROR org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - Refresh error
java.lang.NullPointerException
at org.springframework.osgi.util.internal.MapBasedDictionary.put(MapBasedDictionary.java:142)
at org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext.customizeApplicationContextServiceProperties(OsgiBundleXmlWebApplicationContext.java:176)
at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.publishContextAsOsgiServiceIfNecessary(AbstractOsgiBundleApplicationContext.java:283)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.finishRefresh(AbstractDelegatedExecutionApplicationContext.java:307)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:384)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.normalRefresh(AbstractDelegatedExecutionApplicationContext.java:143)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$NoDependenciesWaitRefreshExecutor.refresh(AbstractDelegatedExecutionApplicationContext.java:70)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:131)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer.startCatalinaContext(TomcatWarDeployer.java:144)
at org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer.startDeployment(TomcatWarDeployer.java:133)
at org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:93)
at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.run(WarLoaderListener.java:141)
at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
It seems that MapBasedDictionary throws a NullPointerException (at line 142) if either the key or value is null. When OsgiBundleXmlWebApplicationContext tries to add the context's namespace to MapBasedDictionary (line 176), it will fail if the namespace is null.
The problem is that the only three places where setNamespace() are called on a web application context are:
- FrameworkServlet (and thus DispatcherServlet)
- FrameworkPortlet
- ContextLoaderPlugin (for Struts apps)
In my app, I don't need DispatcherServlet because the front-end is Wicket. But I still need ContextLoaderListener to load the context. Even if I add DispatcherServlet to web.xml, I still get the error. The only way I can get rid of the error is to remove ContextLoaderListener from my web.xml file altogether.
So, either (1) ContextLoaderListener needs to be changed to call setNamespace() on the web application context or (2) OsgiBundleXmlWebApplicationContext/MapBasedDictionary needs to be changed to be more forgiving of a null namespace.
|
Show » |
|
The MapBasedDictionary cannot accept null keys/values since it would break the Dictionary contract.
Let me know how the fix works for you.
Cheers,