类'ModelAndViewDefiningException'的Spring Webmvc NoClassDefFoundError [英] Spring Webmvc NoClassDefFoundError for class 'ModelAndViewDefiningException'

查看:2379
本文介绍了类'ModelAndViewDefiningException'的Spring Webmvc NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里查看过类似的帖子: NoClassDefFoundError ModelAndViewDefiningException on spring + was8 .5.5.13 ,但没有解决方案.

I have looked into this similar post here: NoClassDefFoundError ModelAndViewDefiningException on spring+was8.5.5.13, but it had no solutions.

我已经解压缩了我的war文件,并解压缩了其中的一个库以验证它是否包含NoClassDefFoundError中提到的类: spring-webmvc-4.3.6.RELEASE.jar包含org/springframework/web/servlet/ModelAndViewDefiningException.class.

I have unpacked my war file, and unpacked a library within it to verify it does contain the class mentioned in the NoClassDefFoundError: spring-webmvc-4.3.6.RELEASE.jar contains org/springframework/web/servlet/ModelAndViewDefiningException.class.

这些都是我与弹簧相关的依赖项:

These are all my spring-related dependencies:

lib/metrics-spring-3.1.0 2 2.jar
lib/metrics-spring-3.1.0 2 3.jar
lib/metrics-spring-3.1.0 2.jar
lib/metrics-spring-3.1.0 3.jar
lib/metrics-spring-3.1.0.jar
lib/micrometer-spring-legacy-1.1.0.jar
lib/spring-aop-4.3.6.RELEASE.jar
lib/spring-aspects-4.3.6.RELEASE.jar
lib/spring-beans-4.3.6.RELEASE.jar
lib/spring-boot-2.1.1.RELEASE.jar
lib/spring-boot-actuator-2.1.1.RELEASE.jar
lib/spring-boot-actuator-autoconfigure-2.1.1.RELEASE.jar
lib/spring-boot-autoconfigure-2.1.1.RELEASE.jar
lib/spring-boot-starter-2.1.1.RELEASE.jar
lib/spring-boot-starter-actuator-2.1.1.RELEASE.jar
lib/spring-boot-starter-logging-2.1.1.RELEASE.jar
lib/spring-cloud-aws-autoconfigure-2.0.1.RELEASE.jar
lib/spring-cloud-aws-context-2.0.1.RELEASE.jar
lib/spring-cloud-aws-core-2.0.1.RELEASE.jar
lib/spring-cloud-starter-aws-2.0.1.RELEASE.jar
lib/spring-context-4.3.6.RELEASE.jar
lib/spring-context-support-4.1.6.RELEASE.jar
lib/spring-core-4.3.6.RELEASE.jar
lib/spring-data-commons-1.12.7.RELEASE.jar
lib/spring-data-jpa-1.10.7.RELEASE.jar
lib/spring-expression-4.3.6.RELEASE.jar
lib/spring-jdbc-4.3.6.RELEASE.jar
lib/spring-orm-4.3.6.RELEASE.jar
lib/spring-security-core-4.0.2.RELEASE.jar
lib/spring-test-4.3.6.RELEASE.jar
lib/spring-tx-4.3.6.RELEASE.jar
lib/spring-web-4.3.6.RELEASE.jar
lib/spring-webmvc-4.3.6.RELEASE.jar

最后一个仅包含NoClassDefFoundError中的指定类"ModelAndViewDefiningException".

The last one only containing the specified class "ModelAndViewDefiningException" in the NoClassDefFoundError.

我已经使用bash脚本扫描了解压缩的jar文件,以确认ModelAndViewDefiningException确实存在.

I have scanned through the unpacked jar file using my bash script to verify that the ModelAndViewDefiningException does indeed exist.

#!/bin/bash

for filename in lib/*spring*.jar; do
    x=`jar -tvf "$filename" | grep 'ModelAndViewDefiningException'`
    if test ! -z "$x" 
    then
      echo $filename " class found is: " $x
    fi
done

它确实存在,通过上面的脚本:

It does indeed exist, through my script above:

lib/spring-webmvc-4.3.6.RELEASE.jar  class found is:  854 Wed Jan 25 13:16:28 AEDT 2017 org/springframework/web/servlet/ModelAndViewDefiningException.class
ip-192-168-0-13:WEB-INF

推荐答案

发生这种情况是由于文件句柄已满.该应用程序在Amazon实例生产服务器上运行,进行大量负载.运行像Nginx这样的应用程序,以及我们自己的一些应用程序.

This occurs because of maxed out file handles. This application runs on an Amazon instance production server, doing loads of volume. Running applications like Nginx, and some of our own applications.

这就是为什么JVM无法加载该类的原因,因为没有任何文件句柄,因此引发了NoClassDefFoundError异常.

That's why the JVM was unable to load in the class, because there weren't any file handles, hence the NoClassDefFoundError exception was being thrown.

这篇关于类'ModelAndViewDefiningException'的Spring Webmvc NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆