Quantcast
Channel: raphael.vogel
Viewing all articles
Browse latest Browse all 11

How to use external libraries in the SAP component model (PART I)

$
0
0

Since I had a lot of trouble using external libraries in the SAP component world, I decided to share the knowledge in this weblogs. This blog shows you the neccessary steps to use an external library DC in your Java application using SAP NW CE 7.1. Part I gives you the necessary background and Part II really shows you how to do it in the NW Dev. Studio.

External Libraries can be deployed on the AS Java in two different ways.

  • As standalone library. In this case, the application is deployed as an EAR archive and other  applications on the AS Java can use this external library too.
  • As bundled library. The external library is packaged and deployed with your own application.

 

Bundled case: You have your own application consisting of 3 DC's. A web module DC (Web DC), a EJB module (EJB DC) and the EAR project (EAR 1 DC). Your external library is packed in the extLib DC, which is packaged into the EAR 1 DC and also deployed with the EAR 1 DC. 

image

The EAR 1 DC must have dependencies (build time) to the assembly public part of the EJB DC and the assembly public part of the Web DC. This dependencies are created automatically, when you assign your Web and EJB modules to your EAR project. Public parts of type assembly can be packaged into the build result of the EAR file for deployment reasons. This means that the WAR archive (from the Web Module), the EJB.jar archive (from the EJB module) and the external library jar file are added to the EAR 1 DC.

If you want to bundle an external library with your EAR 1 DC, you must first create a DC of type external library and also create a dependency from your EAR 1 DC to the assembly public part of your external library DC. After you have defined this dependency the external library files are automatically added to the EAR 1 archive and finally deployed with the application.
In order to use the external library classes for example in your Web DC, you must additionally add a dependency from your Web DC to the compilation public part of your external library DC.

 

 

Standalone case: You have your own application consisting of 3 DC's. A web module DC (Web DC), a EJB module (EJB DC) and the EAR project (EAR 1 DC). Your external library is packed in the extLib DC, which is packaged in the corresponding EAR 2 DC. You can now deploy your external library (EAR 2 DC) like any other application. To use the external library from your application, you have to set a runtime dependency from your EAR 1 DC to the EAR 2 DC.

image 

If you want to deploy your external library standalone, you must create a external library DC and a new EAR 2 DC, which references the assembly public part of your external library DC. After you have defined this dependency the external library files (jar files) are automatically added to the EAR 2 archive. The EAR 2 DC can now be deployed like a normal application.
If you want to use the external library in your own application (EAR 1 DC), you must add a runtime dependency between your EAR 1 DC and the EAR 2 DC.
To be able to use the library classes for example in your Web DC, you also must add a dependency from your Web DC to the compilation public part of your external library DC.  

In the next blog, I willl show you step by step how to do this in NW Dev. Studio

---


Viewing all articles
Browse latest Browse all 11

Trending Articles