SlideShare a Scribd company logo
Enterprise Development 
with …
What needs to be done to run 
JEE like applications inside Karaf?
2014-­‐10-­‐23 
3 
@anierbeck 
- Karaf PMC, Apache Member 
- OPS4j Pax Web Project Lead 
- Senior IT Consultant @codecentric 
- co-Author of Apache Karaf Cookbook
Agenda 
• Enterprise Requirements 
• OSGi with Karaf 
• Enterprise Requirements on Karaf 
• Specialties 
• Http Service 
• Cellar - or how to cluster Karaf 
• Summary 
2014-­‐10-­‐23 
4
Enterprise Requirements
Enterprise Java 
EJB 3.1 CDI 
2014-­‐10-­‐23 
6 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
JNDI 
JAX-RPC 
SAAJ
OSGi with Karaf
OSGi - a very brief introduction 
• Modular 
• OSGi Bundles: 
• High Cohesion (One classloader/bundle) 
• Low Coupling (Package Import/Export) 
• Versioning per bundle ( [1.0,2,0) ) 
• Service Registry 
2014-­‐10-­‐23 
8
What is Karaf 
• Container 
• OSGi Applications 
• Ligthtweight 
• expandable to Full Enterprise support 
• Covers all major needs 
• Logging 
• Deployment 
• Configuration 
2014-­‐10-­‐23 
9
Karaf - Overview 
2014-­‐10-­‐23 
10 
Config Logging Deployer 
Console Admin 
OSGi Framework - Felix / Equinox 
JMX 
Blueprint SSH
Enterprise requirements on Karaf
Karaf 
EJB 3.1 CDI 
2014-­‐10-­‐23 
12 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
JNDI 
JAX-RPC 
SAAJ
Enterprise - Pax Web 
EJB 3.1 CDI 
2014-­‐10-­‐23 
13 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
JNDI 
JAX-RPC 
SAAJ
Enterprise - Pax CDI 
EJB 3.1 CDI 
2014-­‐10-­‐23 
14 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
JNDI 
JAX-RPC 
SAAJ
Enterprise - Aries 
EJB 3.1 CDI 
2014-­‐10-­‐23 
15 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
JNDI 
JAX-RPC 
SAAJ
Enterprise - Tomee aka OpenEJB 
EJB 3.1 CDI 
2014-­‐10-­‐23 
16 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS 
JAX-RPC 
JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
SAAJ JNDI
Enterprise - CXF 
EJB 3.1 CDI 
2014-­‐10-­‐23 
17 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS 
JAX-RPC 
JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
SAAJ JNDI
Enterprise - ActiveMQ 
EJB 3.1 CDI 
2014-­‐10-­‐23 
18 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS 
JAX-RPC 
JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
SAAJ JNDI
Enterprise - Cellar 
EJB 3.1 CDI 
2014-­‐10-­‐23 
19 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS 
JAX-RPC 
JAX-RS 
JAXR 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
SAAJ JNDI
Enterprise - Karaf with features 
EJB 3.1 CDI 
2014-­‐10-­‐23 
20 
Servlet 3 
JSF 2 
JSP 
JPA 2 
JTA 
Bean 
Validation 
JAX-WS 
JAX-RPC 
JAX-RS 
JAXR 
SAAJ 
JAXB 
JMS 
JAAS 
JASPIC 
JACC 
JSR-88 
JCA 
JavaMail 
JSR-77 
RMI 
JNDI
Specialties
JPA - Karaf 
2014-­‐10-­‐23 
22 
<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" 
version="2.0" > 
<persistence-unit name="cookbook" transaction-type="JTA"> 
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> 
<jta-data-source> 
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/cookbook) 
</jta-data-source> 
<class>de.nierbeck.apachecon.persistence.entity.Book</class> 
<class>de.nierbeck.apachecon.persistence.entity.Recipe</class> 
<exclude-unlisted-classes>true</exclude-unlisted-classes> 
<properties> 
<property name="openjpa.Log" value="slf4j" /> 
<property name="openjpa.RuntimeUnenhancedClasses" value="supported" /> 
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/> 
</properties> 
</persistence-unit> 
</persistence>
JPA - Karaf 
2014-­‐10-­‐23 
22 
<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" 
version="2.0" > 
<persistence-unit name="cookbook" transaction-type="JTA"> 
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> 
<jta-data-source> 
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/cookbook) 
</jta-data-source> 
<class>de.nierbeck.apachecon.persistence.entity.Book</class> 
<class>de.nierbeck.apachecon.persistence.entity.Recipe</class> 
<exclude-unlisted-classes>true</exclude-unlisted-classes> 
<properties> 
<property name="openjpa.Log" value="slf4j" /> 
<property name="openjpa.RuntimeUnenhancedClasses" value="supported" /> 
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/> 
</properties> 
</persistence-unit> 
</persistence> 
To have this blueprint 
JNDI is needed
JTA - Karaf 
2014-­‐10-­‐23 
23 
<blueprint default-activation=„eager" 
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" 
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0" 
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> 
<bean id="cookBookServiceImpl" 
class="de.nierbeck.apachecon.persistence.dao.CookBookServiceImpl"> 
<jpa:context property="em" unitname="cookbook" /> 
<tx:transaction method="*" value="Required" /> 
</bean> 
<service id="cookBookService" ref="cookBookServiceImpl" 
interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> 
</blueprint>
JTA - Karaf 
2014-­‐10-­‐23 
23 
<blueprint default-activation=„eager" 
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" 
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0" 
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> 
<bean id="cookBookServiceImpl" 
class="de.nierbeck.apachecon.persistence.dao.CookBookServiceImpl"> 
<jpa:context property="em" unitname="cookbook" /> 
<tx:transaction method="*" value="Required" /> 
</bean> 
<service id="cookBookService" ref="cookBookServiceImpl" 
interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> 
</blueprint> 
To have this blueprint 
JPA and JTA is needed
Client - Karaf 
2014-­‐10-­‐23 
24 
<?xml version="1.0" encoding="UTF-8"?> 
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
default-activation="lazy"> 
<reference id="cookBookService" 
interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> 
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0"> 
<command> 
<action class="de.nierbeck.apachecon.commands.CreateBook"> 
<property name="bookService" ref="cookBookService" /> 
</action> 
</command> 
... 
</command-bundle> 
</blueprint>
Demo
Persistence 
2014-­‐10-­‐23 
26
Client 
2014-­‐10-­‐23 
27
Client Shell 
2014-­‐10-­‐23 
28
Client - Shell 
2014-­‐10-­‐23 
29
Client Shell 
2014-­‐10-­‐23 
30
Client - Shell 
2014-­‐10-­‐23 
31
Http Service 
with …
HTTP Service 
2014-­‐10-­‐23 
33 
• Using an Activator: 
final HttpContext httpContext = httpService 
.createDefaultHttpContext(); 
// register the BookServlet 
// first wait for the DAO-Service 
CookBookService cookBookService; 
ServiceReference<CookBookService> serviceReference = bundleContext 
.getServiceReference(CookBookService.class); 
cookBookService = bundleContext.getService(serviceReference); 
//now create the servlet 
ViewBookServlet viewBookServlet = new ViewBookServlet(); 
//set the DAO to the Servlet 
viewBookServlet.setCookBookService(cookBookService); 
final Dictionary<String, Object> initParams = new Hashtable<String, Object>(); 
try { 
httpService.registerServlet("/book", // alias 
viewBookServlet, 
initParams, httpContext);
Whiteboard 
• Using the whiteboard approach via Activator 
public void start(BundleContext bc) throws Exception { 
bundleContext = bc; 
// first wait for the DAO-Service 
CookBookService cookBookService; 
ServiceReference<CookBookService> serviceReference = bundleContext 
2014-­‐10-­‐23 
34 
.getServiceReference(CookBookService.class); 
cookBookService = bundleContext.getService(serviceReference); 
// create new Servlet 
ViewBookServlet cookBookViewServlet = new ViewBookServlet(); 
cookBookViewServlet.setCookBookService(cookBookService); 
registerServiced = bundleContext.registerService(Servlet.class, 
cookBookViewServlet, null); 
}
Whiteboard 
2014-­‐10-­‐23 
35 
• Using the whiteboard approach via Blueprint 
<blueprint default-activation="eager"> 
<reference id="cookBookService" 
interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> 
<bean id="viewBookServlet" 
class="de.nierbeck.apachecon.view.ViewBookServlet" > 
<property name="cookBookService" ref="cookBookService"/> 
</bean> 
<service id="servletService" interface="javax.servlet.Servlet" 
ref="viewBookServlet" /> 
</blueprint>
Servlet 3.0 - Just annotation 
2014-­‐10-­‐23 
36 
@WebServlet(urlPatterns = "/book") 
public class ViewBookServlet extends HttpServlet { 
/** 
* 
*/ 
private static final long serialVersionUID = 1L; 
@Inject 
@OsgiService 
CookBookService cookBookService; 
@Override 
protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
throws ServletException, IOException { 
... 
} 
}
LOST?
Registering - Servlet 
2014-­‐10-­‐23 
38 
Pax-Web 
HTTP Service 
Service- 
Registry 
Servlet
Registering - Servlet 
2014-­‐10-­‐23 
38 
Pax-Web 
HTTP Service 
Service- 
Registry 
Servlet 
Registerd
Registering - Servlet 
2014-­‐10-­‐23 
38 
Pax-Web 
HTTP Service 
Service- 
Registry 
Servlet 
Registerd 
Registerd
Registering - Whiteboard 
2014-­‐10-­‐23 
39 
Pax-Web 
WebContainer 
Service-Tracker 
Service- 
Registry 
Servlet
Registering - Whiteboard 
2014-­‐10-­‐23 
39 
Pax-Web 
WebContainer 
Service-Tracker 
Service- 
Registry 
Servlet 
Registerd
Registering - Whiteboard 
2014-­‐10-­‐23 
39 
Pax-Web 
WebContainer 
Service-Tracker 
Service- 
Registry 
Servlet 
Registerd 
Registerd
Registering - Whiteboard 
2014-­‐10-­‐23 
39 
Pax-Web 
WebContainer 
Service-Tracker 
Service- 
Registry 
Servlet 
Registerd 
Registerd
Registering - WAR 
2014-­‐10-­‐23 
40 
Pax-Web 
WebContainer 
Pax-Web 
WAR Extender 
Service- 
Registry 
WAB-Bundle 
Servlet
Registering - WAR 
2014-­‐10-­‐23 
40 
Pax-Web 
WebContainer 
Pax-Web 
WAR Extender 
Service- 
Registry 
WAB-Bundle 
Servlet 
Registerd
Registering - WAR 
2014-­‐10-­‐23 
40 
Pax-Web 
WebContainer 
Pax-Web 
WAR Extender 
Service- 
Registry 
WAB-Bundle 
Servlet 
Registerd Registerd
Registering - WAR 
2014-­‐10-­‐23 
40 
Pax-Web 
WebContainer 
Pax-Web 
WAR Extender 
Service- 
Registry 
WAB-Bundle 
Servlet 
Registerd Registerd
Servlet + JPA / Service 
2014-­‐10-­‐23 
41 
Blueprint 
Extender 
Pax-Web 
WAR Extender 
JPA-Bundle 
Service- 
Registry 
JPA - 
Service 
WEB-Bundle 
Servlet
Servlet + JPA / Service 
2014-­‐10-­‐23 
41 
Blueprint 
Extender 
Pax-Web 
WAR Extender 
JPA-Bundle 
Service- 
Registry 
JPA - 
Service 
WEB-Bundle 
Servlet 
Registerd
Servlet + JPA / Service 
2014-­‐10-­‐23 
41 
Blueprint 
Extender 
Pax-Web 
WAR Extender 
JPA-Bundle 
Service- 
Registry 
JPA - 
Service 
WEB-Bundle 
Servlet 
Registerd 
Injected
Servlet + JPA / Service 
2014-­‐10-­‐23 
41 
Blueprint 
Extender 
Pax-Web 
WAR Extender 
JPA-Bundle 
Service- 
Registry 
JPA - 
Service 
WEB-Bundle 
Servlet 
Registerd Registerd 
Injected
Demo
View 
2014-­‐10-­‐23 
43
View 
2014-­‐10-­‐23 
44
Cluster 
provided by Apache Karaf Cellar
Cellar - Cluster Communication 
2014-­‐10-­‐23 
46
Cellar - Cluster Communication 
2014-­‐10-­‐23 
47 
Hazelcast
Cellar - Events 
2014-­‐10-­‐23 
48
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
osgi:install mvn:groupId/artifactId/version 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
Hazelcast 
DEPRECATED
Cellar - Distributing Bundles 
2014-­‐10-­‐23 
49 
Node A 
Node B 
Node C 
Maven Repository 
cluster:install mvn:groupId/artifactId/version 
Hazelcast 
DEPRECATED
Cellar - RMI 
2014-­‐10-­‐23 
50 
Group 1 
Node A 
Consumes OSGi-Service 
Group 2 
Node B 
Consumes OSGi-Service 
Node C 
Consumes OSGi-Service 
Node A 
Provides OSGi-Service 
Node B 
Hazelcast Provides OSGi-Service
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cellar - Web session failover 
2014-­‐10-­‐23 
51 
Node A 
Hazelcast 
DataBase 
Client 
Filter Servlet 
Node B 
Filter Servlet
Cluster - Demo
Presentation Layer 
2014-­‐10-­‐23 
53
web.xml - Hazelcast 
2014-­‐10-­‐23 
54 
• Hazelcast for Session Replication 
<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
version="3.0"> 
<filter> 
<filter-name>hazelcast-filter</filter-name> 
<filter-class>com.hazelcast.web.WebFilter</filter-class> 
<!-- 
Name of the distributed map storing 
your web session objects 
--> 
<init-param> 
<param-name>map-name</param-name> 
<param-value>my-sessions</param-value> 
</init-param> 
<init-param> 
<param-name>sticky-session</param-name> 
<param-value>false</param-value> 
</init-param> 
</filter> 
<filter-mapping> 
<filter-name>hazelcast-filter</filter-name> 
<url-pattern>/*</url-pattern> 
<dispatcher>FORWARD</dispatcher> 
<dispatcher>INCLUDE</dispatcher> 
<dispatcher>REQUEST</dispatcher> 
</filter-mapping> 
<listener> 
<listener-class>com.hazelcast.web.SessionListener</listener-class> 
</listener> 
</web-app>
View 
2014-­‐10-­‐23 
55
View 
2014-­‐10-­‐23 
56
View 
2014-­‐10-­‐23 
57
SUMMARY
Enterprise - Karaf 
2014-­‐10-­‐23 
59 
Servlet 3 
EJB 3.1 CDI 
JSF 2 
JSP 
JPA 2 
JTA 
JAX-WS 
JAX-RPC 
JAX-RS 
JAXR 
SAAJ 
JAXB 
JMS 
JNDI JAAS RMI
JEE with Karaf? 
• Adoptions needed? YES 
• Minor on Persistence - JNDI lookup 
• Minor on transaction - Blueprint JTA 
• Wiring of Services: 
• Use Blueprint 
• Use Servlet 3.0 with CDI - @OsgiService 
• Session Replication throughout cluster, it’s still standard 
Hazelcast 
2014-­‐10-­‐23 
60
Resources 
• @anierbeck 
• notitzblog.nierbeck.de 
• https://github.com/ANierbeck/karaf-enterprise-sample 
• www.codecentric.de 
• karaf.apache.org 
• https://ops4j1.jira.com/wiki/display/paxweb/Pax+Web 
• #karaf at irc.codehaus.org 
• https://www.packtpub.com/application-development/apache-karaf-cookbook 
• Pictures, mainly from flickr 
2014-­‐10-­‐23 
61
ApacheCon EU 2014: Enterprise Development with Apache Karaf
THANKS FOR LISTENING
Thanks to the Apache 
Community
Questions
Thanks

More Related Content

PDF
OSGi for real in the enterprise: Apache Karaf - NLJUG J-FALL 2010
PDF
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
PDF
OSGi ecosystems compared on Apache Karaf - Christian Schneider
PPT
OSGi & Blueprint
PDF
Microservices OSGi-running-with-apache-karaf
ODP
W-JAX 2011: OSGi with Apache Karaf
PDF
Modular Architectures using Micro Services
PDF
Jahia DX 7.2 : Bye bye felix, hello karaf
OSGi for real in the enterprise: Apache Karaf - NLJUG J-FALL 2010
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi & Blueprint
Microservices OSGi-running-with-apache-karaf
W-JAX 2011: OSGi with Apache Karaf
Modular Architectures using Micro Services
Jahia DX 7.2 : Bye bye felix, hello karaf

What's hot (19)

PDF
CamelOne 2013 Karaf A-MQ Camel CXF Security
KEY
How Flipkart scales PHP
KEY
Jug Poitou Charentes - Apache, OSGi and Karaf
PDF
AWS Observability Made Simple
PDF
JBoss Fuse - Fuse workshop EAP container
PDF
Apache Traffic Server & Lua
PDF
Best Practices - PHP and the Oracle Database
PDF
Tomcatx performance-tuning
PDF
Java EE 7 Soup to Nuts at JavaOne 2014
PDF
Kubernetes Operators And The Redis Enterprise Journey: Michal Rabinowitch
ODP
Sun Web Server Brief
PDF
What's New in WildFly 9?
PDF
Cloud Foundry Open Tour India 2012 , Keynote
PDF
Connecting Apache Kafka With Mule ESB
PPTX
Moving From Actions & Behaviors to Microservices
PDF
Make easier Integration of your services with Fuse Solutions - RedHat 2013
PDF
Bee con2016 presentation_20160125004_installing
PDF
Guide to alfresco monitoring
PPTX
201511 - Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...
CamelOne 2013 Karaf A-MQ Camel CXF Security
How Flipkart scales PHP
Jug Poitou Charentes - Apache, OSGi and Karaf
AWS Observability Made Simple
JBoss Fuse - Fuse workshop EAP container
Apache Traffic Server & Lua
Best Practices - PHP and the Oracle Database
Tomcatx performance-tuning
Java EE 7 Soup to Nuts at JavaOne 2014
Kubernetes Operators And The Redis Enterprise Journey: Michal Rabinowitch
Sun Web Server Brief
What's New in WildFly 9?
Cloud Foundry Open Tour India 2012 , Keynote
Connecting Apache Kafka With Mule ESB
Moving From Actions & Behaviors to Microservices
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Bee con2016 presentation_20160125004_installing
Guide to alfresco monitoring
201511 - Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...
Ad

Similar to ApacheCon EU 2014: Enterprise Development with Apache Karaf (20)

PDF
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010
ODP
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
PDF
Boston 2011 OTN Developer Days - Java EE 6
PPT
J boss
PDF
Java web services using JAX-WS
PDF
Running Kafka as a Native Binary Using GraalVM with Ozan Günalp
PDF
Java EE 7 for WebLogic 12c Developers
PPTX
Java EE 8
PDF
GlassFish REST Administration Backend
PDF
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
PDF
Elastic and Cloud-ready Applications with Payara Micro
PDF
Elastic and Cloud-ready Applications with Payara Micro
PDF
Elastic and Cloud-ready Applications with Payara Micro
PPTX
18CSC311J Web Design and Development UNIT-3
PDF
Faster & Greater Messaging System HornetQ zzz
PPTX
Solving anything in VCL
KEY
Cooking with Chef
PDF
Meetup 2022 - APIs with Quarkus.pdf
PDF
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
PPTX
Ch10.애플리케이션 서버의 병목_발견_방법
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
Boston 2011 OTN Developer Days - Java EE 6
J boss
Java web services using JAX-WS
Running Kafka as a Native Binary Using GraalVM with Ozan Günalp
Java EE 7 for WebLogic 12c Developers
Java EE 8
GlassFish REST Administration Backend
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
18CSC311J Web Design and Development UNIT-3
Faster & Greater Messaging System HornetQ zzz
Solving anything in VCL
Cooking with Chef
Meetup 2022 - APIs with Quarkus.pdf
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
Ch10.애플리케이션 서버의 병목_발견_방법
Ad

Recently uploaded (20)

PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
composite construction of structures.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Sustainable Sites - Green Building Construction
PPTX
Geodesy 1.pptx...............................................
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Construction Project Organization Group 2.pptx
Structs to JSON How Go Powers REST APIs.pdf
composite construction of structures.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Operating System & Kernel Study Guide-1 - converted.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Lesson 3_Tessellation.pptx finite Mathematics
Embodied AI: Ushering in the Next Era of Intelligent Systems
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Sustainable Sites - Green Building Construction
Geodesy 1.pptx...............................................
bas. eng. economics group 4 presentation 1.pptx
Foundation to blockchain - A guide to Blockchain Tech
CYBER-CRIMES AND SECURITY A guide to understanding
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Construction Project Organization Group 2.pptx

ApacheCon EU 2014: Enterprise Development with Apache Karaf

  • 2. What needs to be done to run JEE like applications inside Karaf?
  • 3. 2014-­‐10-­‐23 3 @anierbeck - Karaf PMC, Apache Member - OPS4j Pax Web Project Lead - Senior IT Consultant @codecentric - co-Author of Apache Karaf Cookbook
  • 4. Agenda • Enterprise Requirements • OSGi with Karaf • Enterprise Requirements on Karaf • Specialties • Http Service • Cellar - or how to cluster Karaf • Summary 2014-­‐10-­‐23 4
  • 6. Enterprise Java EJB 3.1 CDI 2014-­‐10-­‐23 6 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI JNDI JAX-RPC SAAJ
  • 8. OSGi - a very brief introduction • Modular • OSGi Bundles: • High Cohesion (One classloader/bundle) • Low Coupling (Package Import/Export) • Versioning per bundle ( [1.0,2,0) ) • Service Registry 2014-­‐10-­‐23 8
  • 9. What is Karaf • Container • OSGi Applications • Ligthtweight • expandable to Full Enterprise support • Covers all major needs • Logging • Deployment • Configuration 2014-­‐10-­‐23 9
  • 10. Karaf - Overview 2014-­‐10-­‐23 10 Config Logging Deployer Console Admin OSGi Framework - Felix / Equinox JMX Blueprint SSH
  • 12. Karaf EJB 3.1 CDI 2014-­‐10-­‐23 12 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI JNDI JAX-RPC SAAJ
  • 13. Enterprise - Pax Web EJB 3.1 CDI 2014-­‐10-­‐23 13 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI JNDI JAX-RPC SAAJ
  • 14. Enterprise - Pax CDI EJB 3.1 CDI 2014-­‐10-­‐23 14 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI JNDI JAX-RPC SAAJ
  • 15. Enterprise - Aries EJB 3.1 CDI 2014-­‐10-­‐23 15 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI JNDI JAX-RPC SAAJ
  • 16. Enterprise - Tomee aka OpenEJB EJB 3.1 CDI 2014-­‐10-­‐23 16 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RPC JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI SAAJ JNDI
  • 17. Enterprise - CXF EJB 3.1 CDI 2014-­‐10-­‐23 17 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RPC JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI SAAJ JNDI
  • 18. Enterprise - ActiveMQ EJB 3.1 CDI 2014-­‐10-­‐23 18 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RPC JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI SAAJ JNDI
  • 19. Enterprise - Cellar EJB 3.1 CDI 2014-­‐10-­‐23 19 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RPC JAX-RS JAXR JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI SAAJ JNDI
  • 20. Enterprise - Karaf with features EJB 3.1 CDI 2014-­‐10-­‐23 20 Servlet 3 JSF 2 JSP JPA 2 JTA Bean Validation JAX-WS JAX-RPC JAX-RS JAXR SAAJ JAXB JMS JAAS JASPIC JACC JSR-88 JCA JavaMail JSR-77 RMI JNDI
  • 22. JPA - Karaf 2014-­‐10-­‐23 22 <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0" > <persistence-unit name="cookbook" transaction-type="JTA"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <jta-data-source> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/cookbook) </jta-data-source> <class>de.nierbeck.apachecon.persistence.entity.Book</class> <class>de.nierbeck.apachecon.persistence.entity.Recipe</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="openjpa.Log" value="slf4j" /> <property name="openjpa.RuntimeUnenhancedClasses" value="supported" /> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/> </properties> </persistence-unit> </persistence>
  • 23. JPA - Karaf 2014-­‐10-­‐23 22 <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0" > <persistence-unit name="cookbook" transaction-type="JTA"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <jta-data-source> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/cookbook) </jta-data-source> <class>de.nierbeck.apachecon.persistence.entity.Book</class> <class>de.nierbeck.apachecon.persistence.entity.Recipe</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="openjpa.Log" value="slf4j" /> <property name="openjpa.RuntimeUnenhancedClasses" value="supported" /> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/> </properties> </persistence-unit> </persistence> To have this blueprint JNDI is needed
  • 24. JTA - Karaf 2014-­‐10-­‐23 23 <blueprint default-activation=„eager" xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> <bean id="cookBookServiceImpl" class="de.nierbeck.apachecon.persistence.dao.CookBookServiceImpl"> <jpa:context property="em" unitname="cookbook" /> <tx:transaction method="*" value="Required" /> </bean> <service id="cookBookService" ref="cookBookServiceImpl" interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> </blueprint>
  • 25. JTA - Karaf 2014-­‐10-­‐23 23 <blueprint default-activation=„eager" xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> <bean id="cookBookServiceImpl" class="de.nierbeck.apachecon.persistence.dao.CookBookServiceImpl"> <jpa:context property="em" unitname="cookbook" /> <tx:transaction method="*" value="Required" /> </bean> <service id="cookBookService" ref="cookBookServiceImpl" interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> </blueprint> To have this blueprint JPA and JTA is needed
  • 26. Client - Karaf 2014-­‐10-­‐23 24 <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy"> <reference id="cookBookService" interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0"> <command> <action class="de.nierbeck.apachecon.commands.CreateBook"> <property name="bookService" ref="cookBookService" /> </action> </command> ... </command-bundle> </blueprint>
  • 27. Demo
  • 31. Client - Shell 2014-­‐10-­‐23 29
  • 33. Client - Shell 2014-­‐10-­‐23 31
  • 35. HTTP Service 2014-­‐10-­‐23 33 • Using an Activator: final HttpContext httpContext = httpService .createDefaultHttpContext(); // register the BookServlet // first wait for the DAO-Service CookBookService cookBookService; ServiceReference<CookBookService> serviceReference = bundleContext .getServiceReference(CookBookService.class); cookBookService = bundleContext.getService(serviceReference); //now create the servlet ViewBookServlet viewBookServlet = new ViewBookServlet(); //set the DAO to the Servlet viewBookServlet.setCookBookService(cookBookService); final Dictionary<String, Object> initParams = new Hashtable<String, Object>(); try { httpService.registerServlet("/book", // alias viewBookServlet, initParams, httpContext);
  • 36. Whiteboard • Using the whiteboard approach via Activator public void start(BundleContext bc) throws Exception { bundleContext = bc; // first wait for the DAO-Service CookBookService cookBookService; ServiceReference<CookBookService> serviceReference = bundleContext 2014-­‐10-­‐23 34 .getServiceReference(CookBookService.class); cookBookService = bundleContext.getService(serviceReference); // create new Servlet ViewBookServlet cookBookViewServlet = new ViewBookServlet(); cookBookViewServlet.setCookBookService(cookBookService); registerServiced = bundleContext.registerService(Servlet.class, cookBookViewServlet, null); }
  • 37. Whiteboard 2014-­‐10-­‐23 35 • Using the whiteboard approach via Blueprint <blueprint default-activation="eager"> <reference id="cookBookService" interface="de.nierbeck.apachecon.persistence.api.CookBookService" /> <bean id="viewBookServlet" class="de.nierbeck.apachecon.view.ViewBookServlet" > <property name="cookBookService" ref="cookBookService"/> </bean> <service id="servletService" interface="javax.servlet.Servlet" ref="viewBookServlet" /> </blueprint>
  • 38. Servlet 3.0 - Just annotation 2014-­‐10-­‐23 36 @WebServlet(urlPatterns = "/book") public class ViewBookServlet extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; @Inject @OsgiService CookBookService cookBookService; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ... } }
  • 39. LOST?
  • 40. Registering - Servlet 2014-­‐10-­‐23 38 Pax-Web HTTP Service Service- Registry Servlet
  • 41. Registering - Servlet 2014-­‐10-­‐23 38 Pax-Web HTTP Service Service- Registry Servlet Registerd
  • 42. Registering - Servlet 2014-­‐10-­‐23 38 Pax-Web HTTP Service Service- Registry Servlet Registerd Registerd
  • 43. Registering - Whiteboard 2014-­‐10-­‐23 39 Pax-Web WebContainer Service-Tracker Service- Registry Servlet
  • 44. Registering - Whiteboard 2014-­‐10-­‐23 39 Pax-Web WebContainer Service-Tracker Service- Registry Servlet Registerd
  • 45. Registering - Whiteboard 2014-­‐10-­‐23 39 Pax-Web WebContainer Service-Tracker Service- Registry Servlet Registerd Registerd
  • 46. Registering - Whiteboard 2014-­‐10-­‐23 39 Pax-Web WebContainer Service-Tracker Service- Registry Servlet Registerd Registerd
  • 47. Registering - WAR 2014-­‐10-­‐23 40 Pax-Web WebContainer Pax-Web WAR Extender Service- Registry WAB-Bundle Servlet
  • 48. Registering - WAR 2014-­‐10-­‐23 40 Pax-Web WebContainer Pax-Web WAR Extender Service- Registry WAB-Bundle Servlet Registerd
  • 49. Registering - WAR 2014-­‐10-­‐23 40 Pax-Web WebContainer Pax-Web WAR Extender Service- Registry WAB-Bundle Servlet Registerd Registerd
  • 50. Registering - WAR 2014-­‐10-­‐23 40 Pax-Web WebContainer Pax-Web WAR Extender Service- Registry WAB-Bundle Servlet Registerd Registerd
  • 51. Servlet + JPA / Service 2014-­‐10-­‐23 41 Blueprint Extender Pax-Web WAR Extender JPA-Bundle Service- Registry JPA - Service WEB-Bundle Servlet
  • 52. Servlet + JPA / Service 2014-­‐10-­‐23 41 Blueprint Extender Pax-Web WAR Extender JPA-Bundle Service- Registry JPA - Service WEB-Bundle Servlet Registerd
  • 53. Servlet + JPA / Service 2014-­‐10-­‐23 41 Blueprint Extender Pax-Web WAR Extender JPA-Bundle Service- Registry JPA - Service WEB-Bundle Servlet Registerd Injected
  • 54. Servlet + JPA / Service 2014-­‐10-­‐23 41 Blueprint Extender Pax-Web WAR Extender JPA-Bundle Service- Registry JPA - Service WEB-Bundle Servlet Registerd Registerd Injected
  • 55. Demo
  • 58. Cluster provided by Apache Karaf Cellar
  • 59. Cellar - Cluster Communication 2014-­‐10-­‐23 46
  • 60. Cellar - Cluster Communication 2014-­‐10-­‐23 47 Hazelcast
  • 61. Cellar - Events 2014-­‐10-­‐23 48
  • 62. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast
  • 63. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository osgi:install mvn:groupId/artifactId/version Hazelcast
  • 64. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast
  • 65. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast
  • 66. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast
  • 67. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast
  • 68. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast
  • 69. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast
  • 70. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository Hazelcast DEPRECATED
  • 71. Cellar - Distributing Bundles 2014-­‐10-­‐23 49 Node A Node B Node C Maven Repository cluster:install mvn:groupId/artifactId/version Hazelcast DEPRECATED
  • 72. Cellar - RMI 2014-­‐10-­‐23 50 Group 1 Node A Consumes OSGi-Service Group 2 Node B Consumes OSGi-Service Node C Consumes OSGi-Service Node A Provides OSGi-Service Node B Hazelcast Provides OSGi-Service
  • 73. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 74. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 75. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 76. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 77. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 78. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 79. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 80. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 81. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 82. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 83. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 84. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 85. Cellar - Web session failover 2014-­‐10-­‐23 51 Node A Hazelcast DataBase Client Filter Servlet Node B Filter Servlet
  • 88. web.xml - Hazelcast 2014-­‐10-­‐23 54 • Hazelcast for Session Replication <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <filter> <filter-name>hazelcast-filter</filter-name> <filter-class>com.hazelcast.web.WebFilter</filter-class> <!-- Name of the distributed map storing your web session objects --> <init-param> <param-name>map-name</param-name> <param-value>my-sessions</param-value> </init-param> <init-param> <param-name>sticky-session</param-name> <param-value>false</param-value> </init-param> </filter> <filter-mapping> <filter-name>hazelcast-filter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>REQUEST</dispatcher> </filter-mapping> <listener> <listener-class>com.hazelcast.web.SessionListener</listener-class> </listener> </web-app>
  • 93. Enterprise - Karaf 2014-­‐10-­‐23 59 Servlet 3 EJB 3.1 CDI JSF 2 JSP JPA 2 JTA JAX-WS JAX-RPC JAX-RS JAXR SAAJ JAXB JMS JNDI JAAS RMI
  • 94. JEE with Karaf? • Adoptions needed? YES • Minor on Persistence - JNDI lookup • Minor on transaction - Blueprint JTA • Wiring of Services: • Use Blueprint • Use Servlet 3.0 with CDI - @OsgiService • Session Replication throughout cluster, it’s still standard Hazelcast 2014-­‐10-­‐23 60
  • 95. Resources • @anierbeck • notitzblog.nierbeck.de • https://github.com/ANierbeck/karaf-enterprise-sample • www.codecentric.de • karaf.apache.org • https://ops4j1.jira.com/wiki/display/paxweb/Pax+Web • #karaf at irc.codehaus.org • https://www.packtpub.com/application-development/apache-karaf-cookbook • Pictures, mainly from flickr 2014-­‐10-­‐23 61
  • 98. Thanks to the Apache Community
  • 100. Thanks