Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

WebApplicationContextUtils.getWebApplicationContext() returns null in Servl

686997Mar 11 2009 — edited Mar 12 2009
I'm developing an ADF UI+BC application on Jdeveloper 11g and deploying it to Tomcat6.

My web.xml looks like:

-----
<web-app>
<listener>
<listener-class>oracle.x.AppListener</listener-class>
</listener>
...
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
-----
com.x.AppListener.java looks like:
-----
package com.x;
public class AppListener implements ServletContextListener {
public static ServletContext servletContext;
public void contextInitialized(ServletContextEvent context) {
AppListener.servletContext = context.getServletContext();
System.out.println("-------------servletContext:"+servletContext+"!!!!!!");
WebApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(AppListener.servletContext);
System.out.println("-------------appContext:"+appContext+"!!!!!!");
}
...
}
-----
In the Tomcat log, on startup, i can see the following:
-----
-------------servletContext:org.apache.catalina.core.ApplicationContextFacade@426e05!!!!!!
-------------appContext:null!!!!!!
-----
servletContext is getting set but appContext is being returned as null from WebApplicationContextUtils.getWebApplicationContext().

Any ideas why this might happen?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2009
Added on Mar 11 2009
3 comments
1,618 views