In standalone AEM installation, Is felix OSGi container present inside jetty servlet container ? Or is the Jetty Server is installed as a bundle in Felix OSGi container ?
Which one will start first when AEM is started ?
And how will this change for a WAR based installation?
According to this this answer both are possible. But I want to know which approach is followed in AEM.
AEM standalone (using quickstart) starts the felix framework and deploys jetty as bundle inside.
You can check this by starting AEM and then open the system console. In the bundle list you will find org.apache.felix.http.jetty. This is the felix implementation of the OSGi http service spec and embeds the jetty server.
Related
Does some one already managed to setup a Vaadin (19 to 21) Web application using Spring Boot and Osgi (as bundle) ?
I've managed to have a Vaadin application running under Osgi container (Karaf).
I've managed to have a Spring Boot Application running under Osgi container (Karaf).
But not both at the same time.
In fact, when trying, no route are being registered and FixedVaadinServlet is never called.
Thanks for help.
I have to say that I don't exactly understand your question since Spring is not OSGi compatible (it just has no OSGi manifest) so I don't see how it may work at all.
Now I'm going to guess....
I've managed to have a Vaadin application running under Osgi container (Karaf).
So your application is built as an OSGi bundle and you have deployed it to Karaf (OSGI container) and it works.
I've managed to have a Spring Boot Application running under Osgi container (Karaf).
You have built something (either WAR or a Spring boot Jar) which is a Web application and you have deployed it to Karaf AS A WEB Application.
This feature provided by Karaf : it's not pure OSGi container. It allows to deploy WEB applications to it.
These Web Applications have no any relation to OSGi.
So you have no Spring application which works in OSGi: if you use another OSGi container (which doesn't support extra features like Web app deployment) then you won't be able to use Spring there since as I said Spring is not OSGi compatible.
So I don't see how it's possible to use Spring + OSGi at all.
Can OSGi components be deployed to any Container like Tomcat/Websphere/JBoss..etc ? (just as we deploy a WAR file) or do they require any special libraries or OSGi containers to run the OSGi components ?
If you want just expose the "component" classes, you can treat the jar files as .. jar files.
If you consider the OSGi "component" as a "bundle" exposing some services and doing something, then answer is "no". You need an OSGi container (Karaf, WebSphere Liberty, Carbon, Glassfish, JBoss WildFly ...).
However - as you can see, some application servers provide OSGi support natively.
OSGi components (I guess you mean bundles) require an OSGi framework to run in. So a plain servlet container will not work. Some versions of JBoss provide support for OSGi though.
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:
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.
Is it possible to have standard war deployment, which can be deployed on tomcat and also can be build as OSGi bundle and deployed with other bundles in OSGi container tomcat(i think virgo)?
Yes, there's a good deal of interoperability between WARs and WABs. Apache Aries and WebSphere Application Server will convert WARs to WABs on deployment. This is a good way to get up and running, but it's a better practice to use proper WABs in which you build in the OSGi metadata yourself. The extra OSGi headers won't interfere with the deployment in a normal Tomcat container, so the WAB has the greatest flexibility.
For your build, you have a number of options. For example, the maven bundle plugin can be configured to build WABs, or you can use Eclipse PDE's tooling support for OSGi metadata.
Pax-Url-War provides this functionality to containers like Apache Karaf. In brief, this allows you to import an URL like war:file:///path/to/myapp.war and Pax will wrap it as an OSGi bundle, optionally changing the URL root and other parameters on the fly.