Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Tomcat  Environment : This is the minimal runtime, which is identical to a pure Tomcat runtime. It only has Tomcat, Servelet, JSP, EL, JSTL available in the server-level classpath. If you want additional JarsJARs, you should package them with the Web application or place in Tomcat environment's extension directory.
  • Carbon  Environment : This consists of both the Tomcat environment and the WSO2 Carbon runtime. It does not provide CXF or Spring dependencies. If you want additional Jars, you should package them with the Web application or place in WSO2 Carbon environment's extension directory.
  • CXF Environment : This consists of the Tomcat environment, CXF and Spring. It does not provide the Carbon runtime. If you want additional Jars, you should package them with the Web application or place in CXF environment's lib directory.

...

To configure class loading, you should add the class-loading configuration in a file by the name webapp-classloading.xml, and place it in the META-INF directory of a Web application. All the artifacts related to a Web application is saved in <PRODUCT_HOME>/repository/deployment/server/<Web_Application_Type>/<Web_Application_Name>. For example, <PRODUCT_HOME>/repository/deployment/server/jaxwebapps/SampleApp.

Info
To use runtime environments other than Carbon, provide the webapp-classloading.xml file with correct configurations. Else, the application will be deployed in the default Carbon runtime environment.

...

You can share dependencies with a number of applications without packaging them with each and every one of them.To do this, place the common dependencies in the following directories depending on your environment.

  • In Tomcat Environment - <PRODUCT_HOME>/lib/runtimes/ext
  • In Carbon Environment - <PRODUCT_HOME>/repository/components/lib
  • In CXF or any Custom Environment – Use the environment's lib directory. For example, <PRODUCT_HOME>/lib/runtimes/cxf
Info

Practice caution when placing dependency files in Tomcat environment's ext directory as those dependencies will be visible to all other environments. For example, if you place incompatible Spring dependencies in <PRODUCT_HOME>/lib/runtimes/ext, it can cause problems with the existing Spring dependencies in the CXF runtime environment.

If there are such incompatible dependencies, the recommended best practice is to package them in the Web application in Tomcat environment itself. Libraries which are only used by a particular Web application can be put into <webapp_name>.war/WEB-INF/lib directory.

...

    • Upgrade the CXF runtime environment : You can replace the existing CXF/Spring dependent Jars JARs in the <PRODUCT_HOME>/lib/runtimes/cxf directory, with new CXF/Spring Jars JARs.

    • Instead of upgrading server-level CXF dependencies, you can package all the required Jars JARs in the Web-INF/lib directory of the Web application and deploy that in the Tomcat runtime environment.

If you want to add optional CXF/Spring jars JARs, copy them to <PRODUCT_HOME>/lib/runtimes/cxf directory after ensuring that they are compatible with the existing JarsJARs.

Note:
Info

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.