Jars not copied to Tomcat's lib folder

前端 未结 4 2205
北荒
北荒 2020-12-13 01:25

I am doing some basic spring stuff and stuck at some point. I am getting ClassNotFoundException whenever I deploy my application on Tomcat.

I observed

相关标签:
4条回答
  • 2020-12-13 01:43

    Put your jars in the WEB-INF/lib directory: In Project properties -> Deployment Assembly you should have a Source of /web with a Deployment Path of /. If this is there then any jars in the web/WEB-INF/lib directory will get deployed and picked up by the class loader. Note that sub-directories will not be picked up though, so put your jars directly in the lib directory.

    0 讨论(0)
  • 2020-12-13 01:58

    If you define "war" packaging for your maven project then your dependent libraries should be automatically copied to the WEB-INF/lib directory of the created .war file by the Maven WAR plugin.

    0 讨论(0)
  • 2020-12-13 01:58

    You run three command in cmd or bash(where your pom.xml file placed) to get jar file and copy it into your WEB-INF/lib folder

    mvn compile
    mvn package
    mvn install
    

    I find only this way for resolved my problem:

    java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    
    0 讨论(0)
  • 2020-12-13 02:06

    Go to "Project properties -> Deployment Assembly page".
    This page describes how your application will be packaged for deployment or export. And added new source "Maven dependency".

    From Deployment Assembly page, Click Add... button Then select "Java Build Path Entries" "Maven dependency" should be in the list

    It solves the issue and all jar got copied to tomcat

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