OSGi equinox bundle stays always in the state "RESOLVED" - osgi

I've created one main bundle in which one I've installed the equinox p2. Then I export it to obtain an executable. My executable works correctly.
I've also created one other Bundle that interacts with the first one. In eclipse, if I create a product configuration with these 2 bundles and run the product, everything works.
After that, I export my second Bundle as a "deployable feature" and then I install this bundle wihtin my application via the "help->install new software". I'm able to install it, however my Bundle stays always in the state "RESOLVED" even if I restart my application. I'd like to set the state as "ACTIVE".
Do you know if I can configure somehting to autostart my bundle as I did in my "Product configuration"? Or is there an another solution?

Try to start your bundle manually with the commandline command "start ". It seems that there are some problems in BundleActivator of your bundle. You should get some logs (errors/warnings).

The RESOLVED state is not an error state, it simply means nobody has activated your bundle. Why do you need it to be ACTIVE? Is there some other error caused by the fact that it is not ACTIVE?
Otherwise, if your application is working then just don't worry about it.

Related

Service not removed after uninstall the application

I have created the setup of window form application using visual studio setup project.
It install fine and works fine my application.
But when i uninstall the application it uninstall properly without any error, but the service of the application does not remove from services.
I don't know why this happens.
Please somebody help me. thank you in advance.
I have a same issue in my application.
I just add the window restart code in installer class, so when i uninstall the application system restarts and application process & service both have removed.
There are a few possible reasons for this:
You did not add your installer class to every node of the custom actions list in your setup project. In other words, maybe there is no uninstall custom action so the service won't be uninstalled.
If there is an uninstall method, it will typically not stop your service unless you do that, by adding shutdown code to an override, before base.Uninstall(). That means it will attempt to uninstall it, probably mark it as Disabled in the services applet and remove it at the next reboot.
You might be using Installer classes (without using custom actions) and trying to run InstallUtil.exe. This is not the right way to do it, but if you didn't run it as uninstall custom action then you haven't uninstalled, and number 2 still applies. Finding InstallUtil.exe to do this is not safe anyway.
Having said that you still haven't been explicit about how you used installer classes, if they are custom actions, or if you're running InstallUtil.exe, if there is an uninstall custom action, and what is the exact state of the service after the uninstall.

ODE WAR examples wont run UBUNTU 14.04

I am trying to install and understand ODE.
I set up Tomcat7 no problem
I set up ODE WAR distribution
I copied the examples folder as per instructions.
Then I ran it, and it failed.
Then I RTM some more and saw
The sendsoap executable can be found in the distribution bin directory. The urls should be updated according to the address defined in the WSDL file for the process service.
The executable script using the command line given fires an exception.
could not find or load main class org.apache.ode.tools.sendsoap.cline.HttpSoapSender
latest version.
If there is some update to URLs required there are no directions to do that anywhere in the install instructions. Given that new users do installs this has to be one of the most brain dead careless instruction sets I have read in years regardless of the fix. But can someone enlighten me?
Just to be clear, the startup screen on port 8080 comes up just fine.
The command line tools seem to have some class path issues. I'd suggest to use SoapUI instead, it provides a better UX as well.
Update: Quickstart to verify the installation:
For a simple test, just copy the helloworld2 example from the dist package to tomcat/webapps/ode/processes. The process should then appear in the web console. Copy the Axis2 WSDL URL of the helloworld process http://localhost:8080/ode/deployment/services/, which is most likely
http://localhost:8080/ode/processes/helloWorld?wsdl. Open SoapUI, start a new SOAP project, paste the WSDL URL into the "Initial WSDL" form and create the project. SoapUI will create sample request "Request 1" for the hello operation. Double click, play with the content and invoke the method using the green "play" button.
Due to a build problem the JAR files in the lib directory of the 1.3.6 WAR/JBI distributions don't work (Bug Report). Use the 1.3.5 distribution instead until this is fixed.

How to automatically update OSGi framework bundles list at runtime?

Here is the context: I have 2 osgi products running, one which is the main software (lets call it 'software') and the other which manages updates/installs/uninstalls of the first one, using p2. (lets call the second one 'updater')
I managed to make the updater install a feature into the software, meaning that the feature was successfully installed in the features directory and its bundles in plugins directory. Regarding p2 everything is good, the profile is updated with the new changes.
However it had absolutely no effect on the software, which didn't care of the new feature.
So I added some p2.inf files in my plugins with the instruction installBundle and this made my new bundles being added in the config.ini file which contains the list of bundles to load.
This makes me very close to the victory because when I restart the software, my new plugins are loaded by the framework. But.. I don't want to restart and I'm not supposed to have to since osgi is able install stuff in live.
Still fighting, my searching made me discover the simpleconfigurator which is responsible of loading the list of bundles from a file and giving them to the framework which will do everything it needs. But it does it only at the startup and I don't find any way or any doc to ask him to do refresh the list at runtime.
The only solution I've done so far is to call the update() method on the bundle org.eclipse.equinox.simpleconfigurator and then my bundles get recognized and work perfectly.
So right now, I have something working but I'd like to find a better solution and the reason that I'm telling the full story is because I'm surprised by the fact that, after battles with p2, I also need to fight with osgi to make it loading the new bundles..
Thanks for any help :)
I am not very familiar with p2. But it sound like you have two problems - you need some way to programatically deploy bundles into the OSGi container at run time and have the main application be aware of and use the functionality from those bundles.
For the first problem take a look at the selected answer on Programmatically Start OSGi (Equinox)?
For the second part you can use a ServiceListener - http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/ServiceListener.html - in your main application to listen for Services that implement a pre-defined interface. You main application should get notified whenever services are REGISTERED or UNREGISTERED at run time and can react accordingly.
you can find your bundle, and invoke bundle.update(InputStream input).
http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#update(java.io.InputStream)

Is there a way to unload bundle after mach_inject

I want to load the newer version of bundle to the target process but it's impossible because the bundle with same name already loaded. Changing CFBundleVersion or CFBundleShortVersionString of bundle doesn't work. The easiest way to do it is simply kill the target process and restart it. But I don't think that it's a best way to do it. So is there another way to do it?
I am facing the same problem with mach_inject. I don't see a straight forward solution without modifying mach_inject.
My solution is to create two bundles. Consider the 1st bundle to be a plugin manager for the real plugin. The plugin manager is very simple and hopefully never needs to be upgraded, it loads and unloads the original bundle with cleanup code added.
I am using Apple's NSBundle class to load and unload the plugin. Before unloading I call the principal class in the original plugin to have it clean up.
Unloading bundles written in objective C is dangerous. 2 & 4 are true in general.
Mach_override can not be undone, but can be called in the plugin manager and call code in the real plugin.
Categories and protocols are not safe to use in plugins meant to be unloaded.
You need to un-swizzle what you swizzled, and remember you can not remove methods, so when you reload the plugin, you need to replace (not add) the old dangling methods. You will need to check your swizzle code.
You need to invalidate timers installed, remove observers, and remove anything else added to the run loop.

Windows Service Setup Project

I’m trying to create a set-up project for a windows service. I’ve followed this tutorial and many others like it but, after installing my service, I still can’t see the service. I’ve added the primary output of the service to the application directory and created a custom action to include this output on Install, Commit, Rollback and Uninstall.
It claims that it installs correctly.
Should this work? Is there anything else that I can try to get this to install?
Did you create an installer for your service? It is separate from a Setup Project.
See: http://msdn.microsoft.com/en-us/library/system.serviceprocess.serviceinstaller.aspx
You can create an Installer by right-clicking on your service's Design window and selecting Add Installer.
In my case, adding the installer was a first step as described by dhirschl's answer. I then needed to add custom actions to the setup project.
Right click the setup project/view/custom actions
then add the primary output to every folder there.
Source

Resources