java.lang.ClassNotFoundException: org.springframew

2019-08-05 04:24发布

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>

3条回答
Lonely孤独者°
2楼-- · 2019-08-05 04:48

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>
查看更多
贪生不怕死
3楼-- · 2019-08-05 05:02

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.

查看更多
趁早两清
4楼-- · 2019-08-05 05:04

You also need to update the spring-security dependencies to 4.0.n.RELEASE versions.

查看更多
登录 后发表回答