weird behaviour of eclipse osgi bundle - eclipse

I'm trying to deploy a few bundles I implemented along all the required bundles from Eclipse in order to run my own. Let's say, include the Equinox container also with my bundles so it is like an executable old-school JAR.
That said, when I try to run
java -jar org.eclipse.osgi_3.8.1.v20120830-144521.jar
Nothing happens...it just stays there doing nothing...even if I copy just that bundle to some other place and try the same, nothing happens...is this usual? I mean, I have done this successfully with older versions of this bundle (3.6) and it worked flawlessly.
Alas, I tried -debug flag to see if I could get some output, but only a complain about mission .options file is happening, nothing else.
Thanks,
Alex

Just in case someone has the same problem...having checked this link: http://docs.codehaus.org/spaces/flyingpdf/pdfpageexport.action?pageId=82903240, I created the configuration folder, a config.ini in it with the following contents:
osgi.bundles=org.eclipse.equinox.common#start, org.eclipse.update.configurator#start,
org.eclipse.core.runtime#start, org.eclipse.core.jobs#start,
org.eclipse.equinox.registry#start, org.eclipse.equinox.preferences#start,
org.eclipse.core.contenttype#start, org.apache.felix.gogo.runtime#start,
org.apache.felix.gogo.shell#start,
org.eclipse.equinox.app#start,org.eclipse.equinox.console#start,
eclipse.ignoreApp=true
osgi.noShutdown=true
This seems to work. I believe this is the minimum set of bundles required to run the Equinox OSGi container...from there, you can use the osgi shell to play with your bundles

You havent included -console option, that is the one that will open up the console view right?

Related

Eclipse JBoss hot code replace

I am using Eclipse 4.2 and JBoss 7.
I have Build automatically checked in Eclipse.
Even then I have to build and redeploy the EAR file to JBOSS to test any code changes I make in Eclipse debug mode.
Am I missing something here?
THanks,
What the "Build automatically" option in eclipse do is that when you modify the source code of a class, this one will be automatically compiled, which doesn't mean that all the whole project that contains the class (i.e. war, jar, ear ...) is redeployed in the server. But of course it helps in the speed of deployment, because the classes you've been modifying are already compiled when you manually build or deploy the project.
On the other hand, to avoid problems with redeployments, you'd better set up JBoss to delete the files related to the application keeps in the work directory, when the application is undeployed / redeployed. Look at this stackoverflow thread for more information.
Concerning the "Build automatically" option:
In order for the Deployment Scanner in JBoss to work, you have to have it turned on in JBoss.
Also, you need to add your project to the JBoss server in the Servers window. Look for the "Add or Remove..." option.
Once your project is added, any changes you make to your code will get detected and your module will be redeployed automatically in the background. Failing that and assuming your project doesn't have a snag, you can use mvn install & mvn jboss-as:deploy to manual update your module.
Beware, sometimes mvn doesn't pick up the latest java code. This seems to be a project configuration issue more than anything. Re-creating the project seems to correct the issue.
Also, keep an eye out for duplicate persistence.xml files.
You only need one.

Debug Karaf bundles in Eclipse: persist dev:watch URLs/IDs?

I want to be able to easily debug an OSGi bundle running in Apache Karaf from Eclipse. The easiest way I've identified so far is to create a Java Application launcher that starts Karaf. If the bundle was previously installed then I can set breakpoints, even in the activator, and all is good.
The issue is that when a change is made to the code, mvn install invoked, and then the Eclipse Karaf launcher invoked, I am running the old cached version of the bundle. I have played with running Karaf from the command line, installing my bundle with a Maven URL, and using dev:watch with success. But I have found that the dev:watch URLs are not persisted. Thus, when starting Karaf from Eclipse, there are no watched URLs (the previous ones were lost when Karaf was shutdown) and new versions of the bundle are not installed.
Is there a way to get the dev:watch URLs to be persistent? I looked for either properties that might hold the URLs or even Karaf command line options that could be used to specify the URLs with no luck. I even tried to add the dev:watch command to etc/shell.init.script but I get this message at Karaf startup “Error in initialization script: Command not found: dev:watch.” I assume this means the command was run too early in the Karaf startup sequence (dev feature not yet started?).
Any help would be appreciated, even alternate ways I haven’t considered to easily debug bundles running in Karaf from Eclipse. The goal is to avoid needing to use manual commands such as osgi:install every time the code changes.
The Karaf team is now also working on a better integration with EIK, but at the current time it's not yet as deeply integrated as it would be needed.
Therefore your provided way is basically the best way in doing debugging.
Build your application with maven, do a dev:watch when your karaf is up and running.
Since dev:watch is a "Development-Time" command it's not intended to be persistent. But you still have the history to choose from and of course you're able to provide multiple bundle IDs to the command.

Easiest way to deploy OSGi framework from Eclipse?

I am developing a server with Jetty (servlet container). I am successfully running the server within Eclipse with an osgi-framework run configuration. Everything fine.
What is the best way to export this run configuration so that I have a valid config.ini and all plugins (the workspace bundles and the ones from my target platform) and am able to run the osgi-framework without Eclipse IDE running.
I tried to make a product to get the config.ini and all the bundles but I cannot run the framework with java -jar org.eclipse.osgi_3.6.2.R36x_v20110210.jar.
It is not finding the bundles in the plugin folder, because obviously the names do not match exactly (e.g.: com.mine.at-3.3.-3234234.jar instead of com.mine.at.jar)
There are about 150 bundles and I do not want to edit the config.ini manually.
What did I miss?
What worked pretty well for me was to make a new product, based on the (working) run configuration, and export the product. That project should then be 'runnable', or at least pretty close.
Did you try that?
Hope it helps, Frank

Eclipse RCP- org.eclipse.ui.plugin missing

I've written an Eclipse RCP application that runs fine in Eclipse, however, packaging it to be a standalone application has been tricky. I've worked my way though a few class path errors, but now I'm getting a new one.
After running the export wizard and launching my application, it throws a ClassDefError and ClassNotFoundException, specifically it's looking for org.eclipse.ui.plugin.AbstractUIPlugin. I did not find this in my copy of the eclipse SDK, and I downloaded the SDK again to be sure, and still couldn't find it. I found a jar online that supposedly contained the fiel along with some other eclipse packages, however, I then got this:
NoSuchMethodError: org.eclipse.ui.plugin.AbstractUIPlugin: method ()V not found
I figure the problem is more I did something wrong rather than this class is actually missing, but I've gone though all the configurations and I'm sure all the required packages and dependencies are included. Any ideas?
Download and install the new version of adt plugin 21.0.0.
Does your application works when you run from Eclipse? If so then try to open your plugin.xml, go to Runtime and on the bottom right part of the window you should see Classpath. Try adding the required plugins there.

Eclipse RCP: How to troubleshoot plugin dependencies & classpath problems?

I am working on an RCP project based on eclipse. It has been working fine but recently I thought I'd upgrade it to use a new eclipse version (3.2 -> 3.5).
After a bit of trouble, it was running on the new platform. Then I did something. Don't know what. The end result is that I'm now getting a classpath error when one of my plugins (A) tries to access a class in one of the dependent plugins (B) (also one of mine).
As far as I can see, Plugin A has Plugin B in its' dependency list and the compiler shows no errors. To test, I created a new Plugin C with one class and accessed the class from Plugin A. That works fine.
Does anyone have any hints for troubleshooting such issues? A checklist of settings to check? I've been struggling with this for hours and getting nowhere! Particularly frustrating as it was working until I changed something!
Thanks
Update
I should also say that the project is quite old and uses the plugin.xml and not the manifest. Could this be a problem? Is there a way to upgrade?
Some ideas:
Clean-and-build every project (maybe after a restart of Eclipse)
Check, whether the required packages are also exported
Check the Error log, maybe there is some unloadable plug-in, etc.
Check the Run configuration, whether every required plug-in is present there
If the problem does not happen in a Runtime workbench, but in an Exported RCP app, then check whether you compile the project with the same settings during export than in Eclipse
I hope, something helps about these.
You can try the following in your run configuration:
In the Main tab check Clear (workspace) under Workspace Data
In the Configuration tab check clear the configuration area before launching under Configuration Area
This helps me every time I encounter some strange ClassNotFound errors.
If I understand you correctly you have no compiler errors but when you run you get class not found exceptions? You could try PDE Tools > Update Classpath from the project's context menu to see if you declared any dependencies outside of the MANIFEST.MF file, which would result in compiling code that fails at runtime.
I developed for RCP quite a long ago, but if I'm not wrong, since 3.4 or 3.5 you have to declare in the plugin configration which packages/classes are exported for dependent plugins and which are not.
This is unlike the old convention of using 'internal' in the package to mark non-exported packages.
Since you have plugin.xml from very old version of eclipse, it might be the problem, as exported resources from one plugin to another were not enforced in Eclipse RCP 3.2.
One more complement, hope it helps.
Open plugin.xml, check "build" tab, see how "binary build" are configured. It affects which files will compiled and exported.
See binary build here : http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Feditors%2Fmanifest_editor%2Fbuild.htm