Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos
h3. Requirements    In this WebLog I describe two release-specific (SAP NetWeaver 7.0 and CE 7.10) solutions to use the same external JAR file in different Web Dynpro development components fulfilling three main requirements:   h4. Central storage place     The JAR file is stored in a central development component. To keep this JAR file independent from the runtime environment, we use a non-deployable External Library development component. With this "single-source" approach we avoid, that the same JAR file is physically stored in different development components   h4. Compilation at design time    At design time, the JAR file is needed by several Web Dynpro development components for compilation or build time purpose. As clients of the JAR file we name them Web Dynpro client development components here. The External Library development component comprising the JAR file must therefor expose it in a puplic part of type compilation.   h4. Classloading at runtime     At runtime, the JAR file must be doployed at the SAP NetWeaver AS Java so that the Web Dynpro Java runtime environment can load the JAR file's classes. To deploy the JAR file to the server we have to wrap its embedding (non-deployable) +External Library development component+ in a separate deployable development component of type +J2EE Server Component/Library+. The External Library development component must therefore expose its comprised JAR file in another puplic part of type assembly.  In this case the JAR file is added to the deployable archive of its deployable "wrapper" development component (using the second public part). By deploying the wrapper development component to the SAP NetWeaver AS Java the JAR file gets also deployed to the server to be found by the class loader at runtime.     To load the JAR file's classes at runtime inside the Web Dynpro client development component, the Web Dynpro Java runtime must additionally know the fully qualified name of the development component comprising the JAR file. We therefore have to define a runtime dependency between the Web Dynpro client development component where the JAR file's classes are invoked and the J2EE Server Component/Library development component comprising them. In SAP NetWeaver 7.0 this runtime dependency is defined as Library reference in the properties of a Web Dynpro development component. The Library reference entry must be the technical name of the J2EE Server Component/Library development component. For example,*vendor.org/jsclib~ext~exlexp* is the technical name of a J2EE Server Component/Library development component with name *vendor.org/jsclib/ext/exlexp*.   +*Note*: Using Web Dynpro Java Helper Classes+  +To implement and reuse own Web Dynpro Java specific Java utility or helper classes like classes for sorting or filtering tables to be invoked in your Web Dynpro controllers, you do not need to create and deploy a corresponding JAR file. Simply implement these helper classs in folder src of a Web Dynpro development component, build and deploy it to the SAP NetWeaver AS and expose the classes to other Web Dynpro development components in a public part of type compilation.  + h3. Solution in SAP NetWeaver 7.0 SP9  The solution fulfilling all these requirements in SAP NetWeaver 7.0 is illustrated below:  *How to!*   * Expose the same JAR file in two separate public parts, one with purpose assembly (1) and another one with purpose compilation (2). * Use the public part with purpose compilation in the Web Dynpro "client" development component where you need the JAR file to implement your Java code, for example, inside a Web Dynpro component controller class (3). *  Add a development component of type  *J2EE Server Component/Library*, and use the second public part (of type assembly) of the External Library development component  there (4).0.1.  Define a *Library reference* to the J2EE Server Component/Library development component in the project properties of theWeb Dynpro client development component, where classes and interfaces of the external JAR file are invoked (5). In the properties window select Web Dynpro References - Library references and enter the technical development component name like "*vendor.org/jsclib~ext~exlexp*".0.1.   0.2. Deploy the development component of type J2EE Server Component/Library "wrapping" the External Library development component to the SAP NetWeaver AS Java (6). 0.3. h3. Solution in SAP NetWeaver CE 7.10
11 Comments