Enterprise Development

Similar documents
OSGi in WebSphere : The Story so far

Hands-on Development of Web Applications with Java EE 6

J2EE - Version: 25. Developing Enterprise Applications with J2EE Enterprise Technologies

Java EE 6 & GlassFish v3 Paving the path for future. Arun Gupta Sun Microsystems, Inc.

Oracle Corporation

Java EE 6 - Update Harpreet Singh GlassFish Portfolio Product Manager

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature

Apache TomEE Tomcat with a kick

<Insert Picture Here> Productive JavaEE 5.0 Development

Deccansoft Software Services. J2EE Syllabus

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Modular Java Applications with Spring, dm Server and OSGi

IBM WebSphere Application Server v6

Java EE 7 is ready What to do next? Peter Doschkinow Senior Java Architect

Learning Karaf Cellar

The Next Generation. Prabhat Jha Principal Engineer

JBoss Enterprise Application Platform 6.3

Apache Karaf in the enterprise. JB

MicroProfile - New and Noteworthy

1 Markus Eisele, Insurance - Strategic IT-Architecture

Problems in Scaling an Application Client

Oracle Fusion Middleware

J2EE Interview Questions

JBoss Enterprise Application Platform 6

Java Training Center, Noida - Java Expert Program

WebSphere Application Server Support for OSGi Applications

Contents at a Glance

Session 9. Introduction to Servlets. Lecture Objectives

IBM WebSphere Application Server 8. Java EE 6 Feature Packs

Java Platform, Enterprise Edition 6 with Extensible GlassFish Application Server v3

EJB ENTERPRISE JAVA BEANS INTRODUCTION TO ENTERPRISE JAVA BEANS, JAVA'S SERVER SIDE COMPONENT TECHNOLOGY. EJB Enterprise Java

Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets

Migrating traditional Java EE applications to mobile

What's New in J2EE 1.4

Designing a Distributed System

Is OSGi Ready for the Enterprise?

Introduction to componentbased software development

Patterns and Best Practices for dynamic OSGi Applications

JBoss Enterprise Application Platform 6.1

OSGi Application Development using GlassFish Server. Version 1.0

JavaEE.Next(): Java EE 7, 8, and Beyond

Using OSGi in Modular WebSphere Applications

JBoss Enterprise Application Platform 6.2

Vision of J2EE. Why J2EE? Need for. J2EE Suite. J2EE Based Distributed Application Architecture Overview. Umair Javed 1

QUALITY SUPPORT FROM THE SOURCE.

Outline. Project Goal. Overview of J2EE. J2EE Architecture. J2EE Container. San H. Aung 26 September, 2003

Fast Track to Java EE 5 with Servlets, JSP & JDBC

Java EE. OSS <OSS X Users Meeting> #21 Java EE. Akihiro Nishikawa Oracle Corporation Japan. December 12, 2017

Java EE 7: Back-End Server Application Development

CO Java EE 7: Back-End Server Application Development

index_ qxd 7/18/02 11:48 AM Page 259 Index

OSGi on the Server. Martin Lippert (it-agile GmbH)

INTRODUCTION TO COMPONENT DESIGN IN JAVA EE COMPONENT VS. OBJECT, JAVA EE JAVA EE DEMO. Tomas Cerny, Software Engineering, FEE, CTU in Prague,

Development of Advanced Applications with IBM WebSphere Application Server Liberty Profile IBM Redbooks Solution Guide

16562: Liberté, Égalité, Fraternité a Mini CICS and WebSphere Revolution

Java EE 5 Development for WebSphere Application Server V7

Spring Dynamic Modules

<Insert Picture Here> Java Virtual Developer Day

Enterprise Java Development using JPA, Hibernate and Spring. Srini Penchikala Detroit JUG Developer Day Conference November 14, 2009

<Insert Picture Here> Exploring Java EE 6 The Programming Model Explained

Java EE 6 Community Roundtable. Reza Rahman Independent Consultant Author, EJB 3 in Action

Essentials for Java on z Systems

Java J Course Outline

7. Component Models. Distributed Systems Prof. Dr. Alexander Schill

Java EE 6 & Spring: A Lover s Quarrel. Derrick Kittler Mauricio Maltron Leal Vamsi Chemitiganti

OCP JavaEE 6 EJB Developer Study Notes

Java EE 8 What s coming? David Delabassee Oracle May 17, 2017

web.xml Deployment Descriptor Elements

Oracle9iAS Tech nicaloverview

Spring Framework 2.5: New and Notable. Ben Alex, Principal Software Engineer, SpringSource

WebSphere Application Server - Overview

open source community experience distilled

Introduction to Servlets. After which you will doget it

EclipseLink. Solutions Guide for EclipseLink Release 2.6. June Beta Draft

JBoss & Spring. 임형준 충남대학교컴퓨터공학과데이터베이스시스템연구실 2008년 7월 24일목요일

Fast Track to Java EE

Red Hat JBoss Enterprise Application Platform 7.2

Specialized - Mastering JEE 7 Web Application Development

Baking a Java EE 8 Micro Pi Mike Croft Ondrej Mihályi. Payara Support

What you need to know about CICS, Java and Liberty. Mark Cocker Senior Software Engineer, Java Hill Lead, IBM CICS Development

Inside WebSphere Application Server

Introduction. Enterprise Java Instructor: Please introduce yourself Name Experience in Java Enterprise Edition Goals you hope to achieve

7.1. RELEASE-NOTES-2.0-M1.TXT

Using Apache Felix: OSGi best practices. Marcel Offermans luminis

Architecting Java solutions for CICS

Apache Geronimo. Open Source Application Server. NY Java SIG December 15, 2004

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Managing Installations and Provisioning of OSGi Applications. Carsten Ziegeler

From Development to Production with the IBM WebSphere Application Server Liberty Profile IBM Redbooks Solution Guide

Enterprise JavaBeans, Version 3 (EJB3) Programming

ADVANCED JAVA COURSE CURRICULUM

Introducing Apache Geronimo 1.1. Aaron Mulder CTO, Chariot Solutions Committer, Apache Geronimo

WebLogic Feature Timeline

Servlets by Example. Joe Howse 7 June 2011

J2EE Development with Apache Geronimo 1.1. Aaron Mulder CTO, Chariot Solutions Committer, Apache Geronimo

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

Oliver Wulff / Talend. Flexibles Service Enabling mit Apache CXF

Meet. Brian Stansberry Principal Software Engineer, Red Hat, Inc. June 10, Friday, June 14, 13

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Programming Web Services in Java

Transcription:

Enterprise Development with

What needs to be done to run JEE like applications inside Karaf?

@anierbeck - Karaf PMC, Apache Member - OPS4j Pax Web Project Lead - Senior IT Consultant @codecentric - co-author of Apache Karaf Cookbook 3

Agenda Enterprise Requirements OSGi with Karaf Enterprise Requirements on Karaf Specialties Http Service Cellar - or how to cluster Karaf Summary 4

Enterprise Requirements

Enterprise Java Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 6

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 8

What is Karaf Container OSGi Applications Ligthtweight expandable to Full Enterprise support Covers all major needs Logging Deployment Configuration 9

Karaf - Overview JMX Blueprint SSH Config Console Logging Deployer Admin OSGi Framework - Felix / Equinox 10

Enterprise requirements on Karaf

Karaf Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 12

Enterprise - Pax Web Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 13

Enterprise - Pax CDI Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 14

Enterprise - Aries Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 15

Enterprise - Tomee aka OpenEJB Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 16

Enterprise - CXF Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 17

Enterprise - ActiveMQ Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 18

Enterprise - Cellar Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 19

Enterprise - Karaf with features Servlet 3 JSP JAX-WS JAX-RS JASPIC JSR-88 EJB 3.1 CDI JAX-RPC JAXB JACC JSR-77 JSF 2 JTA JAXR JMS JCA RMI JPA 2 Bean Validation SAAJ JAAS JavaMail JNDI 20

Specialties

JPA - Karaf <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> 22

JPA - Karaf <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 To have this blueprint http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" JNDI is needed 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> 22

JTA - Karaf <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> 23

JTA - Karaf <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 To have this blueprint http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> JPA and JTA is needed <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> 23

Client - Karaf <?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> 24

Demo

Persistence 26

Client 27

Client Shell 28

Client - Shell 29

Client Shell 30

Client - Shell 31

Http Service with

HTTP Service 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); 33

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.getservicereference(cookbookservice.class); cookbookservice = bundlecontext.getservice(servicereference); // create new Servlet ViewBookServlet cookbookviewservlet = new ViewBookServlet(); cookbookviewservlet.setcookbookservice(cookbookservice); } registerserviced = bundlecontext.registerservice(servlet.class, cookbookviewservlet, null); 34

Whiteboard 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> 35

Servlet 3.0 - Just annotation @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 {... } 36

LOST?

Registering - Servlet Pax-Web HTTP Service Service- Registry Servlet 38

Registering - Servlet Registerd Pax-Web HTTP Service Service- Registry Servlet 38

Registering - Servlet Registerd Pax-Web HTTP Service Service- Registry Registerd Servlet 38

Registering - Whiteboard Pax-Web WebContainer Service-Tracker Service- Registry Servlet 39

Registering - Whiteboard Registerd Pax-Web WebContainer Service-Tracker Service- Registry Servlet 39

Registering - Whiteboard Registerd Pax-Web WebContainer Service-Tracker Service- Registry Registerd Servlet 39

Registering - Whiteboard Registerd Pax-Web WebContainer Service-Tracker Service- Registry Registerd Servlet 39

Registering - WAR Pax-Web WebContainer Service- Registry Pax-Web WAR Extender WAB-Bundle Servlet 40

Registering - WAR Pax-Web WebContainer Registerd Service- Registry Pax-Web WAR Extender WAB-Bundle Servlet 40

Registering - WAR Pax-Web WebContainer Registerd Service- Registry Registerd Pax-Web WAR Extender WAB-Bundle Servlet 40

Registering - WAR Pax-Web WebContainer Registerd Service- Registry Registerd Pax-Web WAR Extender WAB-Bundle Servlet 40

Servlet + JPA / Service Blueprint Extender JPA-Bundle JPA - Service Service- Registry Pax-Web WAR Extender WEB-Bundle Servlet 41

Servlet + JPA / Service Blueprint Extender Registerd Service- Registry Pax-Web WAR Extender JPA-Bundle WEB-Bundle JPA - Service Servlet 41

Servlet + JPA / Service Blueprint Extender Registerd Service- Registry Pax-Web WAR Extender JPA-Bundle WEB-Bundle JPA - Service Servlet Injected 41

Servlet + JPA / Service Blueprint Extender Registerd Service- Registry Registerd Pax-Web WAR Extender JPA-Bundle WEB-Bundle JPA - Service Servlet Injected 41

Demo

View 43

View 44

Cluster provided by Apache Karaf Cellar

Cellar - Cluster Communication 46

Cellar - Cluster Communication Hazelcast 47

Cellar - Events 48

Cellar - Distributing Bundles Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles osgi:install mvn:groupid/artifactid/version Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A Maven Repository Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A Maven Repository DEPRECATED Node B Hazelcast Node C 49

Cellar - Distributing Bundles Node A cluster:install mvn:groupid/artifactid/version Maven Repository DEPRECATED Node B Hazelcast Node C 49

Cellar - RMI Group 1 Group 2 Node A Consumes OSGi-Service Node A Provides OSGi-Service Node B Consumes OSGi-Service Hazelcast Node B Provides OSGi-Service Node C Consumes OSGi-Service 50

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cellar - Web session failover Node A Filter Servlet Client Hazelcast Node B DataBase Filter Servlet 51

Cluster - Demo

Presentation Layer 53

web.xml - Hazelcast 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> 54

View 55

View 56

View 57

SUMMARY

Enterprise - Karaf Servlet 3 JSP JAX-WS JAX-RS EJB 3.1 CDI JAX-RPC JAXB JSF 2 JTA JAXR JMS JPA 2 JNDI SAAJ JAAS RMI 59

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 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 61

THANKS FOR LISTENING

Thanks to the Apache Community

Questions

Thanks