IBM Support

How to use IBM Rational Rhapsody API plug-ins with third-party runtime libraries.

Question & Answer


Question

How do I configure third-party runtime libraries with IBM Rational Rhapsody API plug-ins?

Cause

You are experiencing the following runtime errors or the third party library does not appear to be loading:


  • java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoClassDefFoundError: <NameOfThirdPartyLibClass>


  • java.lang.UnsatisfiedLinkError: <NameOfThirdPartyDLL> (Not found in java.library.path)

n.b. To monitor runtime plugin errors from Rhapsody, add this line to the [General] section of your rhapsody.ini file: JavaAPILogFile=c:\logfile.txt

Answer

You must specify the JAR file and directory location of the native DLL in the JavaClassPath and JavaLibPath fields. This can be done in the rhapsody.ini file or your plug-in's own.hep file. For example:

The third-party JAR and dll are located in C:\ThirdPartyLibs folder. The following shows the two different methods. Modifying the rhapsody.ini file or adding to a stand-alone hep file:

1. Modify the rhapsody.ini


    [JVM]

    JavaLocation=C:\Rhapsody8.0.5\jreOptions=ClassPath,LibPathClassPath=-Djava.class.path=C:\Rhapsody8.0.5\Share\JavaAPI\rhapsody.jarLibPath=-Djava.library.path=C:\Rhapsody8.0.5\Share\JavaAPI

    so that the ClassPath and LibPath equal:

    ClassPath=-Djava.class.path=C:\Rhapsody8.0.5\Share\JavaAPI\rhapsody.jar;C:\ThirdPartyLibs\ThirdParty.jar

    LibPath=-Djava.library.path=C:\Rhapsody8.0.5\Share\JavaAPI;C:\ThirdPartyLibs


2. Adding third-party libraries to the hep file with.hep files the fields are JavaClassPath and JavaLibPath. For example, C:\Rhapsody\Samples\ExtensibilitySamples\Simple Plug-in\SimplePluginProfile.hep.

    #REM: Definition of the plug-in

    name1=SimplePluginJava

    MainClass1=com.ibm.rhapsody.samples.plugin.SimplePluginJavaClassPath1=C:\Rhapsody\Samples\ExtensibilitySamples\Simple Plug-in;C:\ThirdPartyLibs\ThirdParty.jar

    JavaLibPath1=C:\ThirdPartyLibs

    isPlugin1=1

    isVisible1=1

    DLLServerCompatible1=1

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.5;8.0.6;8.1;8.1.1;8.1.2;8.1.2.1;8.1.3;8.1.4;8.1.5","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21989870