Tag Archives: OSGi

How to Install Jetty Application Server


via How to Install Jetty Application Server | Examples Java Code Geeks.

Jetty is an open-source Servlet container and Application Server which is known to be lightweight, portable, robust, flexible, extensible and providing support for various technologies like SPDY, WebSocket, OSGi, JMX, JNDI, and JAAS. Jetty is very convenient for development and also widely used in production environments.

In this post, we are going to detail how to install and configure a Jetty Server. We are first going to describe how to setup and run a standalone Jetty. Thereafter we will mention some configuration options and skim through the modular architecture of Jetty.

Jetty presents Standalone, Embedded and Jetty Maven Plugin modes of operation. In this post we are going to use standalone Jetty.

Using the Vaadin (GWT) SuperDevMode in OSGi Environments


GWT and Vaadin come with a great feature to debug the client-side widget code in the Chrome browser. Using GWT’s code server, the Java code will be displayed in the Chrome browser, and you can set your breakpoints and do debugging stuff directly in Chrome. To run the superDevMode some preparations are required: Enable SuperDevMode in widgetset […]

https://floriansblog.wordpress.com/2015/07/07/using-the-vaadin-gwt-superdevmode-in-osgi-environments/

Jetty OSGi Example


via Jetty OSGi Example | Examples Java Code Geeks.

The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that enables developers to deploy Jetty and web applications inside an OSGi container. One can deploy traditional Java Web Applications or Context Handlers on Jetty within the OSGi container; in addition to this, OSGi bundles can be deployed as web applications.

In this example, we are going to show how we can deploy Web Applications on Jetty within an OSGi container. We are going to enable a Jetty Server on an OSGi container first, thereafter we are going to deploy a Servlet on our OSGi powered Jetty.

Gradle OSGI Plugin Example: BNDTools Bundle Integration


via Gradle OSGi Plugin Example: BNDTools Bundle Integration | Examples Java Code Geeks.

In this example we will talk about how to integrate OSGi frameworks with Gradle build tool. This work consists in build JAR files and customizing Manifest file through Gradle build Script and Deploying them in a OSGi Container like Apache Felix.

JBoss Fuse – Some less known trick


via Someday Never Comes: JBoss Fuse – Some less known trick.

  1. expose java static calls as Karaf shell native commands
  2. override OSGi Headers at deploy time
  3. override OSGi Headers after deploy time with OSGi Fragments

Expose java static calls as Karaf shell native commands

As part of my job as software engineer that has to collaborate with support guys and customers, I very often find myself in the need of extracting additional information from a system I don’t have access to.
Usual approaches, valid in all kind of softwares, are usually extracting logs, invoking interactive commands to obtain specific outputs or in what is the most complex case deploy some PoC unit that is supposed to verify a specific behavior.

JBoss Fuse, adn Karaf, the platform it’s based onto do alredy a great job in exposing all those data.

You have:

  • extensive logs and integration with Log4j
  • extensive list of jmx operation (you can eventually invoke over http with jolokia)
  • a large list of shell commands

But sometimes this is not enough. If you have seen my previous post about how to use Byteman on JBoss Fuse, you can imagine all the other cases:

  1. you need to print values that are not logged or returned in the code
  2. you might need to short-circuit some logic to hit a specific execution branch of your code
  3. you want to inject a line of code that wasn’t there at all

Maven Jetty Plugin Example


via Maven Jetty Plugin Example | Examples Java Code Geeks.

In this example, we shall show you how to integrate Apache Maven with Jetty. Apache Maven is a software project management and comprehension tool. It provides powerful features like superior dependency management including automatic updating and transitive dependencies.

It follows the principle of convention over configuration, due to which one can start with a minimal configuration and sensible defaults will be provided for all the missing configuration. Maven uses central repositories where various artifacts like JAR files can be hosted. It comes with a mechanism that resolves all project dependencies from these central repositories. So effectively you are resolved from keeping and providing JAR files on your project’s classpath.

Maven needs a file called ‘pom.xml’ where one can define dependencies as we will be seeing in the example below. Once you choose to build the project, these dependencies will be automatically fetched from central repository and put on your application’s classpath. Jetty is a web server and a servlet container. It also provides support for SPDY, WebSocket, OSGi, JMX, JNDI, JAAS etc. So it is quite similar to the likes of other application containers. However if differs from them by providing a really tiny memory footprint and being Embeddable.

This means we do not need to install Jetty and then deploy our application. We just need to start our application from command line and Jetty will be started as an embedded container inside our application.This makes Jetty quite handy for tasks like Micro Services implementation and integration tests writing.

For this example we will be using Apache Maven 3.2.5 and Jetty Version 9.2.6. The example is compilable on Java 5 and above.

Making JavaFX better with OSGi


Click to Read

Why you should run JavaFX on OSGi

OSGi makes JavaFX better for three reasons:
  1. Hot code reload during development
  2. A services based architecture keeps UI features nicely isolated
  3. Provisioning to devices
Let’s take a look at all of them in detail before we see how to make JavaFX run on OSGi.