Announcement Announcement Module
Collapse
No announcement yet.
Upgrading srping 1.4.5 to spring 2.5.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upgrading srping 1.4.5 to spring 2.5.5

    Hi all,
    I am confident that i am going to get this issue resolved by the great people who are here in this community..

    Here it goes:
    I am having an application that is running in spring 1.4.5. I tried to upgrade it to spring 2.5.5. There were many compatible issues while building. One among such is RowMapperResultReader class is removed in spring 2.5.5. I was able to resolve all the build errors.

    I am using JDK1.6 and Tomcat6.0.18. I have included all the jar files.

    But i having deployment issues while starting the server.
    "servletContext must not be null" which is the error i get while deploying. can any one peep into this issue. Is the loading the servletContext different in spring 2.5.5. Can any one help us the flow how the application context get initialized in spring 2.5.5.

    The same code works fine in spring1.4.5 but we face problems only in 2.5.5.

    In our application we have the web.xml along with the businesstierContext.xml which contains the busness level xml's just for modularity in the application.

    I have given here my web.xml, businesstiercontext.xml and one of my module level xml which is responsible for the below deployement error.


    Error log while deploying:
    ERROR [springframework.web.context.ContextLoader] - Context initialization failed
    [springframework.beans.factory.access.BootstrapExce ption: Unable to initialize group definition. Group resource name [classpath*:businessTierContext.xml], factory key [businessTierContext]; nested exception is springframework.beans.factory.BeanCreationExceptio n: Error creating bean with name 'businessTierContext' defined in businessTierContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlAp plicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'server' defined in class path resource [businessContext-common.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: ServletContext must not be null
    at springframework.beans.factory.access.SingletonBean FactoryLocator.useBeanFactory(SingletonBeanFactory Locator.java:389)
    at springframework.web.context.ContextLoader.loadPare ntContext(ContextLoader.java:341)
    at springframework.web.context.ContextLoader.initWebA pplicationContext(ContextLoader.java:195)
    at springframework.web.context.ContextLoaderListener. contextInitialized(ContextLoaderListener.java:45)

    Caused by: java.lang.IllegalArgumentException: ServletContext must not be null
    at springframework.util.Assert.notNull(Assert.java:11 2)
    at springframework.web.context.support.WebApplication ContextUtils.getWebApplicationContext(WebApplicati onContextUtils.java:96)
    at springframework.web.context.support.WebApplication ContextUtils.getWebApplicationContext(WebApplicati onContextUtils.java:86)
    at springframework.web.filter.DelegatingFilterProxy.f indWebApplicationContext(DelegatingFilterProxy.jav a:197)
    at springframework.web.filter.DelegatingFilterProxy.i nitFilterBean(DelegatingFilterProxy.java:143)
    ... 64 more


    My Web.xml:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    sun.com url>
    <web-app>
    <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>tip.root</param-value>
    </context-param>
    <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/log4j.properties</param-value>
    </context-param>
    <listener>
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>

    <listener>
    <listener-class>org.acegisecurity.ui.session.HttpSessionEven tPublisher</listener-class>
    </listener>

    <servlet>
    <servlet-name>remoting</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>remoting</servlet-name>
    <url-pattern>/remoting/*</url-pattern>
    </servlet-mapping>

    <servlet>
    <servlet-name>tip</servlet-name>
    <servlet-class>
    org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>tip</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!-- ACEGI Security filter -->
    <filter>
    <filter-name>Acegi Filter Chain Proxy</filter-name>
    <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
    <init-param>
    <param-name>targetClass</param-name>
    <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>Acegi Filter Chain Proxy</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>

    <filter-mapping>
    <filter-name>Acegi Filter Chain Proxy</filter-name>
    <url-pattern>/autoLogin.jsp</url-pattern>
    </filter-mapping>

    <filter-mapping>
    <filter-name>Acegi Filter Chain Proxy</filter-name>
    <url-pattern>/j_acegi_security_check</url-pattern>
    </filter-mapping>

    <filter-mapping>
    <filter-name>Acegi Filter Chain Proxy</filter-name>
    <url-pattern>/j_acegi_logout</url-pattern>
    </filter-mapping>

    <!-- Configuration filter -->
    <filter>
    <filter-name>server</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
    <init-param>
    <param-name>targetBeanName</param-name>
    <param-value>server</param-value>
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>server</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>

    <!-- Tracking filter -->
    <filter>
    <filter-name>trackingFilter</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
    <init-param>
    <param-name>targetBeanName</param-name>
    <param-value>trackingFilter</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>trackingFilter</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/tip-servlet.xml,
    /WEB-INF/config/webContext-common.xml,
    /WEB-INF/config/webContext-search.xml,
    /WEB-INF/config/webContext-searchAids.xml,
    </param-value>
    </context-param>

    <context-param>
    <param-name>parentContextKey</param-name>
    <param-value>businessTierContext</param-value>
    </context-param>

    <context-param>
    <param-name>locatorFactorySelector</param-name>
    <param-value>classpath*:businessTierContext.xml</param-value>
    </context-param>

    <!-- Welcome file that opens default on start up -->
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    </web-app>


    businesstiercontext.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC
    "-//SPRING//DTD BEAN//EN"
    "springframwork url">

    <beans>
    <bean id="businessTierContext" class="org.springframework.context.support.ClassPa thXmlApplicationContext" abstract="false" singleton="true"
    lazy-init="default" autowire="default" dependency-check="default">
    <constructor-arg>
    <list>
    <value>businessContext-common.xml</value>
    <value>businessContext-cache.xml</value>
    <value>businessContext-trackingContext.xml</value>
    <value>businessContext-securityContext.xml</value>
    <value>businessContext-searchContext.xml</value>
    </list>
    </constructor-arg>
    </bean>
    </beans>


    businessContext-common.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC
    "-//SPRING//DTD BEAN//EN"
    "springframework url">
    <beans>
    <bean id="server"
    class="com.thomson.web.filters.ConfigurationFilter ">
    </bean>

    ....and other been entries that are common for my module


    ConfigurationFilter.java

    My configurationFilter.java look like this as given below which extends DelegatingFilterProxy. So while invoking the init method the delegatingFilterProxy i am getting the error "ServletContext must not be null"

    public class ConfigurationFilter extends DelegatingFilterProxy {
    ....
    ....
    }
Working...
X