简体   繁体   English

保持WAR文件和Tomcat lib文件夹中的jar文件之间的区别

[英]Difference between keeping jar files in WAR and Tomcat lib folder

I have web application. 我有网络应用程序。 I want Eclipse BIRT reports in that application. 我想在该应用程序中使用Eclipse BIRT报告。 Tomcat is not even started by memory error if i add BIRT jar files into Tomcat lib. 如果我将BIRT jar文件添加到Tomcat lib中,Tomcat甚至不会因内存错误而启动。

If build WAR with that jars only application runs

What is the difference and what is the problem behind this? 有什么区别,这背后的问题是什么?

Jars in Tomcat/libs are visible to all WAR files. 所有WAR文件都可以看到Tomcat / libs中的jar。

Generally there is no need to place JARs in Tomcat/libs. 通常,不需要在Tomcat / libs中放置JAR。 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. 只有当你的WAR文件非常大(比如50 MB +)并且它的大部分是第三方JAR时,才会这样做。 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. 在这种情况下,您可以移动所有不属于源代码的JAR,如Spring,Hibernate等,并将它们移动到Tomcat / Lib并部署更轻量级的WAR。 This may be needed only for Staging/Test/Production systems. 这可能仅适用于分段/测试/生产系统。

All the jars within the $TOMCAT/lib directory are visible to all the web applications deployed to tomcat. $ TOMCAT / lib目录中的所有jar对于部署到tomcat的所有Web应用程序都是可见的。 Where as the jars inside your war are only visible to the web application contained in the war. 战争中的罐子只能在战争中包含的Web应用程序中看到。

You normally would place the birt engine libraries inside your tomcat lib. 您通常会将birt引擎库放在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. 如果你在tomcat的lib目录中有birt引擎jar时启动tomcat有问题,那就是另一个故事。 You can show the errors you have so we can see how to fix it. 您可以显示您遇到的错误,以便我们了解如何解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM