Hi,
Previously i used to get the servlet context from WebApplicationContext in my bean implementing ApplicationContextAware
Code:public class ApplicationContextHelper implements ApplicationContextAware{ private static WebApplicationContext ctx; public void setApplicationContext(ApplicationContext ctx) throws BeansException { ApplicationContextHelper.ctx = (WebApplicationContext)ctx; } public static ServletContext getContext() { ServletContext servletContext = ctx.getServletContext(); return servletContext; } }
Now the code gives me ClassCastException
All i want is getting servletContext in my spring beansCode:java.lang.ClassCastException: org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext cannot be cast to org.springframework.web.context.WebApplicationContext


