java - eclipse run on server, classpath, not find springmvc.xml
問(wèn)題描述
eclipse:Neon
tomcat:9
在學(xué)習(xí)SpringMVC時(shí),eclipse創(chuàng)建動(dòng)態(tài)web項(xiàng)目 創(chuàng)建config(source folder)和src同級(jí) 在config目錄下創(chuàng)建配置文件springmvc.xml,并在web.xml中加載
項(xiàng)目run as-》run configuration報(bào)錯(cuò):Type Exception Report
Message Servlet.init() for servlet [springmvc] threw exception
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [sprigmvc.xml]; nested exception is java.io.FileNotFoundException: class path resource [sprigmvc.xml] cannot be opened because it does not exist
run as -》 run configuration配置classpath,添加project還是報(bào)找不到springmvc.xml in classpathCaused by: java.io.FileNotFoundException: class path resource [sprigmvc.xml] cannot be opened because it does not exist
問(wèn)題解答
回答1:springmvc.xml路徑錯(cuò)了,導(dǎo)致無(wú)法找到xml文件,讀取失敗
回答2:解決了,因?yàn)闆](méi)有設(shè)置環(huán)境變量classpath.;%JAVA_HOME%libdt.jar;%JAVA_HOME%libtools.jar
