AWSSDK Packages are not resolved in AEM 6.5 - osgi

I am using AWSSDK to read messages from Amazon SQS, for that I have used software.amazon.awssdk maven group dependency with version 2.15.14, when there is no problem with build but OSGi bundles (Core) which is leveraging aws apis is in installed state at AEM Felix Console due to unresolved aws packages.
here is the list of packages which are not getting resolved.
software.amazon.awssdk.auth.credentials
software.amazon.awssdk.awscore
software.amazon.awssdk.regions
software.amazon.awssdk.services.sqs
When I am trying to create an eclipse plugin with these packages and install in manually at Felix Console, I am seeing some other packages starts showing unresolved and it goes on an on.
Any help would be highly appreciated.
#alexander-berndt , could you please help me here ?
Regards

Are you requiring those dependencies? If not, simply exclude them from the build configuration. Something like this should work for you:
<Import-Package>
javax.inject;version=0.0.0,
!sun.misc;resolution=optional,!javax.persistence,!com.sun.jdi.*,
!software.amazon.awssdk.auth.credentials,!software.amazon.awssdk.awscore,!software.amazon.awssdk.regions!,software.amazon.awssdk.services.sqs
*
</Import-Package>

Related

In the Quarkus Amazon Lambda HTTP guide the Lambda runtime cannot find QuarkusStreamHandler on the classpath

As this issue hasn't been raised already I'm obviously missing something simple. I am following the Quarkus - Amazon Lambda with Resteasy, Undertow, or Vert.x Web guide using the 1.0.0.Final release (I've also tried the CR and 0.28.1 releases).
I have this packaged as an Uber jar.
I have run the mvn quarkus-bootstrap:build-tree and this shows the io.quarkus:quarkus-amazon-lambda-http-deployment:jar:1.0.0.Final with it's dependant jars and checking the generated runner jar shows that the io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler.class file is present.
However, whenever I run this either in the AWS SAM environment or in AWS proper I get the dreaded java.lang.ClassNotFoundException: io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler
I'm at a loss where to turn. I'm compiling using Maven 3.6.2 and Graal 19.2.1 (though not the native compilation).
If anyone stumbles across this, I found that adding "quarkus.package.uber-jar=true" to application.properties folder is required when working with maven.
https://quarkus.io/guides/maven-tooling

Deployment in Jboss fuse using Maven

I have created a Fuse integration project in developer studio 9.0.2 and I'm using jboss-fuse-karaf-6.3.0 as the runtime container.
I want to deploy this project using Maven, but not able to figure out -
How and where to give server URL, user name and password for the deployment ?
Does project gets deployed to fabric or karaf ?
Will appreciate if anybody can help with some pointers.
Thanks in advance.
Is that server running locally or remote?
Locally you can simply define the server in the servers view and then use Add context menu to deploy your project.
it gets deployed to Karaf
When building projects with Maven I use osgi:install and dev:watch commands (available in both JBoss Fuse and vanilla Karaf). The following setup works well for a development machine.
First build with Maven using install goal, so the artifact gets installed in local repository.
Then issue osgi:install (see Manual Deployment in JBoss Fuse docs) command in your container to install your bundle. Job done!
> osgi:install mvn:it.your.package/your-artifact/1.0.0
Once the bundle is installed you will see a message like
Bundle ID: 352
This is the ID of the bundle installed. Issue the following command:
> dev:watch 352
Watched URLs/IDs:
352
Now every time you rebuild with Maven, the bundle gets redeployed automatically.
Watch out some settings to be changed if dev:watch does not reload bundles on JBoss Fuse 6.3.0
edit: use -SNAPSHOT in your version with this setup. Regular versionsmay not redeploy correctly because the container sees the version is the same and may use previously loaded classes, thus causing classloading issues.

How to install a bundle on boot in Karaf

I came across this post but it doesn't quite answer my question. I am using blueprint to set up a H2 database in Karaf and it requires that I first install H2 driver and OSGi enterprise package because it contains JDBC library.
install -s mvn:org.osgi/org.osgi.enterprise/4.2.0
install -s mvn:com.h2database/h2/1.3.174
I added the blueprint XML file to Karaf's deploy folder and it keeps giving error messages until I install H2 and enterprise package. Ideally, I would like to install both enterprise and H2 before the blueprint script kicks in, so I am thinking somehow add it to karaf's boot process but I am not sure how.
Any insights will be much appreciated.
One option would be to hot deploy a features XML before deploying your bundle.
See the Karaf deployer guide for more details. Here is an XML example:
<features>
<feature name="features_test">
<bundle>mvn:org.osgi/org.osgi.enterprise/4.2.0</bundle>
<bundle>mvn:com.h2database/h2/1.3.174</bundle>
</feature>
</features>
One way to achieve this is to publish the blueprint file to the maven repo. This way you can reference it in feature files. See the maven build helper plugin with goal attach artifacts. Many feature files are deployed tnis way.
You can also put your blueprint file into an ordinary bundle. Then it will also work in other containers than karaf.

Beginner starting large OSGi migration - osgi.wiring.package=android.dalvik?

I have a large Java application that's mostly networking and file processing with lots of DB access. There's no UI. We expose a few web services (embedded Netty) and call some external rest web services. The project is built with Ant. It's about 10 different jars plus maybe 30-40 libraries.
My current task is to move the project to the OSGi framework. I am startling slowly.
Following the examples in "OSGi In Action" chapter 6, I have used the BND ant task to put the entire project into one huge jar file. This worked. I am able to run the program using java -jar. Here's my current .bnd file:
-output: bundle/MerchantServicesBundle.jar
-include: manifest/merchantservices.manifest
Bundle-Name: MerchantServices
Bundle-SymbolicName: com.shopping.services.merchant
Bundle-Version: 4.1
Main-Class: com.shopping.merchant.services.netty.MerchantServices
Class-Path: /home/ppantera/repositories/MerchantJava/modules/MerchantServices/conf/
Private-Package: *
I am using Apache Felix 4.0.3. From the Gogo shell I can install the bundle but when I start it I get this:
org.osgi.framework.BundleException: Unresolved constraint in bundle com.shopping.services.merchant [8]: Unable to resolve 8.0: missing requirement [8.0] osgi.wiring.package; (osgi.wiring.package=android.dalvik)
Why does Felix think this is an Android project?
There doesn't seem to be much about this on the 'net. Would you recommend using an older version of Felix so I'm sheltered from the newer OSGi features that could cause me confusion?
I tried adding this to my .bnd file:
Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version>=1.7))"
That didn't help. What am I doing wrong? Any other pointers?
It looks like somehow bnd detected a requirement to an Android package, and added that to the MANIFEST.MF, it could be in your code, but could also be in one of your 3rd party libraries.
Check your manifest to be sure, I guess you'll find something like
Import-Package:android.dalvik.
If that's the case you can test the bundle by manually removing that header and see if that helps. When you've got that clear, you can resolve it for example by making that import optional in bnd.
One of easy solution is:
Go to FuseESB console:
Type the command:
osgi:install mvn:commons-io/commons-io/2.1
Replace 'common's-io' with your your dependency's group id and artifact id (Maven)
e.g my dependency was:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
Cheers

Karaf development

Im currently develop bundles for karaf and have some questions...
I wrote a bundle/webservice based on cxf, I try to deploy it in karaf but it could not start that bundle because it could not resolve some packages e.g.
org.osgi.framework.BundleException: Unresolved constraint in bundle org.springframework.aop [56]: Unable to resolve 56.0: missing
requirement [56.0] package; (&(package=org.aopalliance.aop)(version>=1.0.0)(!(version>=2.0.0)))
so here is a question, this package dependency comes from spring-aop (3.1.0.RELEASE), so where is the problem? what dependency is missing? how can I solve such problems?
In that case i did not clearly understand the development process. should i deploy all missing bundles in deploy? because i would like to keep thirdparty libs spereated from my developed bundles. And what bundles i have to deploy? Is it a trial and error process? Is there a common way to let maven do the dependency stuff?
I discovered a folder "system" and read on the docu that it is a repository like maven, is it for the features?
I had for test cases a karaf with some pre deployed bundles and put my webservice bundle into it, but again execeptions...
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet
What dependency is missing?
I already read the tutorial about camel and karaf, but it did not explain the deployment stuff, so could anyone suggest me a good tutorial?
Thanks!
Chris
Short answer
Scroll down to the bit referring to "camel-cxf" and run the two commands features:addurl and features:install. I have a feeling this will resolve all your problems.
spring-aop
On Karaf console type:
exports | grep org.aopalliance.aop
I think you'll see lines like:
XX org.aopalliance.aop; version=3.1.0.RELEASE
So while the spring-aop bundle has the right packages they're the wrong version, the range being requested is >=1.0.0 and <2.0.0, so 3.1.0 doesn't satisfy that.
Deploying/Installing
You can drop bundles into ${karaf.home}/deploy or use the console.
You can install maven bundles from the Karaf console with:
install -s mvn:groupId/artifactId/version/packaging/classifier
Where -s starts the bundle and packaging/classifier are optional.
You can find a lot of OSGi ready maven dependencies here http://ebr.springsource.com/repository/app/ - I had a quick look but your spring aop dependency is very old, what version of CXF are you using?
Read up about Karaf features - they're basically XML files that list suites of bundles that can be installed. Very useful for deploying large numbers of bundles and they can be installed into a maven repository.
There are some standard features available in Karaf, try:
features:install war
This will give you a jetty webcontainer and may resolve your ClassNotFoundException: javax.servlet.http.HttpServlet as long as it's the right version
Camel also has a features file which probably sort all your issues, try this:
features:addurl mvn:org.apache.camel.karaf/apache-camel/2.9.0/xml/features
features:install camel-cxf
Tutorials
There's quite a bit available, some on http://karaf.apache.org and http://fusesource.com but also take a look at the PDF manual that comes in the Karaf distribution.
Always beware that info may be out-of-date
Please post your MANIFEST.MF file. I think you didn't not mention the tag in maven-bundle-plugin dependency.

Resources