Spring学习笔记(十九):关于tomcat运行一直出错的问题

当时出现了一个错误:
提示无法解析数据库的xml文件,还有说Runnable等问题,具体代码如下:

org.springframework.core.NestedIOException: Failed to parse mapping resource: 'E:\STS_WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\v11j\WEB-INF\classes\mappings\modules\device\DeviceClothesTemplateDao.xml'; nested exception is java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [META-INF/services/javax.xml.xpath.XPathFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.mybatis.spring.SqlSessionFactoryBean.refresh(SqlSessionFactoryBean.java:599) at org.apache.ibatis.thread.Runnable.refresh(Runnable.java:140) at org.apache.ibatis.thread.Runnable$1.run(Runnable.java:95) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [META-INF/services/javax.xml.xpath.XPathFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1353) at org.apache.catalina.loader.WebappClassLoaderBase.findResources(WebappClassLoaderBase.java:976) at java.lang.ClassLoader.getResources(Unknown Source) at java.util.ServiceLoader$LazyIterator.hasNextService(Unknown Source) at java.util.ServiceLoader$LazyIterator.hasNext(Unknown Source) at java.util.ServiceLoader$1.hasNext(Unknown Source) at javax.xml.xpath.XPathFactoryFinder$2.run(Unknown Source) at javax.xml.xpath.XPathFactoryFinder$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at javax.xml.xpath.XPathFactoryFinder.findServiceProvider(Unknown Source) at javax.xml.xpath.XPathFactoryFinder._newFactory(Unknown Source) at javax.xml.xpath.XPathFactoryFinder.newFactory(Unknown Source) at javax.xml.xpath.XPathFactory.newInstance(Unknown Source) at javax.xml.xpath.XPathFactory.newInstance(Unknown Source) at org.apache.ibatis.parsing.XPathParser.commonConstructor(XPathParser.java:264) at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:124) at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:86) at org.mybatis.spring.SqlSessionFactoryBean.refresh(SqlSessionFactoryBean.java:594) ... 3 more 

以前本地调试时,如果服务器已启动,然后修改代码再保存,有时候就会出现这个错误,但是重启后就好了;结果这次放到服务器后,不管重启多少次,都不管用;然后把tomcat的缓存清下就好了;
原因是缓存问题。
解决办法:
首先关闭tomcat服务进程
killall -9 java 比较彻底的结束进程
查看下进程是否结束完全
ps -aux |grep java
然后进入 安装目录/tomcat/work目录下,删除该目录下所有
执行命令:
rm -rf Catalina/
rm -rf Catalinai/
rm -rf Catalinaii/

确认是删除命令:ls,如果work目录下没有Catalina文件夹,这表示删除成功

再进入 安装目录/tomcat/bin目录下执行命令:./startup.sh,启动tomcat

你可能感兴趣的:(Spring学习笔记(十九):关于tomcat运行一直出错的问题)