美文网首页
[SpringBoot] javax. servlet not

[SpringBoot] javax. servlet not

作者: zheaps | 来源:发表于2019-07-10 14:32 被阅读0次

    【转】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
    
    QQ图片20190301180616

    我的这个问题是,idea运行时,在自带的tomcat目录下没找到servlet-api.jar这个包 和 jdk目录下,也没有找到这个包。

    解决方法。就是导入servlet-api.jar并在 jdk目录下粘帖一份。

    解决方法:

    我先去**tomcat**[官网](https://tomcat.apache.org/)下载了 **tomcat**    然后解压到硬盘。
    

    1.开始导入:

    image image

    找到你解压 tomcat的目录,然后选中lib目录下servlet-api.jar

    image

    然后重新运行。发现还有一个jdk目录下的servlet-api.jar 也是没有找到

    2.把****servlet-api.jar复制一份,****jdk目录下:

    image

    最后问题解决:

    image

    相关文章

      网友评论

          本文标题:[SpringBoot] javax. servlet not

          本文链接:https://www.haomeiwen.com/subject/oakhkctx.html