Page 2 of 2

Re: Error - trying to load MD project using openAPI from eclipse

PostPosted: Fri Nov 09, 2018 8:35 am


Trying to launch My Commandline configuration file from com.nomagic.magicdraw.integration.demo.application application.

Code snipped as below:

ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject mdProject = workspace.getRoot().getProject("My Commandline");
IPath location = new Path("My Commandline.launch");
IFile file = mdProject.getFile(location.lastSegment());
ILaunchConfiguration launchConfiguration = launchManager.getLaunchConfiguration(file);
DebugUITools.launch(config, ILaunchManager.RUN_MODE);

Getting the following error

Launching failed. Bootstrap code cannot be found.

1. Please let me know whether the approach is correct to launch a osgi launch configuration file from eclipse rcp application , is it possible ?
2. RCP application com.nomagic.magicdraw.integration.demo.application does not start the magic draw ?

Thanks and Regards,

Sasi Kiran

Re: Error - trying to load MD project using openAPI from eclipse

PostPosted: Fri Nov 09, 2018 8:50 am

1) The code snippet you presented seems to use API that is part of Eclipse IDE. I'm not sure if it could be successful if used outside of IDE as part of RCP application.

2) The RCP application com.nomagic.magicdraw.integration.demo.application runs MagicDraw in process. In other words it does not launch it as a standalone application.

Re: Error - trying to load MD project using openAPI from eclipse

PostPosted: Tue Jul 28, 2020 6:08 am
Is this issue resolved?

I am also getting similar error. This is what I am trying to achieve.

I am writing a java application which will load the project file (testProject.mdzip) and print the details of the project. I am using the sample code provided in the cameo programmers guide.
Here is the code I am trying. I am getting the same error

Exception in thread "main" java.lang.NullPointerException
at com.nomagic.runtime.Bridge.GUIUtilitiesconfigureButton(
at com.nomagic.ui.ButtonsPanel.addButton(
at com.nomagic.ui.ButtonsPanel.<init>(
at com.nomagic.ui.SimpleBaseDialog.__init(
at com.nomagic.ui.SimpleBaseDialog.<init>(
at com.nomagic.ui.SimpleBaseDialog.<init>(
at com.nomagic.magicdraw.core.GUILog.showError(
at com.nomagic.magicdraw.core.GUILog.showError(
at com.nomagic.magicdraw.persistence.ProjectLoadService.handleLoadException(
at com.nomagic.magicdraw.persistence.ProjectLoadService.loadAndHandleErrors(
at com.nomagic.magicdraw.persistence.ProjectLoadService.loadAndHandleErrors(
at com.nomagic.magicdraw.persistence.xmi.load.model.utils.ProjectLoader.lambda$loadProject$1(
at com.nomagic.magicdraw.persistence.xmi.load.model.utils.ProjectLoader.loadProject(
at com.nomagic.magicdraw.persistence.xmi.load.model.utils.ProjectLoader.loadProject(
at com.nomagic.magicdraw.core.project.c.a(
at com.nomagic.magicdraw.core.project.ProjectsManager.loadProject(
at com.nomagic.magicdraw.core.project.ProjectsManager.loadProject(
at com.hcl.magicdraw.LoadMagicDrawProject.main(

public class LoadMagicDrawProject {

public static void main(String[] args) {
// TODO Auto-generated method stub
String projectFilePath = "C:/Temp/magicdraw/TestProject_01.mdzip";
ProjectsManager projectsManager = Application.getInstance().getProjectsManager();

File file = new File(projectFilePath);
// Create a project descriptor
ProjectDescriptor projectDescriptor = ProjectDescriptorsFactory.createProjectDescriptor(file.toURI());
projectsManager.loadProject(projectDescriptor, true);
System.out.println("Loaded project successfully");
Project project = projectsManager.getActiveProject();
System.out.println("Active Project is " + project);

Re: Error - trying to load MD project using openAPI from eclipse

PostPosted: Tue Jul 28, 2020 6:56 am
by marlel

I am not sure what exactly you want to do, but to access the OpenApi the application must be launched.
Please check the documentation ... batch+mode

Re: Error - trying to load MD project using openAPI from eclipse

PostPosted: Tue Jul 28, 2020 10:05 pm
I am trying to rebuild the OSLC Adapter which is built on MagicDraw. I am trying to rebuild it to use Cameo System Modeller. In that project also I am getting the same error while loading project. This project tries to expose the OSLC services on top of Cameo project files to query the data (like requirements, use cases etc.)

Here is the github project url : ...

If you see the method loadSysMLProject. It tries to do the same thing. First get the instance of the application, then start the application and try to load project.

if (project == null) {
// if (magicdrawApplication == null) { this does not support
// reloading of models
// launch MagicDraw in batch mode
magicdrawApplication = Application.getInstance();
try {
magicdrawApplication.start(false, true, false, new String[0], null);
} catch (ApplicationExitedException e) {
// TODO Auto-generated catch block
} catch (Exception e) {

projectsManager = magicdrawApplication.getProjectsManager();
if (!loadedProjects.keySet().contains(projectId)) {

final File sysmlfile;
if (OSLC4JMagicDrawApplication.useIndividualSubversionFiles) {
String[] filePathSegments = projectId.split("\\\\");
String fileDirName = filePathSegments[filePathSegments.length - 1];
String[] fileDirNameSegments = fileDirName.split("---");
String fileName = fileDirNameSegments[1];
String dirName = fileDirNameSegments[0];
sysmlfile = new File(magicdrawModelsDirectory + dirName + "/" + fileName + ".mdzip");
} else {
sysmlfile = new File(magicdrawModelsDirectory + projectId + ".mdzip");

// final File sysmlfile = new File(magicdrawModelsDirectory +
// projectId + ".mdzip");
ProjectDescriptor projectDescriptor = ProjectDescriptorsFactory.createProjectDescriptor(sysmlfile.toURI());
projectsManager.loadProject(projectDescriptor, true);

And the code fails with same error on projectsManager.loadProject(projectDescriptor, true)

Re: Error - trying to load MD project using openAPI from eclipse

PostPosted: Thu Jul 30, 2020 7:41 am

Thanks for sharing the link to the example of running Cameo in batch programs. I am trying to run the example program imagegenerator. With respect to this example I have following 2 questions.

1. I tried to run this example using the "Core batch program command line for Windows" which looks as below:

java -cp lib/com.nomagic.osgi.launcher-17.0.5-SNAPSHOT.jar;lib/bundles/org.eclipse.osgi_3.10.1.v20140909-1633.jar;lib/bundles/com.nomagic.magicdraw.osgi.fragment_1.0.0.201512211944.jar;lib/md_api.jar;lib/md_common_api.jar;lib/md.jar;lib/md_common.jar;lib/jna.jar -Dmd.class.path=file:C:/Apps/Cameo-SM-19sp4/openapi/examples/imagegenerator/ -Dcom.nomagic.osgi.config.dir=configuration -Desi.system.config=data/application.conf -Dlogback.configurationFile=data/logback.xml -Dmd.additional.class.path=openapi/examples/imagegenerator/imagegenerator.jar -Dcom.nomagic.magicdraw.launcher=com.nomagic.magicdraw.examples.imagegenerator.ExportDiagramImages com.nomagic.osgi.launcher.ProductionFrameworkLauncher project_file="C:\Apps\Cameo-SM-19sp4\samples\SysML\climate control system.mdzip" destination_dir=C:\temp\magicdraw

But while running this I get following error:Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter. Looks I am making some mistke in providing the system property -Dmd.class.path. I used the same properties_file#CLASSPATH but looks like something is not right.

2. In that example I see an exe to run the program. How to generate this exe for my own program is not clear in the documentation.

Any help in this regard will be highly appreciated.