In most scenarios, Web applications which are deployed in production environments depend on external, third-party libraries for different functionality. However, the Web application management feature provides capability to load classes from different locations. Therefore, it is important to understand how you can place your external dependencies within a running Carbon server in the manner most suitable to your requirements.
Web Applications deployed in the Carbon Server can load classes from two locations.
- <CARBON_HOME>/lib
If you want to share the same library between two Web applications, you can copy it into this location.
- <webapp_name>.war/WEB-INF/lib
Libraries which are only used by a particular .war file can be put into this location.
Note:
Practice caution when copying libraries to location 1. A conflict with the existing libraries can change the behavior of the server. It is recommended to use location 2 whenever possible.
Note:
Class loading pattern for Web applications is always child-first. You can't change this. Therefore location 2 is always given the highest priority when the same library exists in both locations.