Portlet Factory, Version 6.1.2


 

Dynamic class loading

Java classes may be dynamically loaded from the directory or directories specified in the bowstreet.dynamic.class.load.path property.

 

WebSphere Portlet Factory and WebSphere Portlet Factory Designer class and JAR directories

The default value of the bowstreet.dynamic.class.load.path property is the IBM® WebSphere Portlet Factory WEB-INF/work/classes and WEB-INF/work/lib directories of your project.

The following directories are used for the storage of Java class and JAR files in the WebSphere Portlet Factory project and web archive (WAR) file system:

WEB-INF/classes

A static directory used by WebSphere Portlet Factory to store class files. Classes are loaded when they are referenced and are not checked for changes. Server restart is required to refresh this directory and see class file changes.

WEB-INF/lib

A static directory used by the WebSphere Portlet Factory to store JAR files. JARs are loaded at application startup and not checked for changes. Server restart is required to refresh this directory and see JAR changes.

WEB-INF/work/classes

A directory used by WebSphere Portlet Factory Designer to store dynamically reloadable class files. Changes to class files may be used immediately without restarting WebSphere Portlet Factory Designer or the server. For more information, see How class loading works.

WEB-INF/work/lib

A directory used by WebSphere Portlet Factory Designer to store dynamically reloadable JAR files. Changes to JAR files may be used immediately without restarting WebSphere Portlet Factory Designer or the server. For more information, see How class loading works.

On the server side, if Java classes are not found by the classloader on the application server host, they may be loaded from the WebSphere Portlet Factory /work directories. On the WebSphere Portlet Factory Designer side, if the classes are not already loaded by the Eclipse classloader, they may be loaded from the project work/classes or work/lib folders.

 

How class loading works

Java source code that is placed in the project WEB-INF/work/source/ tree is compiled, and the output is stored in the project WEB-INF/work/classes tree. The contents of this directory are loaded dynamically and do not require a WebSphere Portlet Factory Designer or a server restart for changes to take effect. Any Java source changes can thus be seen instantly in WEB-INF/work/classes. This is useful for development where source code changes frequently.

Where JAR files are concerned, the WEB-INF/work/lib directory is the functional equivalent of the WEB-INF/work/classes directory.

 

Tips for working with class and JAR files

  • During development, keep classes and JAR files under the WEB-INF/work directory. Once development is complete, you can turn off dynamic class loading on the deployment machine to improve application performance.

    You can disable dynamic class loading by setting the following property to false in the WEB-INF\config\override.properties file:

    bowstreet.dynamic.class.load.checkTimestamp

  • Optionally create a separate project for managing your WebSphere Portlet Factory Java artifacts and create a JAR file for your resulting classes which you may then place in your WebSphere Portlet Factory WEB_INF/work/lib directory.

  • Use JAR files to distribute builders and other JAVA-based items that you create.

Parent topic: Overview: working with Java


Library | Support |