Show TOC

Procedure documentationUsing Shared Libraries Locate this document in the navigation structure

 

Shared libraries are installed separately and can be used by multiple applications. According to the Java EE specification, the libraries are represented by JAR files. They can reference other shared classes or resources packaged in a separate JAR file or directory, which are included in the same application package, or previously installed in the Java EE containers.

To use shared libraries, you have to deploy them as external applications, and set the appropriate class loader references to these libraries in the application-j2ee-engine.xml of the referencing applications.

Procedure

Creating Shared Libraries
  1. Create an Enterprise Application project.

  2. Select the project in the Project Explorer.

  3. In the context menu, choose   Properties   Java EE Module Dependencies  .

  4. Select the library archives you want to add.

    • Choose Add JARs to locate JAR files within the Developer Studio workspace.

    • Choose Add External JARs to locate JAR files outside the Developer Studio.

Referencing Shared Libraries

To use a shared library, set an application-to-application reference in the application-j2ee-engine.xml file of your application.

Example Example

  1. <application-j2ee-engine 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">
    	<reference reference-type="hard">
    		<reference-target provider-name="sap.com" target-type="application">a1</reference-target>
    	</reference>
    	<fail-over-enable mode="disable" xsi:type="fail-over-enableType_disable"/>
    	<start-up mode="manual"/>
    </application-j2ee-engine>
End of the code.

Result

You are now ready to build and deploy your library component.