问题
I just upgraded a Spring MVC application, version 3.2
to a 4.0.2
and my view tags are not working anymore.
The error:
java.lang.ClassNotFoundException: org.springframework.web.util.ExpressionEvaluationUtils
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
org.springframework.web.servlet.tags.MessageTag.resolveMessage(MessageTag.java:215)
org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:166)
org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
org.apache.jsp.views.templates.main_jsp._jspx_meth_spring_005fmessage_005f0(main_jsp.java:570)
The class ExpressionEvaluationUtils was deprecated in Spring 3.2
and removed in 4.x.
I'm running Tomcat 7.0.50 using Eclipse IDE.
What am i missing here?
Belo are some parts of my configuration.
<java-version>1.7</java-version>
<org.springframework-version>4.0.2.RELEASE</org.springframework-version>
<spring-security.version>3.2.1.RELEASE</spring-security.version>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<artifactId>spring-aop</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework-version}</version>
</dependency>
回答1:
If you haven't changed you JSPs when upgrading spring then you may have old compiled JSPs from the old spring version (the .tags.MessageTag. thing in you stacktrace). Clear your tomcat work directory to recompile the JSPs and try again.
回答2:
You also need to update the spring-security dependencies to 4.0.n.RELEASE versions.
回答3:
I just found out that you need to change the jsp-config web.xml
to ignore-el = true
.
It works now.
<jsp-config>
<jsp-property-group>
<url-pattern>/**</url-pattern>
<el-ignored>**true**</el-ignored>
</jsp-property-group>
</jsp-config>
来源:https://stackoverflow.com/questions/22231865/java-lang-classnotfoundexception-org-springframework-web-util-expressionevaluat