ClassNotFoundException DispatcherServlet when launching Tomcat (Maven dependencies not copied to wtpwebapps)

前端 未结 4 1222
说谎
说谎 2020-12-02 13:57

I\'ve run into this problem a few times and only just stumbled upon a (semi-) reliable solution, so thought I would post it here in case it helps anyone else, or in case I f

相关标签:
4条回答
  • 2020-12-02 14:02

    Take a look at "Deployment Assembly" section under project properties. The content of this page specify how your project is to be assembled into a running application. In particular, this is the place where you can control which of the libraries that your project references, should be packaged with it. Select Add -> Java Build Path Entries. You will be able to pick among your existing build path entries to include in the assembly.

    The quick fix that you found did the same thing for you. If you are curious about what happens under the covers, take a look at your .classpath file before and after the quick fix. The quick fix tags the classpath entry with some assembly information.

    0 讨论(0)
  • 2020-12-02 14:12

    Check .class file and replace the following entry

        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER" />
    

    with Below:-

        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
          <attributes>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
          </attributes>
        </classpathentry>
    

    It worked for me.

    0 讨论(0)
  • 2020-12-02 14:22

    It seems, you have to additionally install Maven Integration for WTP plugin. Its description can be found at issues.sonatype.org.

    0 讨论(0)
  • 2020-12-02 14:23

    I ran into this problem today, on a project that had been working for a long time. I tried all of the above solutions, but (1) I wasn't seeing the warning in the Problems panel as the poster had; (2) my Deployment Assembly Java Build Path Entries was not showing anything else available to deploy; (3) the .classpath entry for org.eclipse.jst.component.dependency was already there; and (4) I already had Maven Integration for WTP installed. I finally removed my project from the Tomcat server and then re-deployed it, and the problem disappeared.

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