Missing dependency while product export - eclipse-rcp

I created an RCP Plug-in project using template "Eclipse 4 RCP Application" (Plugin A)
I then created another Plugin-in project to contribute to Plugin A(Plugin B)
In the MANIFEST.MF file of Plugin A, I added Plugin B in the list of "Required Plug-ins"
under "Dependencies" tab, since Plugin A uses some classes defined in Plugin B.
When I try to run my product file, which is in Plugin A, it runs without any errors but when I try to export my product file using "Eclipse export wizard", it fails with below error
"A problem occured while invoking the director"
When I logged the error to a log file it showed below message
Missing requirement: Plugin A requires 'osgi.bundle; Plugin B' but it could not be found.
Eclipse is not able to find Plugin B. Am I missing something here? Are there any more configuration required?

Related

Eclipse RCP: Plugin does not start

I wrote a new plugin for my eclipse rcp application and added the plugin to the dependencies of my product. I also tried to set the auto-start value of the new plugin to true but it does not start. It shows up as resolved but not as started.
Basically the only thing that this plugin does is to add a help file (table of contents) via the extension point org.eclipse.help.toc.
Any idea why the plugin code isn't executed?
Also: the plugin adds its content if I execute it from inside eclipse. The problem occures after I export it.
Just to be clear ... you're not expecting 'code' to run, but when you launch the exported RCP application standalone, the help contents does not appear in the TOC, right?
How did you define your RCP product? As a feature or plug-in based product?
If based on plug-in's, did you define all the necessary plug-in's on the product dependencies tab?
If based on features, did you add the new plug-in to the feature?

JPA Facet cannot be activated in Eclipse

If I try to activate the "JPA Facet" for my Eclipse (Juno) project and point it to a user library containing the JPA libraries (in my case OpenJPA) I get the error:
"The class 'javax.persistence.Entity' is required to be in the selected libraries."
But this class is present there!
"Solution": The JPA libraries were contained in an Eclipse project folder. If I copy it somewhere outside and create another user library with them it works perfectly (although it has exactly the same content as the one before with the libraries located in the Eclipse project!). Seems like an Eclipse bug...
Just create a user library that contains the javax.persistence... JAR in it (It is located in Eclipse/plugins) and add this library at "JPA Implementation"
I'm using Spring Tool Suite (STS). The problem I was facing is that in the default installation the M2E-WTP plugin does not include the Optional component "m2e-wtp - JPA Configurator for WTP".
So I went to Help -> Eclipse Marketplace... and searched "m2e-wtp".
Click on the Installed button and it will become Change. Click on the Change button and select the optional component "m2e-wtp - JPA Configurator for WTP". Apply changes.
This solved for me.

Runtime error of NoClassDefFoundError when a eclipse plugin depends on other eclipse plugin

I have an eclipse plugin project com.prosseek.asttest, and I spin off a new plugin project com.prosseek.impactAnalyzer that has one class CallHierarchyGenerator.java. Now asttest project depends on impactAnalyzer project. I had no choice but to make impactAnalyzer project eclipse plugin as it uses JDT library.
After setting up the build path in com.prosseek.asttest, it builds without a problem.
However, when I execute the plugin, I got an error missing CallHierarchyGenerator.java class.
What might be wrong?
If you are running this as an OSGI or Eclipse Application, you need to explicity export packages as available to other plugins as by default they are not. Open your manifest editor in plugin 1. Click on the runtime tab and add the packages as "Exported" then the class loader in blugin 2 will be able to find it.
Also looks like you might be doing the class path configuration wrong. in plugin 2 make sure you add plugin 1 as a dependency in the dependencies tab of the manifest editor. Looks like you are doing a dependency configuration as if it were a regular java application
Based on Duncan's answer, I could fix this issue.
Export packages in impactAnalyzer
Actually I didn't add it manually, but it's already exported, as (I guess) I did it with Quick Assist automatically.
Required Plug-ins
I had to Add com.prosseek.impactAnalyzer in the dependecies.
Run configuration update
I had one more step to do, I had to open run configuration to add required plug-ins.
Export the plugin
When exporting the asttest plugin, I also had to export impactAnalyzer also.

Problems building Eclipse RCP application

I'm trying to build a Eclipse RCP application with Maven/Tycho based on features. My application is a simple language with an editor (built within help of Xtext) and a few other plugins which are dependencies to the project. There are a few howtos which describe how to create a Eclipse RCP application, e.g.
http://mattiasholmqvist.se/2010/03/building-with-tycho-part-2-rcp-applications/
or
https://kthoms.wordpress.com/2010/11/12/setting-up-a-rcp-product-for-a-dsl/
So far, what have I done:
Created a plug-in project which contains a feature.xml. The feature.xml consists of the language plug-ins and its dependencies
Created a plug-in project which contains a product definition. The product definition is named after the plug-in projects name (Mattias Homlqvist (first link in this post) emphasizes that Tycho makes assumptions about the product file name (in relation to the plug-in project name)). In the product definition I've created a new product and point to the 'org.eclipse.ui.ide.workbench' application. I've also added my feature plug-in and org.eclipse.pde and org.eclipse.rcp features to the dependencies tab in the editor.
If I'm trying to run the product I get an exception:
java.lang.RuntimeException: No application id has been found.
at org.eclipse.equinox.internal.app.EclipseAppContainer.
startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.
run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.
runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.
start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.
invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.
invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Okay, something went terribly wrong. Now, I'm checking if all required plugins are added in the run configuration dialogue in the "Plug-ins" tab. So, the product and feature plugin are not selected. If I press 'add required plug-ins' the product plug-in is added, pressing 'validate plug-ins' just pop up and says 'no problems detected'. If I try again to run the product I get the same exception. Pressing 'synchronize' in the product definition editor reverts my changes I've made (product and feature are de-selected) - and I'm wondering why?
The Maven/Tycho build itself seem to work. If I'm trying to build the project with
mvn install
zip files for the corresponding platforms are created. Unfortunately the problem still exists and the build is not executable. So, probably I've made a terrible mistake in my feature and/or product plug-in project. Maybe somebody has an idea or could point me into the right direction?
Thanks in advance!
I had a similar problem and for me it worked to check "Add new workspace plug-ins to this launch configuration automatically" in the run configuration, the "Plug-ins" tab.
You might also check the Auto-Start (for me, "default" worked).
Best regards.
your product should be 'feature based' and in your feature, you should add the same plugins you added on your plugin.xml
plus, in the 'included feature' tab, you should add org.eclipse.rcp feature

Eclipse rcp plugin added to the target can be resolved at compile time, but not run time

I've added a plugin to the target platform of my RAP application. I can reference it without issue without any problems while working on the project, and the compile happens without errors. The plugin also shows up in the plugin dependiencies library of my build path. However, when I run the application, the osgi framework gives me the exceptionA
org.osgi.framework.BundleException: The bundle "ate_rap_1.0.0.qualifier [98]" could not
be resolved. Reason: Missing Constraint: Require-Bundle: com.richclientgui.rcptoolbox;
bundle-version="0.0.0"
How do I add a plugin so that I can use it with my application?
First of all, do not use plugin dependencies when you work with OSGi. OSGi doesn't know about your those dependencies in your IDE, it only cares for the dependencies that a bundle defines in its bundle manifest. Therefore, you have to define a dependency in the MANIFEST.MF (Dependencies tab) instead.
Second, you have to add this bundle to your launch configuration. In Eclipse, go Run... -> Run Configurations... Select your launch config, go to the Bundles tab and check your additional plug-in. Before you launch, click on "Validate Bundles" in the Bundles tab.
Is your application built from a PDE feature? If so you may need to add the new plugin to the list of plugins included in your main feature.
To add a plugin to a basic RAP application, select File->New->Other and in the wizard, select Plug-in Development->Plug-in from Existing Jar Archives. This will create a project hosting that plugin which may be added to the build path. After adding to the build path, add this plugin as a dependencies in your MANIFEST.MF. Finally, in the run configuration for the application, select the Bundles tab and make sure the bundle you want to add is checked. This is easily done with the "Add Required Bundles" button. Now the project should run in Eclipse with the bundle.