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 Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21989870