posted 8 years ago
Hi
My parent POM which I can't change is having Spring 3.0.3 defined with run time dependency where as the child pom is using a new Spring version 3.2.9 with compile time dependency. Now the WAR which is getting created is having the old Spring Jars as well along with new one. So when I run my application I am getting the below error
2015-08-20 16:37:28,069 INFO [org.springframework.web.context.ContextLoader] - <Root WebApplicationContext: initialization started>
2015-08-20 16:37:28,123 ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>
java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment;
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:404)
The Parent POM is having the below Entry
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
<scope>runtime</scope>
</dependency>
The following jars are getting added to the war file along with the new 3.2.9 version Jars.
WEB-INF/lib/org.springframework.context-3.0.3.RELEASE.jar
WEB-INF/lib/org.springframework.expression-3.0.3.RELEASE.jar
WEB-INF/lib/org.springframework.beans-3.0.3.RELEASE.jar
WEB-INF/lib/org.springframework.core-3.0.3.RELEASE.jar
In my child POM there is no reference of old Spring version.
Is there a solution to this issue? Note we can not change the Parent POM.xml as it is being used across multiple application.
Regards
Abhishek