Error after converting org.pbjar library to OSGi bundle - osgi

I'm trying to convert org.pbjar.jxlayer library to an OSGi bundle, I already succeeded in that but when I try to install it in Karaf container, the container claims that there is a missing requirement needed by this bundle:
Unable to resolve 312.0: missing requirement [312.0] osgi.wiring.package; (osgi.wiring.package=com.sun.java.swing)
I also put the javax.swing in the bundle import directive but the problem persists
I changed the version of JDK (1.5, 1.6, 1.7) but no luck
Can you help me please in resolving this problem.

So your bundle tries to import the com.sun.java.swing package, and when the framework tries to resolve the bundle, it cannot find anybody exporting this package. That is what the error message is trying to tell you.
In Java 7 (I have not checked older versions) this package is part of the JRE. This means the easiest way to expose it to bundles is by having the framework export it as an "extra" package. You can configure a system property when starting your framework to do that:
-Dorg.osgi.framework.system.packages.extra=com.sun.java.swing
The other alternative you have is to embed this package inside your bundle. In that case you don't need to export it via the framework (which is convenient in case you cannot reconfigure your framework) and the import package can be removed from your bundle as well. If you end up having many bundles that need this, this is probably not that convenient or good, as you will end up with many private copies of the package (instead of everybody sharing one).

Related

How to create distribution of Python GTK3 app?

I made an application using GTK3 on Windows (Mingw_x64 installation of GTK) and I cannot really figure out how to make a distribution out of this. According to official documentation of PyGObject, it is possible in some way.
I already tried to make a package using setuptools, but PyGObject documentation is not saying much about this process and I was not able to configure setup correctly to make it work. PyGObject has a lot of dependecies and weird imports, that I do not know how to include.
I also tried Pyinstaller, which claims it has GTK support, and it really can pack it into executable, however it is not working. I tried these two options:
make only one file (.exe), but in this situations, it throws an error, that some file is not found (libpixbufloader-ani.dll)
create a directory with all needed files (libpixbufloader-ani.dll and other libs are included this time), but when running exe, another exeption occurs, this time Struct and 2 other libraries are missing (strangely, there is a folder that contains Struct)
Becouse of the missing files, I tried adding as many paths containing needed libraries as possible to Pyinstaller, but without success.
Does anyone have any experience with packaging GTK appliciations in Python? There is definitely a way to do this, but I am not very experienced with packaging. If needed, I can provide more information.
This is an issue that has been brought up on PyInstaller's GitHub page, as others (including myself) have experienced the same issue that you've mentioned.
The last time I tried the dev version of PyInstaller, the issue still wasn't fixed, but I managed to get a working executable by using PyInstaller to find the dependencies that my Python3/GTK3 app needed, and then I used cx_Freeze to generate the final executable.

Aurelia CLI and braintree-web

I am trying to use https://www.npmjs.com/package/braintree-web with Aurelia (using the aurelia-cli and RequireJS). I am stuck trying to get all the many dependencies to resolve.
To use 3rd party library in Aurelia the library must be defined in the aurelia.json file.
If I add "braintree-web" in that file then aurelia complains that "braintree-web" it requires the modules "american-express", "apple-pay" etc etc.
If I manually create the "american-express", "apple-pay" dependencies then each one also refers to "braintree-web/lib", and a bunch of other sub-directory dependencies.
In short I can't get the "braintree-web" module to load because I have to manually build all sub-dependencies and its too complex to get working.
As I state above, I am using requireJS, should these dependencies all resolve correctly?
Any ideas as to how I can get this working?
Thanks
If all dependencies is what you need, then with requirejs + aurelia-cli you'll have to declare all dependencies. There is an experimental version of the cli being developed which you can find here, where you won't have to declare any dependencies in aurelia.json anymore.
With webpack you also don't need to declare any dependencies by the way.
Do you really need everything though? The docs mention for example you could import just the client. Still looks like a whole heap of dependencies, but at least a lot less than importing the main index.js.
You could also just include their pre-bundled client which I believe is https://js.braintreegateway.com/web/3.32.1/js/client.min.js
On a side note, the person developing aforementioned experimental CLI is actually looking for people to test it with non-trivial apps. Me and several others have tried it with great results, so I can recommend you try it. If you could report back in the PR that would be really awesome.

OSGI Bundle's start() method is not getting called

I have few bundles with activator in my environment. In just one of the bundle start() method is not getting called. Basically it is not getting activated. The only change this bundle is having is, it is using "DynamicImport-Package: ".
Removing this tag solves the problem with start() not getting called but this is not possible as all the packages are not known upfront in my scenario.
Can somebody help me, as I am quite stuck with this.
I can not figure out whats the problem and how they two are related.
They are not related. Removing DynamicImport-Package will have no effect on whether your bundle starts, so something else must be going on. Do you actually call the Bundle.start() method on the bundle anywhere?
Incidentally, using DynamicImport-Package is a very very bad idea. There is almost certainly a much better way to solve whatever problem you think is solved by using DI-P.
When using DynamicImport-Package especially with * you cannot control where a package is drawn from. So you will have big problems if two bundles export the same package.
For example I had a problem with pax exam that uses this * import for test bundles and there where two versions of the package javax.inject. As their bundle calling the test saw a different version of the package the service imports did not work.
So in your example it could be possible that you have two versions of the package org.osgi.framework where the interface BundleActivator is located.
Do you install the org.osgi.core api bundle? If yes then remove it. Only the framework should provide these packages. It could cause the effect that the framework can not use your activator class.

i am getting error when i try to create web service client in Spring STS

i am getting this error when try to create new web service client.
IWAB0503E Unable to update Java build path. Please check your system environment.
Some web searching uncovered that what this error really means is “The Web Services generation tool detected multiple versions of the javax.xml.soap plug-in installed. Resolve this error by removing the conflicting plug-in.”
Sure enough, when I checked in Eclipse there were two versions.
WebService
I encountered two speed bumps when testing this theory:
There’s no easy way to uninstall a plug-in within the Eclipse UI, so I had to resort to removing the directory from eclipse\plugins directly from Windows Explorer.
Which version should I remove? It took me two tries to figure out which version was causing the error. Turns out that newer is not always better…in this case 1.3 was at fault and 1.2 (javax.xml.soap_1.2.0.v200905122109) was the version to keep.
This is old but, in my case the details of the error were:
IWAB0503E Unable to update Java build path. Please check your system environment.
java.io.FileNotFoundException: /lib/saaj.jar
So \lib\saaj.jar was not found in folder
C:\sts-4.8.0\sts-4.8.0.RELEASE\plugins\javax.xml.soap_1.3.0.v201105210645\
I created the folder lib and copied saaj.jar in it from another STS instance that I had and then it worked.

Which Ninject version should I install from NuGet?

just a simple question:
I'm going to use Ninject in my ASP.NET MVC 3 application, but in the Package Manager there seem to be a few options:
Ninject
Ninject.MVC3
Ninject.Web
Among others. Which of these should I install?
See https://github.com/ninject/ninject.web.mvc/wiki/Setting-up-an-MVC3-application
http://www.planetgeek.ch/2011/03/01/ninject-2-2-1-0-and-ninject-mvc3-2-2-1-0-released/
http://www.planetgeek.ch/2011/02/22/ninject-mvc3-and-ninject-web-mvc3-merged-to-one-package/
The last one is a bit outdated in the mean time, but still contains good information. I try to update it during the comming days.
Install Ninject.MVC3. The package will automatically install any dependencies it needs (i.e. Ninject)
Edit:
Looking at Ninject.Web.Mvc.nuspec, it looks like it will install Ninject2.2.0.02.2.1.0
Placed proper version. But again, install it directly so that any dependencies are also automatically installed.

Resources