Posts

Showing posts with the label pax-web

Karaf and Pax Web: disabling reverse lookup

Karaf can be a full WebContainer just by installing the war feature: features:install war The war feature will install Pax Web and Jetty web server. You can configure Pax Web using a configuration file etc/org.ops4j.pax.web.cfg. In this configuration, you can define a Jetty configuration file (like jetty.xml) using the following property: org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml Now, using the etc/jetty.xml, you have a complete access to the Jetty configuration, especially, you can define the Connector configuration. In the “default” connector (bound to port 8181 by default), you can set “advanced” configuration. An interesting configuration is the reverse lookup. Depending of your network, the DNS resolution may not work. By default, Jetty will try to do reverse DNS resolution, and if you can’t use a DNS server on the machine, you may encounter “bad response time”, because you will have to wait the timeout for each DNS lookup. ...

Load balancing with Apache Karaf Cellar, and mod_proxy_balancer

Thanks to Cellar, you can deploy your applications, CXF services, Camel routes, … on several Karaf nodes. When you use Cellar with web applications, or CXF/HTTP endpoints, a “classic” need is to load balance the HTTP requests on the Karaf nodes. You have different ways to do that: – using Camel Load Balancer EIP: it’s an interesting EIP, working with any kind of endpoints. However, it requires to have a Karaf running the Load Balancer routes, so it’s not always possible depending of the user security policy (for instance, putting it in DMZ or so) – using hardware appliances like F5, Juniper, Cisco: it’s a very good solution, “classic” solution in network teams. However, it requires expensive hardwares, not easy to buy and setup for test or “small” solution. – using Apache httpd with mod_proxy_balancer: it’s the solution that I’m going to detail. It’s a very stable solution, powerful and easy ...

Multiple HTTP connectors in Apache Karaf

Installing the http feature in Karaf leverages Pax Web to embed a Jetty webcontainer. By default, Karaf create a Jetty connector on the 8181 http port (and 8443 for https). You can change this port number by providing etc/org.ops4j.pax.web.cfg file. But, you can also create new connector in the embedded Jetty. You may see several advantages for multiple connectors: you can isolate a set of applications, CXF services, Camel routes on a dedicated port number you can setup a different configuration for each connector. For instance, you can create two SSL connectors, each with a different keystore, truststore, … You can find etc/jetty.xml configuration file where you can create custom Jetty configuration. NB: if you want to have both etc/org.ops4j.pax.web.cfg and etc/jetty.xmll, don’t forget to reference jetty.xml in org.ops4j.pax.web.cfg using the org.ops4j.pax.web.config.file property pointing to the jetty.xml, for instance: # in etc/org.ops4j.pax.web.cfg org.ops4j.pax.web.con...

Overview on Apache Karaf, Pax Web, and Camel archetypes

In my previous blog post, I introduced the Karaf Maven plugins. The Karaf Maven plugins are really helpful, starting from an existing POM. If you can write this POM by hand (it’s my favorite way ;)), we also provide several archetypes which create and pre-configure a Maven project for you. Karaf Archetypes The next Karaf release (2.2.5) provides a set of new archetypes: Assembly Archetype The karaf-assembly-archetype create a Maven project which create a custom Karaf distribution. It allows you to create your own Karaf distribution. The project downloads a Karaf standard distribution (in tar.gz and zip formats), unpack it, and create a new distribution. The easiest way to use it is to use the interactive mode: mvn archetype:generate -DarchetypeGroupId=org.apache.karaf.archetypes -DarchetypeArtifactId=karaf-assembly-archetype -DarchetypeVersion=2.2.5-SNAPSHOT Bundle Archetype If basically a bundle is a jar file with some special statement in the MANIFEST, the easiest way to create ...