开发者

Jars not copied to Tomcat's lib folder

开发者 https://www.devze.com 2023-03-06 13:03 出处:网络
I am doing some basic spring stuff and stuck at some point. I am getting Clas开发者_JS百科sNotFoundException whenever I deploy my application on Tomcat.

I am doing some basic spring stuff and stuck at some point. I am getting Clas开发者_JS百科sNotFoundException whenever I deploy my application on Tomcat.

I observed that the jars are not copied to Tomcats lib folder. When I copied the jars manually to Tomcats lib folder it works fine.

Please let me know if I am making any blunder.

PS - I am using Spring tool suite 2.6.0,Tomcat 6 and its a Maven project.

Thanks.


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


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.


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号