Difference between keeping jar files in WAR and Tomcat lib folder

依然范特西╮ 提交于 2019-12-10 12:06:54

问题


I have web application. I want Eclipse BIRT reports in that application. Tomcat is not even started by memory error if i add BIRT jar files into Tomcat lib.

If build WAR with that jars only application runs

What is the difference and what is the problem behind this?


回答1:


Jars in Tomcat/libs are visible to all WAR files.

Generally there is no need to place JARs in Tomcat/libs. Only time one would do this is when your WAR file is very big (say 50 MB+) and bulk of it is third-party JARs. In such cases, you can move all the JARs that are not part of your source code like Spring, Hibernate, etc. and move them to Tomcat/Lib and deploy a much light-weight WARs. This may be needed only for Staging/Test/Production systems.




回答2:


All the jars within the $TOMCAT/lib directory are visible to all the web applications deployed to tomcat. Where as the jars inside your war are only visible to the web application contained in the war.

You normally would place the birt engine libraries inside your tomcat lib. But the actual reports and the code that excecutes your reports will be in your war.

If you have problems starting tomcat if you have the birt engine jars in the lib directory of tomcat, then that is another story. You can show the errors you have so we can see how to fix it.



来源:https://stackoverflow.com/questions/17429112/difference-between-keeping-jar-files-in-war-and-tomcat-lib-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!