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.
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.
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.
In the next blog, I willl show you step by step how to do this in NW Dev. Studio