Show TOC

Specific Class Loading Use CasesLocate this document in the navigation structure

Use

SAP NetWeaver Application Server Java (AS Java) provides implementation of Java EE 5 application server components. AS Java also allows an application to use an alternative implementation of a Java EE component or any other standard component offered by the application server.

Using an alternative component

There are three use cases in which you may want to use an alternative implementation of a component.

Single application

When there is only one application in the landscape that requires the usage of an alternative component, you can assemble the alternative component into the application so that it is loaded by the application heavy class loader.

Multiple applications without objects exchange

When multiple applications that do not communicate between each other, or communicate only via Remote Method Invocation (RMI), require the usage of an alternative component, all the applications should assemble the alternative component, so that it is loaded by the application heavy class loaders.

Multiple applications with objects exchange:

When multiple applications that communicate between each other through direct calls require the usage of an alternative component, you have to use a prepend statement:

  • Assemble the alternative component in an own application (A) so that it is loaded as a heavy class loader.

  • All other applications (B, C) that require the usage of the alternative component declare in their application-j2ee-engine.xml deployment descriptor a prepend reference pointing to application A.

    Specify the following snippet in the application-j2ee-engine.xml :

<reference reference-type="hard" prepend="true"> <!-default is false-->

<reference-target provider-name="sap.com" target-type="application">A</reference-target>

< /reference>

With this declaration, applications B, C, and so on, will receive a transitive reference to the heavy class loader of the referenced application A, thus loading the alternative component with priority over those provided by AS Java by default.