SlideShare ist ein Scribd-Unternehmen logo
1 von 69
Downloaden Sie, um offline zu lesen
David Blevins | Apache

Tomcat to JavaEE with
   Apache TomEE
@dblevins
dblevins@apache.org

@ApachTomEE / #TomEE
http://tomee.apache.org
What is Apache TomEE?
Tomcat + JavaEE = TomEE
• Java EE 6 Web Profile certified
• Tomcat through and through
• All Apache components
  –   OpenJPA
  –   OpenWebBeans
  –   OpenEJB
  –   MyFaces
• Core Values
  – Be small
  – Be certified
  – Be Tomcat
Flavors of TomEE
• Apache TomEE Web Profile (Java EE 6 Certified)
  –   CDI
  –   EJB
  –   JPA
  –   JSF
  –   Bean Validation
• Apache TomEE Plus
  – JAX-RS
  – JAX-WS
  – JMS
• Embedded Apache TomEE
Basic Stats
• Size
  – 27mb
• Memory usage
  – very little required
  – passes TCK with default 64mb
• Agility:
  – Eclipse deploy ~700ms
  – embedded test 2-4 seconds
Certification
• Certified on Amazon EC2
   –   t1.micro linux images,
   –   100 spot instances
   –   613mb memory
   –   64mb used, 549mb free
   –   t1.micros have slow disks, memory is critical
• Current certified OSs
   – Amazon Linux AMI 2011.09, EBS boot, EC2 t1.micro
   – Amazon Linux AMI 2011.09, EBS boot, EC2 m1.small
   – Amazon Linux AMI 2011.09, EBS boot, EC2 c1.medium
• Runs daily
• Got a Cloud?
   – Donate time!
“There is also one point to note. TomEE is insanely fast! ”
    -- Łukasz Budnik, CXF JAX-RS on Apache TomEE @ DZone, May 23rd 2012



“From an architect that switched from <XXX> to Tomee. I can
tell you Tomee kicks <XXX>'s ass in every way. Memory,
speed, reliability, validation, you name it.”
                                    -- Zeeman, User List, July 3rd 2012


“If you are concerned about performance and footprint, but
can accept that you'll have to solve problems yourself, go
TomEE. (TomEE seems to be _much_ faster than <XXX>)”
                             -- Jonathan Fisher, User List, July 3rd 2012
Gaps in Tomcat
Gaps in Tomcat
• No Transaction support
• No Connection Pooling support
  – Pooling should be transactional
• No Integrated Security
• No support for Global JNDI
  – java:module
  – java:app
  – java:global
• No support for @DataSourceDefinition
• No support for new <env-entry> types:
  – java.lang.Class
  – Enums
Gaps in Tomcat
• No @Resource
    –   UserTransaction
    –   BeanManager
    –   Validator
    –   ValidatorFactory
    –   Topic/Queue
    –   ConnectionFactory
•   No @PersistenceUnit
•   No @PersistenceContext
•   No @Inject
•   No @EJB
•   No @WebServiceRef
Migration Issues
Building your own app server
• Including API jars in the webapp
  – JPA API
  – JSF API
  – etc.
• Including implementations in webapp
  – Mojarra (works in trunk)
  – Bitronix/Atomikos
• Non-compliant DataSource and JPA
  – too many years of Do It Yourself
  – providers not enforcing rules
(Mis)Information
• Gaps in Knowledge
  – “that other stuff”
• Misinformation
  – don’t use X, it’s heavy
• Leads to...
  – let’s build own own heavy X!
• Bites you
  – non-portable apps
  – lacks tens of thousands of tests
  – lacks shared experience
Closing Gaps in Knowledge
You can’t use this




• unless you understand
  – JTA Transactions
  – Container-managed EntityManagers
  – Container-managed DataSources
  – How to get references to these, properly!
Not Just EJBs
• Components with Transaction support
  – Servlets
  – JSP
  – JSF Managed Beans
  – CDI
  – EJB
  – JAX-RS REST Services
  – JAX-WS Web Services
What are Transactions?
“Undo”
Controlling Transactions
• javax.transaction.UserTransaction
  – Manual approach
  – Any JavaEE component
• @javax.ejb.TransactionAttribute
  – Class or method annotation
  – EJB only
• @javax.transaction.Transactional
  – Class or method annotation
  – Any JavaEE component*
  – Coming in JavaEE 7
Transaction Hooks
• SessionSynchronization
  – @AfterBegin
  – @BeforeCompletion
  – @AfterCompletion
• Events
  – @Observes(during=IN_PROGRESS)
  – @Observes(during=BEFORE_COMPLETION)
  – @Observes(during=AFTER_COMPLETION)
     • @Observes(during=AFTER_SUCCESS)
     • @Observes(during=AFTER_FAILURE)
“Undo” aware Resources
•   DataSource
•   EntityManager
•   Sending JMS Messages
•   Receiving JMS Messages
•   Timers & @Schedule
•   (more via Java EE connectors)
    [Some restrictions apply. Offer void where prohibited. Container-
    provided resources required. Must be 18 years or older to apply]
More specifically
How does it work?
TOP SECRET
(authorized personnel only)
This is not a pipe
Not the real thing
The EntityManager You Get
continued...
The DataSource You Get
better than a pipe
...better than the real thing




• thread-safe
• undo-aware
• leak-free
All boils down to...
“hashmap”




“listeners”
...but
Won’t work with any of this
• DataSource
  – DriverManager.getConnection(...)
  – new FooDataSource()
  – autocommit = true
• EntityManager
  – PersistenceProvider.createEntityManag...
  – EntityManagerFactory.createEntityManager
  – EntityTransaction
Avoid Do It Yourself
Rule
• If you didn’t get it from the Container
  – it isn’t usable with UserTransaction
  – connections may leak
  – memory may leak
• Even then there are some BIG notes
  – EntityManagerFactory
     • not usable with UserTransaction
  – <persistence-unit=RESOURCE_LOCAL>
     • not usable with UserTransaction
Common Migration Issues
     & Mistakes
Wrong
Wrong
Wrong
Still Wrong
The worst of them all
this...
or this...
with THIS!
darn defaults!
There we go
JPA Rules
• RESOURCE_LOCAL
  – Persistence.createEntityManagerFactory
  – @PersistenceUnit EntityManagerFactory
  – <non-jta-data-source>
• JTA
  – @PersistenceContext EntityManager
  – <jta-data-source>
  – <non-jta-data-source>
• No other combinations are valid
Good
• Valid RESOURCE_LOCAL usage
Better
• Valid RESOURCE_LOCAL usage
Best
• Valid JTA usage
DataSource
• Declare
  – in tomee.xml
  – in META-INF/resources.xml
  – via @DataSourceDefinition
• Retrieve
  – @Resource
  – <resource-ref>
• Undo-aware and pooled
Declaring
• <tomee-home>/conf/tomee.xml




• WEB-INF/resources.xml
Recap
Recap
• Use if you need “undo”
• Transactions not heavy
   – Thread safe management
   – Help prevent Leaks
   – Enhance programming
• More than a TransactionManager
   – TransactionManagers do nothing alone
   – Resources must cooperate
• Don’t Do It Yourself
   – Use container-provided resources
   – no need to re-invent the wheel
Recap
• Components with Transaction support
  – Servlets
  – JSP
  – JSF Managed Beans
  – CDI
  – EJB
  – JAX-RS REST Services
  – JAX-WS Web Services
Recap
• Transactional Resources
  – DataSource
  – EntityManager
  – Sending JMS Messages
  – Receiving JMS Messages
  – Timers & @Schedule
  – (more via Java EE connectors)
Questions?
Thank You!

        @dblevins
http://tomee.apache.org

Weitere ähnliche Inhalte

Was ist angesagt?

Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript PerformanceFITC
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyKyle Drake
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight WebsitesFITC
 
HH.JS - State of the Automation
HH.JS - State of the AutomationHH.JS - State of the Automation
HH.JS - State of the AutomationAdam Christian
 
Full-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with AnsibleFull-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with AnsibleSteve McMahon
 
Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)Steve McMahon
 
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableCollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableDarren Duke
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsNaresh Chintalcheru
 
Enterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSEnterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSBruce Snyder
 
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBruce Snyder
 
What python can learn from java
What python can learn from javaWhat python can learn from java
What python can learn from javajbellis
 
XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)Per Henrik Lausten
 
Engage 2014 OpenNTF Domino API Slides
Engage 2014 OpenNTF Domino API SlidesEngage 2014 OpenNTF Domino API Slides
Engage 2014 OpenNTF Domino API SlidesPaul Withers
 
BP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
BP204 It's Not Infernal: Dante's Nine Circles of XPages HeavenBP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
BP204 It's Not Infernal: Dante's Nine Circles of XPages HeavenMichael McGarel
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with javaJeongHun Byeon
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIPaul Withers
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Opevel
 

Was ist angesagt? (20)

Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
 
Eureka moment
Eureka momentEureka moment
Eureka moment
 
HH.JS - State of the Automation
HH.JS - State of the AutomationHH.JS - State of the Automation
HH.JS - State of the Automation
 
Full-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with AnsibleFull-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with Ansible
 
Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)
 
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableCollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
 
Enterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSEnterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMS
 
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
 
What python can learn from java
What python can learn from javaWhat python can learn from java
What python can learn from java
 
ColdFusion builder plugins
ColdFusion builder pluginsColdFusion builder plugins
ColdFusion builder plugins
 
XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)
 
10 common cf server challenges
10 common cf server challenges10 common cf server challenges
10 common cf server challenges
 
Engage 2014 OpenNTF Domino API Slides
Engage 2014 OpenNTF Domino API SlidesEngage 2014 OpenNTF Domino API Slides
Engage 2014 OpenNTF Domino API Slides
 
BP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
BP204 It's Not Infernal: Dante's Nine Circles of XPages HeavenBP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
BP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with java
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino API
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011
 

Ähnlich wie From Tomcat to Java EE, making the transition with TomEE

Day 7 - Make it Fast
Day 7 - Make it FastDay 7 - Make it Fast
Day 7 - Make it FastBarry Jones
 
Hard Coding as a design approach
Hard Coding as a design approachHard Coding as a design approach
Hard Coding as a design approachOren Eini
 
Google Developer Days Brazil 2009 - Java Appengine
Google Developer Days Brazil 2009 -  Java AppengineGoogle Developer Days Brazil 2009 -  Java Appengine
Google Developer Days Brazil 2009 - Java AppenginePatrick Chanezon
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13Dave Gardner
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systemselliando dias
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitterRoger Xia
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...smallerror
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...xlight
 
Data Pipelines with Python - NWA TechFest 2017
Data Pipelines with Python - NWA TechFest 2017Data Pipelines with Python - NWA TechFest 2017
Data Pipelines with Python - NWA TechFest 2017Casey Kinsey
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage SystemsSATOSHI TAGOMORI
 
Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)Govind Kanshi
 
Mtc learnings from isv & enterprise interaction
Mtc learnings from isv & enterprise  interactionMtc learnings from isv & enterprise  interaction
Mtc learnings from isv & enterprise interactionGovind Kanshi
 
Microservices for java architects it-symposium-2015-09-15
Microservices for java architects it-symposium-2015-09-15Microservices for java architects it-symposium-2015-09-15
Microservices for java architects it-symposium-2015-09-15Derek Ashmore
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?DATAVERSITY
 
Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1Tuenti
 
R2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database ConnectivityR2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database ConnectivityMaarten Smeets
 

Ähnlich wie From Tomcat to Java EE, making the transition with TomEE (20)

Day 7 - Make it Fast
Day 7 - Make it FastDay 7 - Make it Fast
Day 7 - Make it Fast
 
Hard Coding as a design approach
Hard Coding as a design approachHard Coding as a design approach
Hard Coding as a design approach
 
Google Developer Days Brazil 2009 - Java Appengine
Google Developer Days Brazil 2009 -  Java AppengineGoogle Developer Days Brazil 2009 -  Java Appengine
Google Developer Days Brazil 2009 - Java Appengine
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13
 
Java persistence api 2.1
Java persistence api 2.1Java persistence api 2.1
Java persistence api 2.1
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systems
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 
Fixing_Twitter
Fixing_TwitterFixing_Twitter
Fixing_Twitter
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Data Pipelines with Python - NWA TechFest 2017
Data Pipelines with Python - NWA TechFest 2017Data Pipelines with Python - NWA TechFest 2017
Data Pipelines with Python - NWA TechFest 2017
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)
 
Mtc learnings from isv & enterprise interaction
Mtc learnings from isv & enterprise  interactionMtc learnings from isv & enterprise  interaction
Mtc learnings from isv & enterprise interaction
 
Microservices for java architects it-symposium-2015-09-15
Microservices for java architects it-symposium-2015-09-15Microservices for java architects it-symposium-2015-09-15
Microservices for java architects it-symposium-2015-09-15
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
 
Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1
 
R2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database ConnectivityR2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database Connectivity
 

Kürzlich hochgeladen

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 

Kürzlich hochgeladen (20)

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 

From Tomcat to Java EE, making the transition with TomEE

  • 1. David Blevins | Apache Tomcat to JavaEE with Apache TomEE
  • 3. What is Apache TomEE?
  • 4. Tomcat + JavaEE = TomEE • Java EE 6 Web Profile certified • Tomcat through and through • All Apache components – OpenJPA – OpenWebBeans – OpenEJB – MyFaces • Core Values – Be small – Be certified – Be Tomcat
  • 5. Flavors of TomEE • Apache TomEE Web Profile (Java EE 6 Certified) – CDI – EJB – JPA – JSF – Bean Validation • Apache TomEE Plus – JAX-RS – JAX-WS – JMS • Embedded Apache TomEE
  • 6. Basic Stats • Size – 27mb • Memory usage – very little required – passes TCK with default 64mb • Agility: – Eclipse deploy ~700ms – embedded test 2-4 seconds
  • 7. Certification • Certified on Amazon EC2 – t1.micro linux images, – 100 spot instances – 613mb memory – 64mb used, 549mb free – t1.micros have slow disks, memory is critical • Current certified OSs – Amazon Linux AMI 2011.09, EBS boot, EC2 t1.micro – Amazon Linux AMI 2011.09, EBS boot, EC2 m1.small – Amazon Linux AMI 2011.09, EBS boot, EC2 c1.medium • Runs daily • Got a Cloud? – Donate time!
  • 8. “There is also one point to note. TomEE is insanely fast! ” -- Łukasz Budnik, CXF JAX-RS on Apache TomEE @ DZone, May 23rd 2012 “From an architect that switched from <XXX> to Tomee. I can tell you Tomee kicks <XXX>'s ass in every way. Memory, speed, reliability, validation, you name it.” -- Zeeman, User List, July 3rd 2012 “If you are concerned about performance and footprint, but can accept that you'll have to solve problems yourself, go TomEE. (TomEE seems to be _much_ faster than <XXX>)” -- Jonathan Fisher, User List, July 3rd 2012
  • 10. Gaps in Tomcat • No Transaction support • No Connection Pooling support – Pooling should be transactional • No Integrated Security • No support for Global JNDI – java:module – java:app – java:global • No support for @DataSourceDefinition • No support for new <env-entry> types: – java.lang.Class – Enums
  • 11. Gaps in Tomcat • No @Resource – UserTransaction – BeanManager – Validator – ValidatorFactory – Topic/Queue – ConnectionFactory • No @PersistenceUnit • No @PersistenceContext • No @Inject • No @EJB • No @WebServiceRef
  • 13. Building your own app server • Including API jars in the webapp – JPA API – JSF API – etc. • Including implementations in webapp – Mojarra (works in trunk) – Bitronix/Atomikos • Non-compliant DataSource and JPA – too many years of Do It Yourself – providers not enforcing rules
  • 14. (Mis)Information • Gaps in Knowledge – “that other stuff” • Misinformation – don’t use X, it’s heavy • Leads to... – let’s build own own heavy X! • Bites you – non-portable apps – lacks tens of thousands of tests – lacks shared experience
  • 15. Closing Gaps in Knowledge
  • 16. You can’t use this • unless you understand – JTA Transactions – Container-managed EntityManagers – Container-managed DataSources – How to get references to these, properly!
  • 17. Not Just EJBs • Components with Transaction support – Servlets – JSP – JSF Managed Beans – CDI – EJB – JAX-RS REST Services – JAX-WS Web Services
  • 20.
  • 21.
  • 22.
  • 23. Controlling Transactions • javax.transaction.UserTransaction – Manual approach – Any JavaEE component • @javax.ejb.TransactionAttribute – Class or method annotation – EJB only • @javax.transaction.Transactional – Class or method annotation – Any JavaEE component* – Coming in JavaEE 7
  • 24. Transaction Hooks • SessionSynchronization – @AfterBegin – @BeforeCompletion – @AfterCompletion • Events – @Observes(during=IN_PROGRESS) – @Observes(during=BEFORE_COMPLETION) – @Observes(during=AFTER_COMPLETION) • @Observes(during=AFTER_SUCCESS) • @Observes(during=AFTER_FAILURE)
  • 25.
  • 26. “Undo” aware Resources • DataSource • EntityManager • Sending JMS Messages • Receiving JMS Messages • Timers & @Schedule • (more via Java EE connectors) [Some restrictions apply. Offer void where prohibited. Container- provided resources required. Must be 18 years or older to apply]
  • 28. How does it work?
  • 30. This is not a pipe
  • 31. Not the real thing
  • 33.
  • 36.
  • 38. ...better than the real thing • thread-safe • undo-aware • leak-free
  • 39. All boils down to...
  • 42. Won’t work with any of this • DataSource – DriverManager.getConnection(...) – new FooDataSource() – autocommit = true • EntityManager – PersistenceProvider.createEntityManag... – EntityManagerFactory.createEntityManager – EntityTransaction
  • 43. Avoid Do It Yourself
  • 44. Rule • If you didn’t get it from the Container – it isn’t usable with UserTransaction – connections may leak – memory may leak • Even then there are some BIG notes – EntityManagerFactory • not usable with UserTransaction – <persistence-unit=RESOURCE_LOCAL> • not usable with UserTransaction
  • 45.
  • 47. Wrong
  • 48. Wrong
  • 49. Wrong
  • 51.
  • 52. The worst of them all
  • 58. JPA Rules • RESOURCE_LOCAL – Persistence.createEntityManagerFactory – @PersistenceUnit EntityManagerFactory – <non-jta-data-source> • JTA – @PersistenceContext EntityManager – <jta-data-source> – <non-jta-data-source> • No other combinations are valid
  • 62. DataSource • Declare – in tomee.xml – in META-INF/resources.xml – via @DataSourceDefinition • Retrieve – @Resource – <resource-ref> • Undo-aware and pooled
  • 64. Recap
  • 65. Recap • Use if you need “undo” • Transactions not heavy – Thread safe management – Help prevent Leaks – Enhance programming • More than a TransactionManager – TransactionManagers do nothing alone – Resources must cooperate • Don’t Do It Yourself – Use container-provided resources – no need to re-invent the wheel
  • 66. Recap • Components with Transaction support – Servlets – JSP – JSF Managed Beans – CDI – EJB – JAX-RS REST Services – JAX-WS Web Services
  • 67. Recap • Transactional Resources – DataSource – EntityManager – Sending JMS Messages – Receiving JMS Messages – Timers & @Schedule – (more via Java EE connectors)
  • 69. Thank You! @dblevins http://tomee.apache.org