【转】http://keyblog.cn/article-87.html
最近开始使用idea,用SpringBoot框架,开发程序的时候报错:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org. apache. catalina. authenticator. AuthenticatorBase. startInternal (AuthenticatorBase. iava:1178
The following method did not exist:
javax. servlet. ServletContext. getVirtualServerName () Ljava/lang/String;
The method's class, javax. servlet. ServletContext, is available from the following locations: jar:
file:/c:/Program20Piles/Java/jdk1.8. 0171/jre/lib/javax. servlet. jar!/javax/servlet/ServletContext. class jar:
file:/c:/users/Administrator/.m/repositorz/org/apache/tomcat/embed/tomcat-embed-core/9.0. 16/tomat-embed-core-9.16. jar!/iava/servlet/Servletcontext. class
It was loaded from the following location:
file:/c:/Program%20Files/Java/idk1.8. 0 171/ire/lib/iavaz. servlet. jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax. servlet. ServletContext
![](https://img.haomeiwen.com/i16029784/d79923a9c3fe12af.png)
我的这个问题是,idea运行时,在自带的tomcat目录下没找到servlet-api.jar这个包 和 jdk目录下,也没有找到这个包。
解决方法。就是导入servlet-api.jar并在 jdk目录下粘帖一份。
解决方法:
我先去**tomcat**[官网](https://tomcat.apache.org/)下载了 **tomcat** 然后解压到硬盘。
1.开始导入:
![](https://img.haomeiwen.com/i16029784/2aacffccf5808dc8.png)
![](https://img.haomeiwen.com/i16029784/5f10d4f41d73c3e2.png)
找到你解压 tomcat的目录,然后选中lib目录下servlet-api.jar
![](https://img.haomeiwen.com/i16029784/bbdac2cdfcea4e9d.png)
然后重新运行。发现还有一个jdk目录下的servlet-api.jar 也是没有找到
2.把****servlet-api.jar复制一份,****jdk目录下:
![](https://img.haomeiwen.com/i16029784/aaba170f1c84bcd1.png)
最后问题解决:
![](https://img.haomeiwen.com/i16029784/7f1e1ba2cc9a20d1.png)
网友评论