Liberty: Custom User Registry with unresolved dependencies - websphere-liberty

Am a noob in OSGI development. Due to requirements, I had created a osgi bundle project, for a custom user registry feature in Eclipse with WDT and subsequently a feature project to export a .esa file for it.
I'm then able to install the feature into our websphere liberty, however when start it hit the error below:
Unresolved Requirement Require-Bundle: com.ibm.websphere.v85.core
The bundle require the plugin in order to build for the custom user registry. Once I have added the required plugin com.ibm.websphere.v85.core i can build successfully.
I have tried to include the bundle together when i export the feature, but the same error persist.
Any advice on how to solve this dependency issue?

I'm not sure how your eclipse workspace is setup, but that bundle is a WAS traditional bundle that doesn't exist in Liberty. Instead of adding Require-Bundle you should use Import-Package to import any packages you need. I would also suggest checking the plug-in development environment preferences for eclipse to make sure you have it configured with Liberty as the target platform rather than WAS traditional.

Related

How to use maven artifact in the development of Eclipse plugin via Tycho

Since version 2.2.0 Tycho has introduced a new feature to allow using maven artifacts in PDE target platforms, and here's the how-to. Following its instructions I have included an artifact of Saxon-HE into my target platform. I can see the wrapped OSGi bundle of Saxon after ticking the Show Location Content option in the Target Definition Editor. Also I ran mvn clean verify command to make sure that the artifact is downloaded into my computer. However,
as I began to try to import the package into my Eclipse plugin code, I found no suggestions from this package.
When I tried to include the package as a feature in the Product Editor, I couldn't find any option.
In addition, when attempting to include it as required plugin / imported packages in the Plugin Editor, there was no option, too.
What's more, the product produced by mvn clean verify did not contain such plugin as Saxon-HE after checking my whole RCP project.
All the efforts in vain above made me wonder how I can use a maven artifact in my plugin development. I desperately need the functionalities Saxon-HE provides with to enhance my plugin. Anyone experienced sharing your expertise?
-- 2021.08.13 update --
Manually I included this plugin in the plugin list of my RCP project via source file editing. Its jar file appeared in the plugin folder of the product. But anyway I was not able to validate the availability of the library in the dependency tab of the plugin manifest editor as shown in Vogella's tutorial. Restarting the IDE did not help, either. This might mean that I have to manually code the source code without the content assistance.

What is the recommended usage pattern for karaf-maven-plugin?

I have a bunch of java classes and a bundle activator class that I need to deploy to karaf.
I see that the karat-maven-plugin has kar packaging and karaf-assembly.
Also it generates features.xml
I can generate features.xml directly and it generates lines with wrap: for some of my dependent non-osgi jars.
But when I run karat-assembly, I run into the issue of the assembly goal not realizing that these jars are not osgi and end up with errors.
What it the recommended way to get a custom karaf with my application installed ?
Does the karat-assembly packaging need to have a features.xml generated and provided beforehand ? Or is it supposed to do the feature set generation by itself ? If it is the latter, then how do I get around the problem of the karat-assembly not recognizing non-osgi jars ?
I have spent a LOT of time with google and am stumped.
This is my procedure for creating a custom karaf distribution. It may not be "best practice" but it works for me. Maybe you can customize for your needs.
After developing my Camel routes and testing I generate my feature file based on a feature template found in /src/main/feature/feature.xml. The karaf-maven-plugin will generate the feature will in the feature folder inside /target.
I do a clean deploy to our maven artifactory.
I have a custom Karaf project do a clean install on that project. The project has dependencies to the initial project and I add all the features as boot level feature.
Once build I unzip the distribution and run the Karaf app. If everything looks ok its ready to be shipped.

Using OrientDB in an OSGi environment

I'm trying to build an application that uses an embedded OrientDB (currently "memory:") graph database.
I'm using OrientDB 2.2
I am using Eclipse bndtools for my development environment.
I have added orientdb-core and orientdb-graphdb osgi bundles as build dependencies to my bundle, but on its own that isn't enough, I need access to the tinkerpop blueprint classes as well. There doesn't seem to be a tinkerpop blueprints osgi bundle that I can see.
I can include the blueprints-core jar as a build dependency, and that gets rid of the compile errors, but I then get into all sorts of issues trying to resolve the bundles so I can run something. (the primary error there that I don't seem to be able to get rid of is a complain about not being able to resolve "com.carrotsearch.hppc" -- I include that in my bundle, and export it, but still no joy there)
Shouldn't orientdb-graphdb either depend on a suitable bundle, or include and export the classes?
It sounds like you're running into the classic problem of wrapping a third-party, non-OSGi library as an OSGi bundle.
The best tutorial for this is on the EnRoute site. Note that you don't need to be using EnRoute for this tutorial to be relevant.

How to Import Javafx8 in a bundle in OSGI

I'm working on an OSGI application with Felix. Now I want to use some JavaFx8 classes in a bundle but I have the following error :
Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (osgi.wiring.package=javafx.geometry
How can I import JavaFx8 SDK packages in my bundle.
Thanks in advance,
You can add the library to the felix classpath and append the necesary package(s) to the org.osgi.framework.system.packages.extra option.
http://felix.apache.org/site/apache-felix-framework-configuration-properties.html
If you do so, the bundle no. 0 will export the required packages. I can provide more detailed instructions later my pc, right now i am on mobile.
I'm working on an OSGI application with Felix. Now I want to use some
JavaFx8 classes in a bundle
I need to create a complete GUI and I'll need an important number of
imports.
I've released some Early Access versions of Drombler FX, a new Rich Client Platform for JavaFX based on OSGi (Apache Felix) and Maven.
As an application framework it makes sure JavaFX and OSGi will get started properly and it provides the main window.
You can read more about Drombler FX here: http://puces-blog.blogspot.ch/search/label/Drombler
There's a Getting Started page which explains how to create, build and run a Drombler FX sample application with a few simple steps.
After several researches, I finally fixed the problem by adding the packages I need in the pom.xml of the project :
<configuration><provision>
<param>--platform=felix</param>
<param>--noConsole</param>
<param>--systemPackages=javafx.animation,javafx.application,javafx.collections,javafx.embed.swing,javafx.geometry,javafx.scene,javafx.scene.layout,javafx.scene.transform,javax.swing,javax.swing.border,org.osgi.framework</param>
</provision></configuration>
or by adding the following properties to the same file ( pom of the project ):
<properties>
<org.osgi.framework.system.packages.extra>javafx.animation,javafx.application,javafx.collections,javafx.embed.swing,javafx.geometry,javafx.scene,javafx.scene.layout,javafx.scene.transform,javax.swing,javax.swing.border,org.osgi.framework
</org.osgi.framework.system.packages.extra>
<org.osgi.service.http.port>8080</org.osgi.service.http.port>
<org.osgi.service.http.port.secure>8443</org.osgi.service.http.port.secure>
For More information check the link.

CICS Explorer bundle could not be resolved

I am working on a simple Java-DB2 insert program connected to cics region via CICS explorer. I created a plugin for an external jar(com.ibm.db2.jcc), exported the plugin as a deployable plugin and added this in the build path of the program. The package has also been added in the dependencies (import-package) of the program. But installing the bundle in the cics region, I am getting an exception.
The bundle ABC could not be resolved. Reason:Missing constraint:Import-package:com.ibm.db2.jcc;version="0.0.0".
Can someone help me trace the problem?
I'm assuming the program you're writing is in an OSGi bundle that's being deployed into a CICS JVM Server as your OSGi environment, using CICS's OSGi CICS bundle parts. It sounds like you're taking an existing binary dependency and rebundling it as an OSGi bundle, and want to have your program resolve it using OSGi.
Based on these assumptions, it sounds like you're having to add the bundle to your build path automatically, which I don't think you should have to do. Once you've set up your target platform (http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/index.jsp?topic=%2Fcom.ibm.cics.ts.java.doc%2Ftopics%2Fdeveloping_sdk.html) any dependencies should then be resolved either from OSGi bundles in your workspace, or your target platform. It should then just be a case of adding an OSGi bundle part for each of your bundles, and exporting your CICS bundle to your region. Explorer should take care of exporting all of your relevant dependencies to CICS.
If you wanted, it should be possible to add the DB2 jar file as a lib without rebundling as an OSGi bundle, by adding the library to your Bundle-Classpath manifest declaration, but you might already have considered this!

Resources