deploy Apache ServiceMix 4 application into JBoss Application Server 7 - maven

I have an standalone Apache ServiceMix 4.4 application, it works nicely. Now, I want to deploy this application inside a JBoss Application Server 7. I use Maven as project and dependency management tool.
My objective is deploying the application not touching any line of code, only maven POM files. I can add new dependencies, change some versions (minor) and use different tools. I want, as a second objective, integrate all the Apache CXF DOSGi container features into JBoss AS ones seamlessly.
I think it is possible, but I found information for old releases of JBoss and ServiceMix or incomplete guides like this.
Can someone provide more information about that?
EDIT
I have found some issues in JBoss issue tracker:
Initial runtime support for Karaf based products
And some JBoss forum topics:
Migrating osgi bundles running in Karaf to JBoss 7 as OSGI container
I forgot to mention that my application is using Apache Karaf OSGi runtime.

Well Servicemix is "pre-"setup of a Container (Apache Karaf) and lot's of other Apache Projects like ActiveMq and Camel plus some ServiceMix specialties. So why would you want to deploy this setup in another Container?
If you want to do something like this, try to deploy std. Apache Camel, ActiveMQ and CXF and your own app in JBoss.

Related

Using Spring Framework Web when Tomcat is already installed and running

I am studying Spring Framework (all features) preparing to start some microservices and web applications for the first time. I am puzzled by the injection of Tomcat by Spring. If I buy Java hosting with Tomcat already running or set up tomcat to be already configured and supposedly running on a server, is this going to cause a conflict because it is also included in Spring? Or are we talking two different things where what is included in Spring is a connector to Tomcat instead of Tomcat itself?
I believe you are talking about Spring Boot which comes with bundled tomcat (JAR packing). If you package as a JAR, tomcat will be bundled but if you want to use your own tomcat or Jetty or whatever you should look at bundling as WAR file which will exclude tomcat bundling.
few pointers for you
https://spring.io/blog/2014/03/07/deploying-spring-boot-applications
https://therealdanvega.com/blog/2017/06/28/deploying-war-application-server-spring-boot

Migrate OSGI application from Karaf 2.3.4 to Websphere Application server

I have an OSGI application deployed in Karaf v2.3.4, it worked well, but I want to migrate it to WebSphere application server, I want to know the difference between these two servers, and the guidlines for doing that
thanks for your help
I've lead the development of OSGi applications on WebSphere, but am less familiar with Karaf. From what I can tell, we share the same Blueprint implementation. I believe that Karaf supports the OSGi application (.eba) packaging model - WebSphere Application Server insists upon it.
You can download free, developer-licensed WebSphere Application Server runtimes and Eclipse-based tooling from wasdev.net. The simplest approach would be to import your application source into the tooling, and deploy it onto a runtime from there.
The Karaf home page describes it as 'a small OSGi based runtime which provides a lightweight container onto which various components and applications can be deployed.' WebSphere Application Server is a Java EE-compliant application server. Until the advent of the Liberty Profile, it could not have been described as 'small'. Both runtimes are OSGi based.
We don't have a specific guide for migrating OSGi applications from Karaf to WebSphere, which is why I recommend that you try it and see what happens. Good luck - do let us know how you get on, either here or on the wasdev.net forums.
Regards,
Mark

How to deploy fuse project in server?

I create one fuse project using Jboss developer studio with apache camel spring context..
Currently I am running my project in local machine in internal Jboss-eap of Jboss developer studio. Now i want to deploy my project in application server or container.
Please give me answer of below question :
1) What should i use : fabric8 or osgi?
2) What are the dependency need to add in pom.xml for deployment?
3) I have jboss-fuse-6.1.0.redhat-379 , as per my understanding it is container. For deploy my project in server should i required any application server like jboss-eap?
4) As i am using maven for dependency, should i need to copy my maven local repository to server?
I suggest to read the JBoss Fuse 6.1 documentation - there is a deploying into the container guide
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.1/html/Deploying_into_the_Container/
As you have JBoss Fuse then its a container by itself, so you do not need JBoss EAP - its two different containers.
You can deploy from the Eclipse editor if you have the Fuse plugins installed (I think they are named integration stack). You can read how to install those plugins at the installation section from this page: http://tools.jboss.org/blog/

What exactly is Apache Karaf?

I am a little bit confused about what Apache Karaf exactly is.
Can you say that Apache Karaf includes, amongst other things:
Apache Felix (which is an implementation of the OSGi 4.2 framework)
Apache Aries (which is an implementation of the Blueprint standard)
TLDR: Apache Karaf is much more 'batteries-included'. It can also run on any OSGI runtime.
Apache Felix (which is an implementation of the OSGi 4.2 framework)
Sort of. Apache Karaf can use Apache Felix. Apache Karaf can also use Equinox or another OSGi runtime. By default, the Apache Karaf standard download does come with Apache Felix.
Apache Aries (which is an implementation of the Blueprint standard)
Again, sort of. The standard download of Apache Karaf does come with Apache Aries by default.
Now let's talk about what OSGI (Apache Felix, Equinox) is and what Apache Karaf is:
OSGI is very simple. You can start an OSGI runtime in your application and not even notice it. The shell, the ability to hot deploy from a folder, install from a maven repo, etc..These are all extras that OSGI doesn't have to do and are provided by additional projects like Karaf, GOGO, or Pax
Now on to Apache Karaf:
It is basically an OSGI environment that provides some additional goodies on top of a standard OSGI implementation. Because Apache Karaf is just built on standard OSGI, it can in theory run on any OSGI runtime. This gives you a uniform interface for working with OSGI runtimes.
Some goodies Apache Karaf provides that you won't see in a Apache Felix without some additional work:
Folder based hot deployment
A (IMHO) better default console than gogo. (org.apache.karaf.shell)
Remote SSH access to that console. (org.apache.karaf.shell.ssh)
Centralized Logging System. (org.apache.karaf.log)
It has it's own way of provisioning bundles and start levels. (org.apache.karaf.features)
Karaf has it's own maven plugins as well.
Pretty much anything here:
http://mvnrepository.com/search.html?query=org.apache.karaf*
I mentioned Karaf having it's own way of provisioning bundles and start levels. Apache Karaf also comes with a bunch of pre-defined ones to get started with. I know Apache Felix comes with some as well, through OBR, but Apache Karaf comes much more 'batteries-included'.
Apache Karaf is a swiss army knife to run OSGi "stuff" and non OSGi things bundled as OSGi.
Felix and Aries are default but the frameworks are pluggable, so equinox works as well.
"Unix like" shell accessible from CLI or SSH
Hotdeploy of bundles
May deploy almost anything as a bundle (plain .jar, spring xml, blueprint, etc)
WAR files
Deploy from maven - including autowrapping non OSGi bundles.
Web Console
Karaf features - ".kar files" that includes bundles and custom karaf features/commands.
A side note is that Karaf is part of ServiceMix (the initial name was ServiceMix kernel), so it has very tight integration with Apache Camel, Apache CXF and Apache ActiveMQ. Turning Karaf into an ESB with those features is trivial.
Apache Karaf is just an OSGi framework (it can be equinox, felix .etc) with a bunch of predefined modules.
Apache Karaf architecture:

Example using Jersey (REST resource), OSGi (Apache Felix), and Maven (build and deploy)?

I seem to be really struggling here. What I want to do (in this order) is:
1) Build a RESTful resource using a Jersey application and resource w/annotations (this is not the issue).
2) Package, install, and start that bundle into the Felix OSGi container, as an HTTP service, including dependencies.
3) Package, install, and start a WAR in the OSGi container that may incorporate #2 as a dependency.
And I would like to be able to do all of this using Maven.
I cannot seem to find a working example of even the individual steps, especially involving Maven, that work let alone the combination of those steps. I have tried cobbling together various q&a from across the web with varying levels of success but not an end-to-end working example yet.
Any pointers would be appreciated...
I do not have an example for Jersey but I have a tutorial for CXF with Apache Karaf (which uses Felix). It shows how to create a Rest service and build it with maven. Using Apache Karaf you can then deploy the bundle directly from the maven repo. Moving this to Jersey probably just means to exchange the lib and use another blueprint config to initialize the rest service.
Apache Karaf also allows to deploy wars and wabs but I have not yet tested them.
Apache Stanbol does most or all of this (not sure if the war packaging is included out of the box) to implement its RESTful services.
You'll have to dig through its codebase but searching for Jax-RS annotations in there should point you to the right places.
I also am really struggling with exactly what you are attempting to do. So far, I seem to be really close but alas not quite there, here's what I've been doing:
creating a War with Maven that defines my Jersey Resource's
bundling it with maven bundle plugin ( see section Adding OSGi metadata to existing projects without changing the packaging type ). Which allows me to run the restlets in Tomcat and test.
define a target in Eclipse that includes resources from my locally defined p2 site which I create with the p2-maven-plugin plugin. In this way I can gather up any of the dependencies from the WAR project into a p2 site, which I can deploy to an Eclipse defined target
Where I am stuck is trying to register the Jersey Resource's as services, for which I've tried:
using the JAX-RS OSGI connector, for which I eventually gave up on because it uses glassfish jersey which seems to export a version 2 API of Jersey when Jersey hasn't even defined a version 2 API yet. This caused package resolution problems when I wanted to use version 1.17 of Jersey libs.
registering the Resources using a Whiteboard a la Apache Felix HTTP Service, my current approach which doesn't seem to work yet.
And, finally, if the preceding doesn't work I'll try Amdatu
Another route I might try is from the Jersey project OSGI chapter
I tried this combination and made it up and running -
1- Modularity Specification-->OSGi specification
2- OSGi implementation-->Apache Felix 4.4.0
3- OSGi Runtime-->Apache Karaf 3.0.3
4- Software Architecture Specification of REST – JAX-RS
5- JAX-RX implementation-->Apache CXF – 2.7.5
You can refer this nice tutorial - http://java.dzone.com/articles/building-cxf-rest-service-osgi
Now, I am also planning to move to Jersey from CXF as the Jersey is the light wait reference implementation of JAX-RS. Now I am planning to use Jersey with Apache Felix/Apache Karaf. You can install Jersey in Karaf and deploy your Jersey Rest Web Services as Bundle. You can refer this tutorial - https://vzurczak.wordpress.com/2014/09/30/web-applications-with-osgi-working-with-jersey/
Here's a good example on github : https://github.com/ddragosd/jax-rs-on-karaf

Resources