ClassNotFoundException with ServletContextlistener

前端 未结 6 741
花落未央
花落未央 2020-12-11 04:42

I get an exception whenever I try getting context parameter from we.XML into a ServletContextListener class, I am really having hard times understa

相关标签:
6条回答
  • 2020-12-11 04:56

    My guess is that you have packaged the servlet-api jar in your webapp (in the WEB-INF/lib) folder and this is causing conflicts since the servlet-api will already be present in the container. Make sure you don't include any servlet-api or jsp-api (or Java EE api) jars in your webapp when you deploy it.

    0 讨论(0)
  • 2020-12-11 05:04

    Verify the space in disk. When eclipse copy the folder libs if not space in disk this error may occur

    0 讨论(0)
  • 2020-12-11 05:11

    Try to clear the tomcat work directory and clean. After that, publish your project and run again.

    0 讨论(0)
  • 2020-12-11 05:11

    I had the same problem running JUnit in a Tomcat 7 environment and I solved it adding a dependency in maven (pom.xml) like this:

        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>7.0.54</version>
            <scope>provided</scope>
        </dependency>
    
    0 讨论(0)
  • 2020-12-11 05:13

    If you are working in Eclipse, Then just clean your project.

    Follow this simple step, Go to Project > clean...> clean all projects > Ok

    0 讨论(0)
  • 2020-12-11 05:15

    I had the same issue when I tried with eclipse LUNA version and tomcat 7. The same code without any extra changes worked in eclipse JUNO with tomcat 7.

    0 讨论(0)
提交回复
热议问题