Apache Felix and OSGi - osgi

On installing BndTools for Code for Apache Felix using OSGi getting this error :
The selected wizard could not be started. Plug-in "bndtools.core" was unable to instantiate class "bndtools.wizards.project.NewBndProjectWizardFactory". org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne
I'm installing this tool in Eclipse Mars.

Related

Apache felix cannot load dbcp2 as bundle

I have created an OSGi bundle, that is using apache commons dbcp2 to create a database connection pool. I am using apache felix gogo as runtime to start my bundles. I have loaded multiple other external libraries without any problems into the apache felix:
Image here (cant post no rep):
https://i.gyazo.com/c779ccaba20e3fa327d61a621748d8dc.png
However every time I try to start dbcp2 bundle which is requiered in my bundle I get the following error:
Image here (cant post no rep):
https://i.gyazo.com/ac7b673e63b9e6ad764af2e6adddb19a.png
I have found that there is some Apache mixservice bundle available, but it contains dbcp 1.4 and I need dbcp 2.5.0 or higher.
What needs to be done so apache felix is able to load the dbcp2 as a library requiered by other projects ?
What you see in the error is that the dbcp bundle requires the javax.transaction package in version >= 1.1.0. This is not an error in the bundle. It just means that you need to provide this package in the OSGi container.
Normally you would install a bundle that provides the package. In this case the package comes from the jre and the system bundle should export it.
Depending on how you start felix the way to export a system package is different.
For example if you use bndtools you do this in a bndrun file. See the Enroute microsevice example.
For plain felix see the parameter "org.osgi.framework.system.packages.extra".
In this example the javax.transaction package is exported (among some others).

CXF - ClassCastException (SEIStub/ClientProxy) in Equinox

I am getting following exception inside Equinox OSGI :
Getting java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
Please advise.
It looks like you accidently use the jax-ws stack that is part of the jdk instead of CXF. I guess the reason is an incorrect deployment of CXF in your OSGi runtime.
You will need to not export the jax-ws API packages from the framework and instead install the jax-ws API from servicemix bundles. You can try to install Apache CXF in Apache Karaf to see how the correct deployment should look like.
To set the packages to be exported by the framework use the framework property org.osgi.framework.system.packages. See also Apache Felix configuration. Unfortunately there is no option to remove a package from the exported packages. If you use this option then you need to specify all packages that the framework exports. The default can be found in the felix jar in a property file default.properties.

Weblogic osgi bundle

I have an osgi bundle which was deployed in apache karaf using the feature.xml and service injection is done using blueprint.xml. How to deploy the same bundle in Weblogic OSGI container.
https://docs.oracle.com/middleware/1212/wls/WLPRG/osgi.htm#WLPRG764
I followed the steps mentioned in the above link. Copied the OSGI jar in the WL_HOME/server/osgi-lib location and restarted the server, but was not able to start it. Am i missing some thing?
Note:- I was able to deploy a simple OSGI jar without any dependencies by copying the jar in the osgi-lib folder.
You need to install the Aries blueprint bundles.

Eclipse Virgo 3.0.3 and apache felix web console

Folks,
I'm trying to get the apache Felix webconsole running on an eclipse Virgo 3.0.3 installation -- I need the extra details it provides that the standard virgo admin doesn't.
I uploaded the full org.apache.felix.webconosle-3.1.8.jar to the pickup dir.
This virgo Jetty is running at port 8098, but when I do:
host:8098/system/console
I am getting the 404 not found.
Any ideas here how to get the webconsole integrated into the Eclipse Virgo Jetty install?
Thanks!
Although I didn't use Virgo in a long time, I guess it is because the installation is missing a standard OSGi HTTP service, which is required for the Felix web console bundle to work. You need to install a bundle that exports such a service based on the Jetty bundle you are using.

equinox jetty NoClassDefFoundError: SslContextFactory

i have a osgi project in indigo ide, which use equinox 3.7.0 + jetty 7.5.1, now i upgrade ide to juno, which contain equinox 3.8.0 + jetty 8.1.3, so,
the tragedy go on:
when compiling, complain accesible restrictation on SslContextFactory's methods, i resolved it by editing it's access rules in build path.
when running, have a error, say
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/ssl/SslContextFactory
now i have no idea, thanks for ur help.
The access rules are there for a reason.... by hiding the build-time error, you just made the runtime error appear.
The proper solution is to import the package org.eclipse.jetty.util.ssl in your bundle.
If you use a tool such as Bndtools then these Import-Package dependencies will be detected and generated automatically.

Resources