How do you debug a problem in the Activator of an Eclipse plug-in?
I am trying to follow an OSGi bundle tutorial (http://www.vogella.de/articles/OSGi/article.html). It includes this method in the Activator class开发者_JAVA百科:
public void start(BundleContext context) throws Exception {
System.out.println("Starting de.vogella.osgi.firstbundle");
}
public void stop(BundleContext context) throws Exception {
System.out.println("Stopping de.vogella.osgi.firstbundle");
}
Unfortunately, the println statements don't print even though the tutorial writer expects them to print. I am obviously new to OSGi and Eclipse, so I am quite lost. Can someone help me along?
Well, I said I was confused. The tutorial mentioned above runs the first demo in Eclipse, but quickly shifts to a standalone container. I got that to work, but broke off for the night and when I came back in the morning started using the built-in OSGi console to follow the standalone instructions. This doesn't work very well and results in the odd behavior described above. When I went back to the standalone container as directed in the tutorial it works better.
I'd assume your plugin isn't even started, or eclipse has no reasons to load your plugin (eclipse does lazy loading of plugins so activate a view of your plugin or something).
If it's the first problem make sure that under Run Configurations->Plugins "Launch with all workspace and enabled Plugins" is selected (that's the easiest to make sure that the plugin and its dependencies are all loaded).
精彩评论