nested exception is java.lang.NullPointerException

今天给同事排错,在Idea热启动模式下,启动Spring项目报错:
servlet [springMVC] in context with path [] threw exception: Request processing failed; nested exception is java.lang.NullPointerException
这时候我去看了下自己项目结构下的resources文件夹里面的配置文件,配置文件名称也是springMVC.xml,然后看了下生成的字节码文件,名称也是一样的,这就蛋疼了,因此我根据前端界面数据没出来这个问题,在后台获取数据的controller下对应的方法里面打桩sout(query),再次访问界面,控制台报错:
JRebel: Failed to reconfigure bean ‘departmentController’
看到这儿就能确定是配置错误了,又因为多了热启动这一层,我就直接关掉jvm,直接启动Tomcat,这时候报错信息就很明确了:
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [SpringMVC.xml]; nested exception is java.io.FileNotFoundException: class path resource [SpringMVC.xml] cannot be opened because it does not exist.
我才想起没有查看web.xml的配置信息,回头去查看,才发现是springMVC配置信息里面,classpath后面的名称写错了,写的是SpringMVC.xml,所以才没找到对应的springMVC.xml,改过来之后完美运行。

猜你喜欢

转载自blog.csdn.net/z2014ypd/article/details/88728906