Apache ACE Agent integration with Apache Felix embedded in Tomcat? - apache-ace

I have follow up question on
Apache ACE together with Apache Felix embedded in Tomcat?
After version 1.0 onward (0.8.1 onward) i am unable to see latest Maven repository available for retrieval of org.apache.ace.agent? I am newbie on Apache ACE. Hence was wondering whether i am missing anything?
I am also having similar question. Hence wanted to check whether this was successful? If yes, then how it was achieved?

Let me answer my question after some tries so that others can use the same:
Regarding point no 1 I am not sure about. Need to check with Apache ACE owners
Regarding point no 2:
As commented by Marcel, i had extracted agent jar "jar xf target.jar jar/org.apache.ace.agent.jar" and installed the same in local maven repo with command
mvn install:install-file -Dfile=./org.apache.ace.agent.jar -DgroupId=org.apache.ace -DartifactId=org.apache.ace.agent -Dversion=2.0.1 -Dpackaging=jar
Provided this dependency in original web application maven code as detailed below:
<dependency>
<groupId>org.apache.ace</groupId>
<artifactId>org.apache.ace.agent</artifactId>
<version>2.0.1</version>
</dependency>
Added additional configured parameters where we were instantiating Felix as detailed below:
String localId = UUID.randomUUID().toString();
Map config = new HashMap();
//Here i am adding Apache ACE agent configuration. For now two are ok
config.put(AgentConstants.CONFIG_DISCOVERY_SERVERURLS, "http://localhost:8080");
config.put(AgentConstants.CONFIG_IDENTIFICATION_AGENTID, localId);
List<BundleActivator> activators = new ArrayList<>();
//Here i am attaching Apache ACE activator as system activator
activators.add((BundleActivator) new Activator());
config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, activators);
Felix felix = new Felix(config);
.... regular felix.start etc goes here.

Related

Equivalent of feature:repo-add and feature:install in Apache Felix

I am familiar of feature:repo-add and feature:install in Karaf. I am looking for similar thing in Apache Felix or any alternate way to do the same.
If you want to deploy on plain felix without karaf then I recommend using the bnd packaging.
It is used in the enroute tutorials (you need to switch to felix as they use equinox by default). You give it a repository of the bundles to draw from (pom file) and a bndrun file. The output is a runnable jar with all bundles and felix included. When looking at the bndrun ignore the runbundles .. you do not have to write them. Threy are automatically generated.
When deciding between karaf and bnd packaging keep in mind that you do not have the pre defined features of karaf. So finding the set of bundles for the repo is a bit more work. You can use the list of bundles from the karaf features you use as a good starting point.
See https://github.com/osgi/osgi.enroute/tree/master/examples/quickstart/app

How to get the Arquillian Websphere adapter via Maven?

I'm trying to set up Arquillian tests for an application running in a Websphere (WAS8) container. For this I used the Maven coordinates I found on arquillian.org:
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-was-remote-8</artifactId>
<version>1.0.0.Beta2</version>
</dependency>
Unfortunately, no arquillian-was-* artifacts can be found via the two mentioned Maven repositories Maven Central and the JBoss Maven Repository.
Any ideas how I could get a hold of the required Arquillian WAS8 container adapter via Maven? The source code is located on github but it's unclear how to obtain the required JAR files...
Check this link : https://docs.jboss.org/author/display/ARQ/WAS+V8.0+-+Remote .
You have to build it yourself because as the link says : "This container implementation is currently not available in public maven repositories." Build instructions can be found on the link. Good Luck ! :)

how apache-karaf download required depnedencies by features.xml whithout my intervention in case modification

Please see the image first.
i have multiple instance of apache-karaf, when i change something in my java-project i deploy the jar file inside deploy folder of karaf, and this not good because i have to do that for all instance.
now i dont know very well apache-karaf.
i saw that it's easy to use feature, so i create features.xml in deploy folder.
example.
mvn:org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1
mvn:org.springframework/spring-core/3.1.1.RELEASE
what i want to do, is when i deploy a new jar in my local maven repository and when i change version of org.springframework/spring-core/ to 4.1.1.RELEASE in features.xml for example, i want that karaf download this modification whitout my intervention.
is karaf able to download new depnedencies and delete the older alone?
if it's not clear you can ask me question.
You can use Apache Karaf Cellar and Apache Karaf Cave for this scenario.
Apache Karaf Cellar brings "farming" to Karaf, in this scenario you can configure multiple karaf instances within one group.
Apache Karaf Cave is a central Repository which can be used to provide all required Bundles to Karaf instances.

How to deploy a karaf feature from a local maven repository?

I've created by first project for karaf (4.0.1). So far I've got the following:
an application bundle built with the maven-bundle-plugin. There are going to be more...
a karaf feature created with the karaf-maven-plugin.
a karaf-assembly created with the same plugin
So I'm ready to deliver to the customer - but I'm stuck over the development process. This question answered almost all my remaining questions save one:
After having built my project by running maven install I think I should be able to to get my feature running on a local karaf instance using something like the command feature:install.
I can install my application bundle from local maven by using bundle:install but then I'm down to managing dependencies myself.
Really can't figure out while bundle:install works against my local maven repository and feature:install doesn't.
Found the soloution here. I knew I'd need feature:repo-add - but the name of this command and the official documentation sent me thinking in entirely the wrong direction.
This command does not add a (maven) repository, but adds the location of a feature in the maven repository chain (so I'm thinking the old name addUrl was probably easier to understand).
Anyway - using feature:repo-add mvn:<groupId>/<artifactId>/<version>/xml/features works.
I've just had the similar issue and I've found solution here: http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-td4028299.html
I've edited the etc/org.ops4j.pax.url.mvn.cfg and uncommented the option org.ops4j.pax.url.mvn.localRepository, setting it to my local repository location:
org.ops4j.pax.url.mvn.localRepository=C:/data/maven-repo
Before installing a feature, you have to register the features repository that provides the feature using feature:repo-add
using feature:repo-add mvn:<groupId>/<artifactId>/<version>/xml

OSGi bundle repository with plain Maven JARs

I am working on to reach a solution to deploy a web application as a bundle to Virgo 3.0.1.RELEASE. My scenario is:
I use Maven Bundle Plugin to generate the manifest.
I exclude all the JAR dependencies using Maven WAR plugin.
I need to command Virgo to host the plain Maven JAR artifacts in the local repository. As an instance Apache Karaf along with PAX can provide plain JAR files as OSGi bundles.
So,
Any ideas on how to configure Virgo for to host Maven repository plain JARs?
Generally, in your experience, what is the best solution to use a ready Maven repository and host it as an OBR?
Thanks in advance.
The best solution I've found so far is actually using Wrap Deployer on Apache Karaf.
Basically stick with Karaf, since it provides all you need :)
With Karaf and the features you don't really need a OBR, since the features service does a pretty good job of resolving already deployed bundles and won't install those again. You need to add the OBR flag to your features file though.

Resources