SlideShare a Scribd company logo
Apache TomEE Tomcat with a kick About  Apache TomEE David Blevins  Jonathan Gallimore dblevins@apache.org  [email_address] @dblevins  @jongallimore * Original Slides modified a little to make the document self-contained
In this presentation we will introduce and demonstrate Apache TomEE… And show how you can leverage all the additional features available in the JavaEE 6 platform, without having to move away from Tomcat. Intro Welcome to Apache TomEE  –  Tomcat with a kick.
The slides are from Jonathan Gallimore and David Belvins’ presentation @JAX London, Spring 2011. You can watch the video  here Meta
So, what is Apache TomEE? In short, its a stack that's assembled and maintained by the Apache OpenEJB project. TomEE aims to provide a fully certified Java EE 6 Web profile stack based on Tomcat, allowing you to use Java EE features in your lightweight Tomcat applications. Talk
Apache TomEE: Overview Java EE 6 Web Profile certification in progress Apache TomEE Includes support for: Servlet 3.0 (Apache Tomcat) JPA 2.0 (Apache OpenJPA) JSF 2.0 (Apache MyFaces) CDI 1.0 (Apache OpenWebBeans) EJB 3.1 (Apache OpenEJB) JMS (Apache ActiveMQ) Webservices (Apache CXF)
Although TomEE is assembled by the OpenEJB team, its based on a number of different Apache projects shown on the previous slide.  You may be familiar with or using some of these projects already. Even if you're not using EJBs in your projects, Apache TomEE still provides a range of functionality you may find useful. Side-note
Apache TomEE: Philosophy Preserve Tomcat  Leverage Tomcat JNDI, Security, everything Get more, don't give up anything Add the extras without removing anything Lightweight Just 38MB zip Runs with no extra memory requirements No need to learn new server environment Existing IDE tools for Tomcat should also work with TomEE
Obviously there are a number of different Java EE servers available today, and a number of open source offerings.  How is TomEE different from other implementations? Well, we take a different approach to building the server – many implementations will use Tomcat to provide a servlet features, and will strip it down and embed it in their own server. TomEE does the opposite – OpenEJB and all the other components are  embedded into Tomcat , and  nothing is taken away. Talk ..Contd in next slide Question
This offers a number of advantages: Firstly, TomEE is able to leverage all the functionality that Tomcat provides, such as JNDI and security. Secondly, TomEE is still lightweight – the zip is around 37MB, and does not have any additional memory requirements over Tomcat to run. Finally, the environment will be completely familiar to existing Tomcat users, meaning that your existing tooling should still work. For example, there isn't a TomEE Eclipse plugin or Netbeans plugin – the existing out-of-the-box plugins for Tomcat 7 also work with TomEE. Talk So what do we get ?
Apache TomEE: History Predates Java EE 6 Web Profile Integration approach inspired by OpenEJB's  embeddable nature Previously known as OpenEJB-Tomcat  integration Also available as a drop-in-war for Tomcat 5.5 -  7.0 Origin of EE 6 " EJBs in .wars " feature
Although we're introducing Apache TomEE as a new bundle, it has actually been around for a while, first making an appearance in 2006, and was inspired by OpenEJB's embeddable nature. Previously it has been known as the “OpenEJB-Tomcat integration”, and was (and still is) available as a drop-in .war file for any version of Tomcat back to 5.5. In addition to the  drop-in .war , TomEE is now available as a  pre-built bundle  which requires no installation or configuration. Also worth mentioning, Apache TomEE is actually the origin of the “ EJBs in war files ” that is new in the JavaEE 6 specification. David, our PMC chair, participates in the JCP that provides the EJB specification and has done since EJB 2.1. Talk
Apache TomEE: Getting started Very simple installation: Obtain bundle  and unzip OR Deploy  openejb.war  into an existing Tomcat installation  and run through a simple wizard Sample application included in bundle Additional lib folder in $CATALINA_BASE/webapps/openejb/lib Dashboard available at http://localhost:8080/openejb
-  bin  – untouched, shell scripts have the usual options -  conf  – server.xml is the same, one extra listener. Can configure ports, hosts, engines, threadpools etc in here. Extra file  openejb.xml   – this is where most TomEE configuration happens – this is where global resources are defined. Tomcat-users.xml – we use Tomcat security. -  logs  – untouched – extra file openejb.log ends up in here, useful for troubleshooting (rarely, we hope!) -  webapps  – works the same way as it does for Tomcat. Drop your directories/wars in here! Also supports EAR files too. … contd in next slide A peek Apache TomEE: Folder Structure
Set of Tomcat apps, plus two extras: Ejb-examples  – sample application from OpenEJB repository. Simple example showing a few JavaEE features – not very functional, but useful for testing. OpenEJB  – where the magic happens. Note extra lib directory, some jars can be swapped out. Provides a dashboard to test the setup and examine the JNDI tree. A peek Apache TomEE: Folder Structure
Apache TomEE: Moviefun example Movie fun sample – available from OpenEJB SVN repository:  http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/webapps/moviefun/ Or at github https://github.com/apache/openejb/tree/trunk/openejb3/examples/webapps/moviefun Simple example demonstrating: Servlet  @EJB injection Bean lookup  from a JSP Dependency injection with  JSF ManagedBean Persistence  with JPA 2 Notifications  via JMS Webservice  support Stateless EJB with no-interface view Samples
One thing that might have struck you during the demo, is that we unzipped TomEE, deployed and used a database-based web application, all without doing any configuration at all – not even specifying a database to use. TomEE will use  some default resources specified in conf/openejb.xml , including HSQLDB as a default datasource, which is why we didn't need to configure a database for the moviefun example. This is great for development, but  you might want to use a different database in production , for example, MySQL. To do this we just need to add the MySQL  connector jar to the Tomcat/lib folder, and add a datasource resource for the persistence context. Side-note
The openejb.xml file is very easy to  configure . Its an XML/properties format. The xml tags match the annotations you'd use for dependency inject (for example @Resource) and type matches the simple name of the object type. Side-note
Apache TomEE: Configuration Resources configured in $CATALINA_BASE/conf/openejb.xml Simple XML + properties format Tags match Annotation names «Resource id="moviesDatabase" type="DataSource"» @Resource DataSource moviesDatabase Drop drivers in tomcat.home/lib
ApacheTomEE: Security Uses Tomcat's Security Realm Extra TomEE layer adds support for JAAS JACC WS Security Supports any org.apache.catalina.Realm implementation E.g. add users to $CATALINA_BASE/conf/tomcat-users.xml Alternatively use login.config to provide your own security module
Rather than providing its own security implementation, TomEE makes full use of the security features that are part of Tomcat. Any Catalina realm is supported or you can provide your own security module using the login.config file. Talk ApacheTomEE: Security
For example, to add some simple security to the moviefun application, all we would need to do is: 1. Add some users to the tomcat-users.xml file 2. Add the necessary @DefineRoles and @RolesAllowed annotations on MoviesImpl 3. Add some security config to do HTTP Basic authentication to web.xml Webservice security is also looked after – username/password based security (HTTP basic, or WS-Security) uses the same Tomcat security. Certificate based security is also available. Samples are available to demonstrate this. Talk ApacheTomEE: Security
Apache TomEE: JPA All persistence.xml files found and deployed Connection persistence.xml values filled in automatically jta-data-source non-jta-data-source Servlets, ManagedBeans, Session Beans, etc now use @PersistenceUnit EntityManagerFactory emf; @PersistenceContext EntityManager em; OpenJPA included, easy to remove Hibernate used in many Apache TomEE installs EclipseLink also works
By default, persistence in TomEE is taken care of by Apache OpenJPA. TomEE will deploy any persistence.xml files automatically. As well session EJBs, persistence units can also be injected into servlets and managed beans as well. Other JPA providers can also be used in TomEE, hibernate is particularly popular. Side-note
Apache TomEE: Transactions Connection pooling is Transaction aware Everyone in same transaction, shares same connection Servlets, ManagedBeans, etc. can start transactions @Resource UserTransaction transaction; No need for EJBs to use transactions
TomEE provides transaction support. Even if you aren't using EJBs, simply inject an  UserTransaction @Resource  into your servlets or MangedBeans. What’s cool ? Apache TomEE: Transactions
Apache TomEE: JMS Resources configured  in $CATALINA_BASE/conf/openejb.xml (Connection Factory, Topics, Queues) By default ActiveMQ listens for connections on port 61616 Resources can be injected into Servlets etc via @Resource ConnectionFactory connectionFactory; @Resource Queue queue; @Resource Topic topic; Example functionality in the Moviefun / monitor  example
Apache TomEE: Web Services Use @Webservice on either POJO Session Bean CXF & Web Service plumbing happens automatically Accessible via: http://localhost:8080/Movies?wsdl Web Service Security supported Web Service Clients also work @WebServiceRef CalculatorWs service; Sample webservice client: get-movies.pl and delete-movie.pl
Apache TomEE: EJB Client HTTP can be used for EJB remote communication (http://localhost:8080/openejb/ejb) Great for firewalled systems User/Pass supplied with InitialContext params HTTP or HTTPS … Contd in next slide
EJBs deployed in TomEE can also be accessed remotely using an EJB client. One nice feature of this is that TomEE uses HTTP/HTTPS as the protocol, so your rich applications can connect directly to EJBs without needing other firewall ports to be opened up. As long as you include the openejb-client jar in your client application, nothing else is needed. If you need to secure your EJBs, you can pass a username and password in the InitialContext properties. Sample (client) code below: Talk Apache TomEE: EJB Client
Apache TomEE: Functional Testing T7MP  Maven plugin can use TomEE as a server Run your application embedded in your Maven build Provides an isolated environment Very useful for functional tests, combined with HtmlUnit or Selenium Example integration test in the moviefun project
Finally – if you're into functional testing, I wanted to demonstrate a technique I have used. OpenEJB's embeddable nature makes it great for testing EJBs in a junit test.  You can take this one step further and use Apache TomEE with the Maven T7MP plugin. This allows you to start a TomEE instance (well, Tomcat 7 with the OpenEJB war) for your test run.  Combined with an in-memory database and something like Selenium or HtmlUnit, you can run your application completely embedded within your Maven build, allowing you to run your tests completely in isolation of your development environment. This technique can be useful in providing a consistent environment for tests, and not having to worry about different setups between developer machines. Talk
Thanks! OpenEJB Home Apache TomEE Getting Involved: Users mailing list Dev mailing list Follow us on  Facebook  /  Twitter   Check the next slides for Web Profile Cert status
Web Profile Certification Status We can't say (that’s the law) Work being done on Amazon EC2, using T1.Micro Linux images, lots of them 100 going at once! Each has 613MB memory max Though we still run with default memory options (64MB) It's quick! Will be Cloud certified! Wish we could show you the setup (sorry, also the rules)
I previously mentioned that Apache TomEE is aiming to be a certified web profile implementation. Work on the certification process is underway. Unfortunately we can't say what the status of the work is at the moment, as its subject to a non-disclosure agreement. We do have an interesting setup to run  the TCK tests against TomEE , using lots of instances on the Amazon EC2 cloud. Again, unfortunately, we can't show you the setup, which is a shame, as it allows us to run the necessary tests very quickly, giving us fast feedback. Talk
Thanks !
Ad

More Related Content

What's hot (20)

Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...
Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...
Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...
Vietnam Open Infrastructure User Group
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
Dzmitry Naskou
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
Docker, Inc.
 
Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018
Anton Babenko
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
Yevgeniy Brikman
 
Github in Action
Github in ActionGithub in Action
Github in Action
Morten Christensen
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
Ajeet Singh Raina
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
Dmitry Buzdin
 
OpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdfOpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdf
JuanSalinas593459
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
Rudy De Busscher
 
Intégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec JenkinsIntégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec Jenkins
Kokou Gaglo
 
Keycloak Single Sign-On
Keycloak Single Sign-OnKeycloak Single Sign-On
Keycloak Single Sign-On
Ravi Yasas
 
.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6
Amin Mesbahi
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
Arvind Kumar G.S
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with Jenkins
Edureka!
 
GitOps and ArgoCD
GitOps and ArgoCDGitOps and ArgoCD
GitOps and ArgoCD
Omar Fathy
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Edureka!
 
Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New Features
Haim Michael
 
Docker
DockerDocker
Docker
SangtongPeesing
 
Spring security
Spring securitySpring security
Spring security
Saurabh Sharma
 
Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...
Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...
Room 2 - 4 - Juncheng Anthony Lin - Redhat - A Practical Approach to Traditio...
Vietnam Open Infrastructure User Group
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
Dzmitry Naskou
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
Docker, Inc.
 
Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018
Anton Babenko
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
Yevgeniy Brikman
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
Ajeet Singh Raina
 
OpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdfOpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdf
JuanSalinas593459
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
Rudy De Busscher
 
Intégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec JenkinsIntégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec Jenkins
Kokou Gaglo
 
Keycloak Single Sign-On
Keycloak Single Sign-OnKeycloak Single Sign-On
Keycloak Single Sign-On
Ravi Yasas
 
.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6
Amin Mesbahi
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
Arvind Kumar G.S
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with Jenkins
Edureka!
 
GitOps and ArgoCD
GitOps and ArgoCDGitOps and ArgoCD
GitOps and ArgoCD
Omar Fathy
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Edureka!
 
Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New Features
Haim Michael
 

Viewers also liked (20)

Introduction to Apache Tomcat 7 Presentation
Introduction to Apache Tomcat 7 PresentationIntroduction to Apache Tomcat 7 Presentation
Introduction to Apache Tomcat 7 Presentation
Tomcat Expert
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
Anirban Majumdar
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
Shashwat Shriparv
 
Automated Tomcat Management
Automated Tomcat ManagementAutomated Tomcat Management
Automated Tomcat Management
seges
 
Ansible
AnsibleAnsible
Ansible
Jasim Muhammed
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with Tomcat
Sudha Ch
 
Tomcat
TomcatTomcat
Tomcat
abbadon1989
 
Java ee com apache tom ee e tomee+ tdc - 2014
Java ee com apache tom ee e tomee+   tdc - 2014Java ee com apache tom ee e tomee+   tdc - 2014
Java ee com apache tom ee e tomee+ tdc - 2014
Daniel Cunha
 
Apache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEEApache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEE
Jacek Laskowski
 
Instalación de Apache Tomcat 8
Instalación de Apache Tomcat 8Instalación de Apache Tomcat 8
Instalación de Apache Tomcat 8
pablozacrosuarez
 
Tomcat Clustering
Tomcat ClusteringTomcat Clustering
Tomcat Clustering
gouthamrv
 
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on TomcatApache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Tomitribe
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
Pham Quy (Jack)
 
Tomcat session clustering
Tomcat session clusteringTomcat session clustering
Tomcat session clustering
Kim SeokYoung
 
Web service introduction 2
Web service introduction 2Web service introduction 2
Web service introduction 2
Sagara Gunathunga
 
Tomcat next
Tomcat nextTomcat next
Tomcat next
Jean-Frederic Clere
 
Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
mohamedmoharam
 
APACHE TOMCAT
APACHE TOMCATAPACHE TOMCAT
APACHE TOMCAT
Rachid NID SAID
 
Tomcat Configuration (1)
Tomcat Configuration (1)Tomcat Configuration (1)
Tomcat Configuration (1)
nazeer pasha
 
Tomcat and apache httpd training
Tomcat and apache httpd trainingTomcat and apache httpd training
Tomcat and apache httpd training
Franck SIMON
 
Introduction to Apache Tomcat 7 Presentation
Introduction to Apache Tomcat 7 PresentationIntroduction to Apache Tomcat 7 Presentation
Introduction to Apache Tomcat 7 Presentation
Tomcat Expert
 
Automated Tomcat Management
Automated Tomcat ManagementAutomated Tomcat Management
Automated Tomcat Management
seges
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with Tomcat
Sudha Ch
 
Java ee com apache tom ee e tomee+ tdc - 2014
Java ee com apache tom ee e tomee+   tdc - 2014Java ee com apache tom ee e tomee+   tdc - 2014
Java ee com apache tom ee e tomee+ tdc - 2014
Daniel Cunha
 
Apache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEEApache Tomcat + Java EE = Apache TomEE
Apache Tomcat + Java EE = Apache TomEE
Jacek Laskowski
 
Instalación de Apache Tomcat 8
Instalación de Apache Tomcat 8Instalación de Apache Tomcat 8
Instalación de Apache Tomcat 8
pablozacrosuarez
 
Tomcat Clustering
Tomcat ClusteringTomcat Clustering
Tomcat Clustering
gouthamrv
 
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on TomcatApache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Tomitribe
 
Tomcat session clustering
Tomcat session clusteringTomcat session clustering
Tomcat session clustering
Kim SeokYoung
 
Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
mohamedmoharam
 
Tomcat Configuration (1)
Tomcat Configuration (1)Tomcat Configuration (1)
Tomcat Configuration (1)
nazeer pasha
 
Tomcat and apache httpd training
Tomcat and apache httpd trainingTomcat and apache httpd training
Tomcat and apache httpd training
Franck SIMON
 
Ad

Similar to Apache TomEE - Tomcat with a kick (20)

Pp w tomee
Pp w tomeePp w tomee
Pp w tomee
Felix Gomez del Alamo
 
Mc sl54 051_ (1)
Mc sl54 051_ (1)Mc sl54 051_ (1)
Mc sl54 051_ (1)
AnkitKumar2343
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apache
govindraj8787
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
Rich Helton
 
Tomcat Maven Plugin
Tomcat Maven PluginTomcat Maven Plugin
Tomcat Maven Plugin
Olivier Lamy
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
BG Java EE Course
 
10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code
10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code
10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code
Kathy Brown
 
BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...
BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...
BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...
panagenda
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
Nitin Pai
 
GTLAB Overview
GTLAB OverviewGTLAB Overview
GTLAB Overview
marpierc
 
Information on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHMInformation on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHM
HTS Hosting
 
01 web-apps
01 web-apps01 web-apps
01 web-apps
Aravindharamanan S
 
01 web-apps
01 web-apps01 web-apps
01 web-apps
snopteck
 
Tc Server Glance Over
Tc Server Glance OverTc Server Glance Over
Tc Server Glance Over
Iwein Fuld
 
Web Server/App Server Connectivity
Web Server/App Server ConnectivityWeb Server/App Server Connectivity
Web Server/App Server Connectivity
webhostingguy
 
Java7
Java7Java7
Java7
Dinesh Guntha
 
Hackingtomcat
HackingtomcatHackingtomcat
Hackingtomcat
Aung Khant
 
Hacking Tomcat
Hacking TomcatHacking Tomcat
Hacking Tomcat
guestc27cd9
 
AtoM's Command Line Tasks - An Introduction
AtoM's Command Line Tasks - An IntroductionAtoM's Command Line Tasks - An Introduction
AtoM's Command Line Tasks - An Introduction
Artefactual Systems - AtoM
 
Learning puppet chapter 3
Learning puppet chapter 3Learning puppet chapter 3
Learning puppet chapter 3
Vishal Biyani
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apache
govindraj8787
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
Rich Helton
 
Tomcat Maven Plugin
Tomcat Maven PluginTomcat Maven Plugin
Tomcat Maven Plugin
Olivier Lamy
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
BG Java EE Course
 
10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code
10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code
10 Lines or Less; Interesting Things You Can Do In Java With Minimal Code
Kathy Brown
 
BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...
BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...
BP107: Ten Lines Or Less: Interesting Things You Can Do In Java With Minimal ...
panagenda
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
Nitin Pai
 
GTLAB Overview
GTLAB OverviewGTLAB Overview
GTLAB Overview
marpierc
 
Information on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHMInformation on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHM
HTS Hosting
 
01 web-apps
01 web-apps01 web-apps
01 web-apps
snopteck
 
Tc Server Glance Over
Tc Server Glance OverTc Server Glance Over
Tc Server Glance Over
Iwein Fuld
 
Web Server/App Server Connectivity
Web Server/App Server ConnectivityWeb Server/App Server Connectivity
Web Server/App Server Connectivity
webhostingguy
 
Learning puppet chapter 3
Learning puppet chapter 3Learning puppet chapter 3
Learning puppet chapter 3
Vishal Biyani
 
Ad

Recently uploaded (20)

Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 

Apache TomEE - Tomcat with a kick

  • 1. Apache TomEE Tomcat with a kick About Apache TomEE David Blevins Jonathan Gallimore [email protected] [email_address] @dblevins @jongallimore * Original Slides modified a little to make the document self-contained
  • 2. In this presentation we will introduce and demonstrate Apache TomEE… And show how you can leverage all the additional features available in the JavaEE 6 platform, without having to move away from Tomcat. Intro Welcome to Apache TomEE – Tomcat with a kick.
  • 3. The slides are from Jonathan Gallimore and David Belvins’ presentation @JAX London, Spring 2011. You can watch the video here Meta
  • 4. So, what is Apache TomEE? In short, its a stack that's assembled and maintained by the Apache OpenEJB project. TomEE aims to provide a fully certified Java EE 6 Web profile stack based on Tomcat, allowing you to use Java EE features in your lightweight Tomcat applications. Talk
  • 5. Apache TomEE: Overview Java EE 6 Web Profile certification in progress Apache TomEE Includes support for: Servlet 3.0 (Apache Tomcat) JPA 2.0 (Apache OpenJPA) JSF 2.0 (Apache MyFaces) CDI 1.0 (Apache OpenWebBeans) EJB 3.1 (Apache OpenEJB) JMS (Apache ActiveMQ) Webservices (Apache CXF)
  • 6. Although TomEE is assembled by the OpenEJB team, its based on a number of different Apache projects shown on the previous slide. You may be familiar with or using some of these projects already. Even if you're not using EJBs in your projects, Apache TomEE still provides a range of functionality you may find useful. Side-note
  • 7. Apache TomEE: Philosophy Preserve Tomcat  Leverage Tomcat JNDI, Security, everything Get more, don't give up anything Add the extras without removing anything Lightweight Just 38MB zip Runs with no extra memory requirements No need to learn new server environment Existing IDE tools for Tomcat should also work with TomEE
  • 8. Obviously there are a number of different Java EE servers available today, and a number of open source offerings. How is TomEE different from other implementations? Well, we take a different approach to building the server – many implementations will use Tomcat to provide a servlet features, and will strip it down and embed it in their own server. TomEE does the opposite – OpenEJB and all the other components are embedded into Tomcat , and nothing is taken away. Talk ..Contd in next slide Question
  • 9. This offers a number of advantages: Firstly, TomEE is able to leverage all the functionality that Tomcat provides, such as JNDI and security. Secondly, TomEE is still lightweight – the zip is around 37MB, and does not have any additional memory requirements over Tomcat to run. Finally, the environment will be completely familiar to existing Tomcat users, meaning that your existing tooling should still work. For example, there isn't a TomEE Eclipse plugin or Netbeans plugin – the existing out-of-the-box plugins for Tomcat 7 also work with TomEE. Talk So what do we get ?
  • 10. Apache TomEE: History Predates Java EE 6 Web Profile Integration approach inspired by OpenEJB's embeddable nature Previously known as OpenEJB-Tomcat integration Also available as a drop-in-war for Tomcat 5.5 - 7.0 Origin of EE 6 " EJBs in .wars " feature
  • 11. Although we're introducing Apache TomEE as a new bundle, it has actually been around for a while, first making an appearance in 2006, and was inspired by OpenEJB's embeddable nature. Previously it has been known as the “OpenEJB-Tomcat integration”, and was (and still is) available as a drop-in .war file for any version of Tomcat back to 5.5. In addition to the drop-in .war , TomEE is now available as a pre-built bundle which requires no installation or configuration. Also worth mentioning, Apache TomEE is actually the origin of the “ EJBs in war files ” that is new in the JavaEE 6 specification. David, our PMC chair, participates in the JCP that provides the EJB specification and has done since EJB 2.1. Talk
  • 12. Apache TomEE: Getting started Very simple installation: Obtain bundle and unzip OR Deploy openejb.war into an existing Tomcat installation and run through a simple wizard Sample application included in bundle Additional lib folder in $CATALINA_BASE/webapps/openejb/lib Dashboard available at http://localhost:8080/openejb
  • 13. - bin – untouched, shell scripts have the usual options - conf – server.xml is the same, one extra listener. Can configure ports, hosts, engines, threadpools etc in here. Extra file openejb.xml – this is where most TomEE configuration happens – this is where global resources are defined. Tomcat-users.xml – we use Tomcat security. - logs – untouched – extra file openejb.log ends up in here, useful for troubleshooting (rarely, we hope!) - webapps – works the same way as it does for Tomcat. Drop your directories/wars in here! Also supports EAR files too. … contd in next slide A peek Apache TomEE: Folder Structure
  • 14. Set of Tomcat apps, plus two extras: Ejb-examples – sample application from OpenEJB repository. Simple example showing a few JavaEE features – not very functional, but useful for testing. OpenEJB – where the magic happens. Note extra lib directory, some jars can be swapped out. Provides a dashboard to test the setup and examine the JNDI tree. A peek Apache TomEE: Folder Structure
  • 15. Apache TomEE: Moviefun example Movie fun sample – available from OpenEJB SVN repository:  http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/webapps/moviefun/ Or at github https://github.com/apache/openejb/tree/trunk/openejb3/examples/webapps/moviefun Simple example demonstrating: Servlet @EJB injection Bean lookup from a JSP Dependency injection with JSF ManagedBean Persistence with JPA 2 Notifications via JMS Webservice support Stateless EJB with no-interface view Samples
  • 16. One thing that might have struck you during the demo, is that we unzipped TomEE, deployed and used a database-based web application, all without doing any configuration at all – not even specifying a database to use. TomEE will use some default resources specified in conf/openejb.xml , including HSQLDB as a default datasource, which is why we didn't need to configure a database for the moviefun example. This is great for development, but you might want to use a different database in production , for example, MySQL. To do this we just need to add the MySQL connector jar to the Tomcat/lib folder, and add a datasource resource for the persistence context. Side-note
  • 17. The openejb.xml file is very easy to configure . Its an XML/properties format. The xml tags match the annotations you'd use for dependency inject (for example @Resource) and type matches the simple name of the object type. Side-note
  • 18. Apache TomEE: Configuration Resources configured in $CATALINA_BASE/conf/openejb.xml Simple XML + properties format Tags match Annotation names «Resource id="moviesDatabase" type="DataSource"» @Resource DataSource moviesDatabase Drop drivers in tomcat.home/lib
  • 19. ApacheTomEE: Security Uses Tomcat's Security Realm Extra TomEE layer adds support for JAAS JACC WS Security Supports any org.apache.catalina.Realm implementation E.g. add users to $CATALINA_BASE/conf/tomcat-users.xml Alternatively use login.config to provide your own security module
  • 20. Rather than providing its own security implementation, TomEE makes full use of the security features that are part of Tomcat. Any Catalina realm is supported or you can provide your own security module using the login.config file. Talk ApacheTomEE: Security
  • 21. For example, to add some simple security to the moviefun application, all we would need to do is: 1. Add some users to the tomcat-users.xml file 2. Add the necessary @DefineRoles and @RolesAllowed annotations on MoviesImpl 3. Add some security config to do HTTP Basic authentication to web.xml Webservice security is also looked after – username/password based security (HTTP basic, or WS-Security) uses the same Tomcat security. Certificate based security is also available. Samples are available to demonstrate this. Talk ApacheTomEE: Security
  • 22. Apache TomEE: JPA All persistence.xml files found and deployed Connection persistence.xml values filled in automatically jta-data-source non-jta-data-source Servlets, ManagedBeans, Session Beans, etc now use @PersistenceUnit EntityManagerFactory emf; @PersistenceContext EntityManager em; OpenJPA included, easy to remove Hibernate used in many Apache TomEE installs EclipseLink also works
  • 23. By default, persistence in TomEE is taken care of by Apache OpenJPA. TomEE will deploy any persistence.xml files automatically. As well session EJBs, persistence units can also be injected into servlets and managed beans as well. Other JPA providers can also be used in TomEE, hibernate is particularly popular. Side-note
  • 24. Apache TomEE: Transactions Connection pooling is Transaction aware Everyone in same transaction, shares same connection Servlets, ManagedBeans, etc. can start transactions @Resource UserTransaction transaction; No need for EJBs to use transactions
  • 25. TomEE provides transaction support. Even if you aren't using EJBs, simply inject an UserTransaction @Resource into your servlets or MangedBeans. What’s cool ? Apache TomEE: Transactions
  • 26. Apache TomEE: JMS Resources configured in $CATALINA_BASE/conf/openejb.xml (Connection Factory, Topics, Queues) By default ActiveMQ listens for connections on port 61616 Resources can be injected into Servlets etc via @Resource ConnectionFactory connectionFactory; @Resource Queue queue; @Resource Topic topic; Example functionality in the Moviefun / monitor example
  • 27. Apache TomEE: Web Services Use @Webservice on either POJO Session Bean CXF & Web Service plumbing happens automatically Accessible via: http://localhost:8080/Movies?wsdl Web Service Security supported Web Service Clients also work @WebServiceRef CalculatorWs service; Sample webservice client: get-movies.pl and delete-movie.pl
  • 28. Apache TomEE: EJB Client HTTP can be used for EJB remote communication (http://localhost:8080/openejb/ejb) Great for firewalled systems User/Pass supplied with InitialContext params HTTP or HTTPS … Contd in next slide
  • 29. EJBs deployed in TomEE can also be accessed remotely using an EJB client. One nice feature of this is that TomEE uses HTTP/HTTPS as the protocol, so your rich applications can connect directly to EJBs without needing other firewall ports to be opened up. As long as you include the openejb-client jar in your client application, nothing else is needed. If you need to secure your EJBs, you can pass a username and password in the InitialContext properties. Sample (client) code below: Talk Apache TomEE: EJB Client
  • 30. Apache TomEE: Functional Testing T7MP Maven plugin can use TomEE as a server Run your application embedded in your Maven build Provides an isolated environment Very useful for functional tests, combined with HtmlUnit or Selenium Example integration test in the moviefun project
  • 31. Finally – if you're into functional testing, I wanted to demonstrate a technique I have used. OpenEJB's embeddable nature makes it great for testing EJBs in a junit test. You can take this one step further and use Apache TomEE with the Maven T7MP plugin. This allows you to start a TomEE instance (well, Tomcat 7 with the OpenEJB war) for your test run. Combined with an in-memory database and something like Selenium or HtmlUnit, you can run your application completely embedded within your Maven build, allowing you to run your tests completely in isolation of your development environment. This technique can be useful in providing a consistent environment for tests, and not having to worry about different setups between developer machines. Talk
  • 32. Thanks! OpenEJB Home Apache TomEE Getting Involved: Users mailing list Dev mailing list Follow us on Facebook / Twitter Check the next slides for Web Profile Cert status
  • 33. Web Profile Certification Status We can't say (that’s the law) Work being done on Amazon EC2, using T1.Micro Linux images, lots of them 100 going at once! Each has 613MB memory max Though we still run with default memory options (64MB) It's quick! Will be Cloud certified! Wish we could show you the setup (sorry, also the rules)
  • 34. I previously mentioned that Apache TomEE is aiming to be a certified web profile implementation. Work on the certification process is underway. Unfortunately we can't say what the status of the work is at the moment, as its subject to a non-disclosure agreement. We do have an interesting setup to run the TCK tests against TomEE , using lots of instances on the Amazon EC2 cloud. Again, unfortunately, we can't show you the setup, which is a shame, as it allows us to run the necessary tests very quickly, giving us fast feedback. Talk

Editor's Notes

  • #2: [Quick introduction] http://openejb.apache.org/3.0/apache-tomee.html Welcome to Apache TomEE – Tomcat with a kick. In this presentation we will introduce and demonstrate Apache TomEE, and show how you can leverage all the additional features available in the JavaEE 6 platform, without having to move away from Tomcat. We have got time for questions at the end, but please do feel free to ask any questions as we go along, and we'll do our best to answer them.
  • #6: So, what is Apache TomEE? In short, its a stack that's assembled and maintained by the Apache OpenEJB project. TomEE aims to provide a fully certified Java EE 6 Web profile stack based on Tomcat, allowing you to use Java EE features in your lightweight Tomcat applications. Although TomEE is assembled by the OpenEJB team, its based on a number of different Apache projects shown on the slide. You may be familiar with or using some of these projects already. Even if you're not using EJBs in your projects, Apache TomEE still provides a range of functionality you may find useful.
  • #8: Obviously there are a number of different Java EE servers available today, and a number of open source offerings. How is TomEE different from other implementations? Well, we take a different approach to building the server – many implementations will use Tomcat to provide a servlet features, and will strip it down and embed it in their own server. TomEE does the opposite – OpenEJB and all the other components are embedded into Tomcat, and nothing is taken away. This offers a number of advantages: Firstly, TomEE is able to leverage all the functionality that Tomcat provides, such as JNDI and security. Secondly, TomEE is still lightweight – the zip is around 37MB, and does not have any additional memory requirements over Tomcat to run. Finally, the environment will be completely familiar to existing Tomcat users, meaning that your existing tooling should still work. For example, there isn't a TomEE Eclipse plugin or Netbeans plugin – the existing out-of-the-box plugins for Tomcat 7 also work with TomEE.
  • #11: Although we're introducing Apache TomEE as a new bundle, it has actually been around for a while, first making an appearance in 2006, and was inspired by OpenEJB's embeddable nature. Previously it has been known as the “OpenEJB-Tomcat integration”, and was (and still is) available as a drop-in .war file for any version of Tomcat back to 5.5. In addition to the drop-in .war, TomEE is now available as a pre-built bundle which requires no installation or configuration. Also worth mentioning, Apache TomEE is actually the origin of the “EJBs in war files” that is new in the JavaEE 6 specification. David, our PMC chair, participates in the JCP that provides the EJB specification and has done since EJB 2.1.
  • #13: I'll now demonstrate how easy it is to get started with Apache TomEE, using the pre-built bundle. [Demo] - Unzip - Explain folder structure: - bin – untouched, shell scripts have the usual options - conf – server.xml is the same, one extra listener. Can configure ports, hosts, engines, threadpools etc in here. Extra file openejb.xml – this is where most TomEE configuration happens – this is where global resources are defined. Tomcat-users.xml – we use Tomcat security. - logs – untouched – extra file openejb.log ends up in here, useful for troubleshooting (rarely, we hope!) - webapps – works the same way as it does for Tomcat. Drop your directories/wars in here! Also supports EAR files too. Set of Tomcat apps, plus two extras: Ejb-examples – sample application from OpenEJB repository. Simple example showing a few JavaEE features – not very functional, but useful for testing. OpenEJB – where the magic happens. Note extra lib directory, some jars can be swapped out. Provides a dashboard to test the setup and examine the JNDI tree.
  • #16: Now that we have a TomEE server up and running, I'll show you one of the example applications from OpenEJB, and deploy that to TomEE. The example I'm going to show you is the Moviefun example, and this is available from the subversion repository here. The application itself is very simple – a database of movies, catalogued by title, director, genre and year, and each one having a rating out of ten. It demonstrates a number of Java EE features, such as SL EJB session bean with a no-interface view, persistence with JPA, dependency injection, webservices and JMS. [Code] - Show Movie POJO - SLSB - Annotated servlet - JSF controller [Demo] - Stop existing server - Create WTP server - Configure to use openejb war too - Deploy and start server in debug mode - Show interface, setup db, browse web app. - Show breakpoint
  • #19: One thing that might have struck you during the demo, is that we unzipped TomEE, deployed and used a database-based web application, all without doing any configuration at all – not even specifying a database to use. TomEE will use some default resources specified in conf/openejb.xml, including HSQLDB as a default datasource, which is why we didn't need to configure a database for the moviefun example. This is great for development, but you might want to use a different database in production, for example, MySQL. To do this we just need to add the MySQL connector jar to the Tomcat/lib folder, and add a datasource resource for the persistence context. The file is very easy to edit, its an XML/properties format. The xml tags match the annotations you'd use for dependency inject (for example @Resource) and type matches the simple name of the object type. [Example] Show database configuration in text editor
  • #20: Rather than providing its own security implementation, TomEE makes full use of the security features that are part of Tomcat. Any Catalina realm is supported or you can provide your own security module using the login.config file. For example, to add some simple security to the moviefun application, all we would need to do is: 1. Add some users to the tomcat-users.xml file 2. Add the necessary @DefineRoles and @RolesAllowed annotations on MoviesImpl 3. Add some security config to do HTTP Basic authentication to web.xml Webservice security is also looked after – username/password based security (HTTP basic, or WS-Security) uses the same Tomcat security. Certificate based security is also available. Samples are available to demonstrate this.
  • #23: By default, persistence in TomEE is taken care of by Apache OpenJPA. TomEE will deploy any persistence.xml files automatically. As well session EJBs, persistence units can also be injected into servlets and managed beans as well. Other JPA providers can also be used in TomEE, hibernate is particularly popular.
  • #25: TomEE provides transaction support. Even if you aren't using EJBs, simply inject an UserTransaction @Resource into your servlets or MangedBeans.
  • #27: JMS support is provided by Apache ActiveMQ. Topics and queues can be configured in conf/openejb.xml. These resources will be injected into EJBs / Servlets etc, if you use the @Resource annotation. [Show EJB from moviefun again] JMS topics and queues can be accessed externally by connecting to port 61616. The moviefun example includes a notification application which subscribes to a JMS topic which is notified when a movie is deleted from the database. [Run the notifier] [Delete my least favourite movie ever, Zoolander, from the application. Notice the popup].
  • #28: [2 minutes] Webservice support is provided using Apache CXF. Both POJO and EJB webservices are supported, and is simply a matter of adding the @WebService annotation. [Show EJB again, highlight annotation] The moviefun example includes 2 Perl scripts that connect to the application via the webservice. [Show code and demonstrate] Webservice security is supported, either by requiring HTTP authentication, or WS-Security headers. There are a number of webservice examples available in the OpenEJB svn repository.
  • #29: EJBs deployed in TomEE can also be accessed remotely using an EJB client. One nice feature of this is that TomEE uses HTTP/HTTPS as the protocol, so your rich applications can connect directly to EJBs without needing other firewall ports to be opened up. There's some sample code to do this on the slide. As long as you include the openejb-client jar in your client application, nothing else is needed. If you need to secure your EJBs, you can pass a username and password in the InitialContext properties.
  • #31: Finally – if you're into functional testing, I wanted to demonstrate a technique I have used. OpenEJB's embeddable nature makes it great for testing EJBs in a junit test. You can take this one step further and use Apache TomEE with the Maven T7MP plugin. This allows you to start a TomEE instance (well, Tomcat 7 with the OpenEJB war) for your test run. Combined with an in-memory database and something like Selenium or HtmlUnit, you can run your application completely embedded within your Maven build, allowing you to run your tests completely in isolation of your development environment. This technique can be useful in providing a consistent environment for tests, and not having to worry about different setups between developer machines. [Show POM] [Show integration test]
  • #33: That's the end of the presentation, thanks for joining us, and we hope you have found it useful. We'll try and answer any questions now. Please feel to join us on the mailing lists if you have questions later on, or if you want to participate!
  • #34: I previously mentioned that Apache TomEE is aiming to be a certified web profile implementation. Work on the certification process is underway. Unfortunately we can't say what the status of the work is at the moment, as its subject to a non-disclosure agreement. We do have an interesting setup to run the TCK tests against TomEE, using lots of instances on the Amazon EC2 cloud. Again, unfortunately, we can't show you the setup, which is a shame, as it allows us to run the necessary tests very quickly, giving us fast feedback.