I am using the Optional class from Guava library in a plugin class for IBM Rational Rhapsody.
When I run the class as a plugin from inside Rhapsody, the call to the Optional class causes "java.lang.NoClassDefFoundError" error, although when I call it in my class main method and run my class as a java application it works fine. Here is the code:
package com.example;
import com.google.common.base.Optional;
import com.telelogic.rhapsody.core.IRPApplication;
import com.telelogic.rhapsody.core.RPUserPlugin;
import com.telelogic.rhapsody.core.RhapsodyAppServer;
public class Test extends RPUserPlugin{
public static void main(String[] args) {
IRPApplication rhp = RhapsodyAppServer.getActiveRhapsodyApplication();
Optional<IRPApplication> app = Optional.of(rhp);
doSomething(app);
}
/**
* this is called by rhapsody
*/
@Override
public void RhpPluginInit(IRPApplication rpyApplication) {
IRPApplication rhp = RhapsodyAppServer.getActiveRhapsodyApplication();
Optional<IRPApplication> app = Optional.of(rhp);
doSomething(app);
}
}