Show TOC

Procedure documentationUsing Heavy Class Loaders Locate this document in the navigation structure

 

Besides the normal class loader, an application can also have a heavy class loader. Its purpose is to load the classes from the archives bundled into the application with highest priority, before all other resources referenced by the application.

Prerequisites

Heavy class loader behavior is switched on.

Procedure

  1. Pack your custom classes as a bundled library in the application.

    Note Note

    It is mandatory that:

    • The application packing your custom libraries is a Java EE 5 application – this is recommended. For Java EE 5 applications heavy class loader is always created. If it is developed before Java EE 5, then you should use XML tag <enableHeavyClassloadingBeforeJavaEE5/> which must be left empty in file META-INF\applicaton-service.xml.

    • All the custom libraries are located either in the /lib folder or in a folder which is defined as a value of XML tag <library-directory> in application.xml.

    End of the note.
  2. Deploy your application or applications.

Example

You can check that your libraries have been loaded by the heavy loader with the llr command in telnet. The example that follows below concerns an application that packs classes from the Hibernate framework for heavy class loading.

Example Example

  1. >llr com.vendorX/Hibernate-library-loader
      Loader name:
        [com.vendorX/Hibernate-library-loader]
      Direct parent loaders:
        [library:javax~persistence~api]
        [library:ejb_api]
      Direct child loaders:
        [com.vendorX/Hibernate]
      Resources:
       C:\usr\sap\CE1\...\app_libraries_container\lib\jboss-archive-browsing.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\lucene-core-2.0.0.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\asm-attrs.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\antlr-2.7.6.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\commons-collections-2.1.1.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\commons-logging-1.0.4.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\javassist.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\hibernate3.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\log4j-1.2.11.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\hibernate-annotations.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\hibernate-entitymanager.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\cglib-2.1.3.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\ehcache-1.2.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\dom4j-1.6.1.jar
        C:\usr\sap\CE1\...\app_libraries_container\lib\asm.jar
    
End of the code.

More Information

Heavy Class Loaders