Class and JAR file locations

Deployed WAR files have two subdirectories that can contain Java classes; WEB-INF/classes and WEB-INF/lib. If you make any changes to a Web application, redeploy it. Do not manually copy files to these locations.

The class loader for a Web application (where app_name is the name of the Web application) loads files in this order:

  1. From the Web application’s class loader:

    • deploy/webapps/app_name/WEB-INF/compiled_jsps – JSP implementation classes.

    • deploy/webapps/app_name/WEB-INF/classes – for class files used by servlets and JSPs in the Web application.

    • deploy/webapps/app_name/WEB-INF/lib – for classes contained in JAR files. All JAR files in this directory are automatically part of the Web application’s effective class path.

  2. From the application’s class loader

  3. From the lib-default-ext class loader – this points to the JAR files in $DJC_HOME/lib/default/ext

  4. From the system class loader

Sharing EJB classes

To share your EJB class files, store your EJB-Jars and Web applications inside an EAR file, which establishes class sharing. However, if you want to separate EJB Jars from the Web application, the ideal way to share the classes is to set the Web application’s parent class loader to that of the EJB components, using deploy with the -parentCL option. For example, to set the parent class loader of mywebapp to the EJB myejb, which allows the Web application to access the EJB classes enter:

deploy -parentCL ejb.components.myejb mywebapp.war