@HirofumiIwasaki 1
Huge Enterprise Systems Architecture Design
with Java EE
Oct 22, 2016
Hirofumi Iwasaki
Group Manager, Rakuten Card Co., Ltd.
@HirofumiIwasaki 2
Speaker Biography
 Hirofumi Iwasaki
– Group Manager
– New System Technology Group, New System Development Department,
Rakuten Card Co., Ltd. (seconded from Rakuten, Inc.)
 Carrier
– 17 Years of experience in planning, designing and implementation of
Japanese financial, manufacturing and public enterprise system with
emphasis in Java EE and .NET enterprise middleware.
 Opus, Lectures, etc.
– Conferences: JavaOne 2015, 2014, Oracle OpenWorld 2014, Java Day
Tokyo 2016 - 2014, JJUG CCC Spring & Fall (2014), WebLogic roundtable
(2012-2013), Rakuten Tech Conference 2016 – 2013, etc.
– Book: デベロッパーのキャリアと働き方を語ろうVol.1 (2016)
– Magazine: 日経コンピュータ 2015年8月号 @IT (2005-2010), CIO Magazine
(2009), IT Architect (2005-2009), Web+DB Press (2005), Java World
(2001-2004), etc.
@HirofumiIwasaki 3
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 4
About the Enterprise Systems
 Enterprise systems (ES) are large-scale application software
packages that support business processes, information flows,
reporting, and data analytics in complex organizations.
-(from Wikipedia "Enterprise Systems")
@HirofumiIwasaki 5
Enterprise Software on Enterprise Systems
 Enterprise software, also known as enterprise application
software (EAS), is computer software used to satisfy the needs
of an organization rather than individual users. Such
organizations would include businesses, schools, interest-based
user groups, clubs, charities, or governments.[1] Enterprise
software is an integral part of a (computer-based) information
system.
Enterprise
Systems
Enterprise
Software
@HirofumiIwasaki 6
Non-Functional Requirements of Enterprise Software
Enterprise Software
ACID Transaction Management
Distributed
Transaction
Management
Efficient Database
& MQ Connectivity
Variety of
Communication
Protocols
Frameworks of
Web Systems and
Mobile Apps
Efficient
Development
Environment
Security
Management, etc.
@HirofumiIwasaki 7
Custom? or Packaged? on Enterprise Systems
Packaging Software
Approach
Custom Software
Approach
 For strong area of the
enterprise.
 Specialties of the
competitiveness,
depends on each
industries.
 For non strong area of
the enterprise.
 E.g. HR, accounting,
information sharing
systems, etc.
@HirofumiIwasaki 8
Custom? or Packaged? on Enterprise Systems
Packaging Software
Approach
Custom Software
Approach
 For strong area of the
enterprise.
 Specialties of the
competitiveness,
depends on each
industries.
 For non strong area of
the enterprise.
 E.g. HR, accounting,
information sharing
systems, etc.
@HirofumiIwasaki 9
For Start Making Custom Enterprise Software
Maturity for Huge Mission Critical Systems
OpenStandard,CommunityPower
Microsoft .NET
Framework
Java EE
Open Source Platform
like PHP, etc.
Vendor Locked-In
Platform, like ABAP,
etc.
@HirofumiIwasaki 10
For Start Making Custom Enterprise Software
Maturity for Huge Mission Critical Systems
OpenStandard,CommunityPower
Microsoft .NET
Framework
Java EE
Open Source Platform
like PHP, etc.
Vendor Locked-In
Platform, like ABAP,
etc.
@HirofumiIwasaki 11
Summary: Select Java EE for Enterprise Apps
is even better platform for
 Huge, mission critical systems.
 Vendor free.
 Larger community power.
 Amount of engineers.
@HirofumiIwasaki 12
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 13
Java EE Overview
 Java EE = Java Platform, Enterprise Edition
 Java specification for enterprise systems, not light weight
systems.
– For other matured mission critical systems.
– Especially for financial industry systems.
@HirofumiIwasaki 14
Java EE Spec & App Servers
 Java EE specification is managed by
Java community process (JCP).
 Many vendors are making
Java EE app server
not only for commercial usage
but also for free. Specification
Java EE
App Servers
@HirofumiIwasaki 15
History of Java EE Specification
1999 2001 2003 2006 2009 2013 2017
J2EE 1.2 (Dec, 1999)
J2EE 1.3 (Sep, 2001)
J2EE 1.4 (Nov, 2003)
Java EE 5 (May, 2006)
Java EE 6 (May, 2006)
Project
JPE
Java EE 7
(June, 2013)
@HirofumiIwasaki 16
1999 2001 2003 2006 2009 2013
Java EE 7 Svrs
J2EE 1.2 Servers
Pre-J2EE
J2EE 1.3 Servers
J2EE 1.4 Servers
Java EE 5 Servers
Java EE 6 Servers
2017
History of Java EE Spec Servers
@HirofumiIwasaki 17
Combination of Java EE and Java SE
J2EE
1.2
(1999)
J2EE
1.3
(2001)
J2EE
1.4
(2003)
Java
EE 5
(2006)
Java
EE 6
(2009)
Java
EE 7
(2013)
J2SE
1.2
(1998)
J2SE
1.3
(2000)
J2SE
1.4
(2002)
J2SE
5
(2004)
Java
SE 6
(2006)
Java
SE 7
(2011)
Java
SE 8
(2014)
One EE specification, with latest SE version
Java EE 7 relies on SE 7
Sun
Microsystems Oracle
@HirofumiIwasaki 18
Enterprise Systems
Web Front End Business Logic Back End
@HirofumiIwasaki 19
Enterprise Systems and Java EE Specifications
JSF
Servlet
Web Front End Business Logic
JTA
CDI
EJB
Back End
JDBCRMI-
IIOP
JAX-
RS
JPA
JMS
JAX-
WS
Web
Socket
JBatch
Java
Mail
@HirofumiIwasaki 20
Standardization History of Java EE
J2EE 1.2
J2EE 1.3
J2EE 1.4
Java EE 5
Java EE 6
Java EE 7
Java EE 8
JDBC
EJB/JTA/XA/IIOP
Servlet/JSP
JMS
RMI
SOAP
JPA
JSF/Facelet
REST
CDI
JavaBatch
Project JPE
or earlier
WebSocket
…
…
WebLogic
Hibernate
Spring Framework
@HirofumiIwasaki 21
New Specs of Java EE
J2EE 1.2
J2EE 1.3
J2EE 1.4
Java EE 5
Java EE 6
Java EE 7
Java EE 8
JDBC
EJB
JSP
JMS
RMI
SOAP
JPA
JSF/Facelet
REST
CDI
JavaBatch
Project JPE
or earlier
WebSocket
EJBEntityBean
JSP
…
…
@HirofumiIwasaki 22
2017: Java EE 8 – Now RevisingOriginalPlan:
FinalRelease:
H12017
RevisedPlan:
FinalRelease:
Q32017
Early
Draft
Public
Review
Propos
ed Final
Draft
Final
Release
2016 2017
Q3, 2017
1H, 2017, canceled
Public
Survey
Propos
ed Final
Draft
Final
Release
@HirofumiIwasaki 23
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 24
Application Design with Java EE: Keywords
App Server and
Version
Vendor
Selection
Java EE
Version
Commercial or
Free
Product
Roadmap
@HirofumiIwasaki 25
Rich Clients
Web Presentation Business Logic
(no presentations)
Typical Enterprise Systems
DBs
MQ
Connection Other
Servers
EMail
MTA
Call
Call
Call
Call
Call
Call
Data Access
Messaging
@HirofumiIwasaki 26
Rich Clients
Web Presentation Business Logic
(no presentations)
Typical Usage of Java EE 7
JPA
EJBJSF
DBs
Java FX JTA
Automatic
Transaction
JMS MQ
Connection
RMI-IIOP
Other
Servers
EMail
MTAJavaMail
JAX
Call
Call
Call
Call
Call
Call
Data Access
Messaging
CDI
@HirofumiIwasaki 27
Use Latest Product, Latest Spec
I'll start my new project with
Java EE.
Which version should use?
Use latest product version,
with latest Java EE specification.
Because latest version is free of EOL,
greater APIs for ease of development.
@HirofumiIwasaki 28
GlassFish
& Payara
WebLogic
WebSphere
JBoss
Japan
Group
App
Engine
Copy
Java EE World and Others
Apache
Group
Google
Interstage
Cosminexus
Microsoft
.NET
@HirofumiIwasaki 29
Details of Java EE Application Servers
Vendor App Server EE 1.4
(2003-)
EE 5
(2006-)
EE 6
(2009-)
EE 7
(2013-)
Open Source GlassFish / Payara - 2.x 3.x 4.x
Oracle WebLogic 9.x 10.x 12.1 12.2
IBM WebSphere 5.1-6.x 7.0 8.5 8.5.5
Red Hat JBoss 4.x 5.1 6.0 7.0
Red Hat WildFly - - - 8.0-10.0
Hitachi Cosminexus 7.x 8.x 9.x 10.0
TmaxSoft JEUS 5.0 6.0 7.0 8.0
Fujitsu Interstage 9.0,9.1 9.2-11.0 11.1 -
Apache Geronimo - 2.x 3.x -
Apache TomEE - - 1.x -
@HirofumiIwasaki 30
Commercial or Free?
Is heavily
SLA required?
Is open source
required?
Some supports
required?
Select Commercial Products Select Free Products
Is there few initial
cost limitation?
Is DIY acceptable?Is long running
upgrading path required?
WebLogic WebSphere JBoss
Cosminexus
/Payara
@HirofumiIwasaki 31
Summary: Select Your Appropriate Server
Select the appropriate Java EE server.
 Vendor
 Applied Java EE version
 Free or Commercial
 Commercial support required or not
@HirofumiIwasaki 32
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 33
IDE: Keywords
IDE or Not
Repository
Building System
Productivity
Development
Standard
@HirofumiIwasaki 34
In 1990’s – early 2000’s
“Great Engineers” never
use such IDEs!
Instead, they use text editor!
*Is Japanese special habit not to use IDEs?
@HirofumiIwasaki 35
“Great Engineer” never
use such IDEs!
Instead, use text editor!
We’re now living in 2010’s
NEVER
Not good for productivity on
enterprise development.
Apply the latest technologies!
*Is Japanese special habit not to use IDEs?
@HirofumiIwasaki 36
Over 10,000 classes in real large systems
Crazy amount of
source codes!
@HirofumiIwasaki 37
Manage tons of codes with modern IDE
@HirofumiIwasaki 38
Summary: modern IDE for Java EE
@HirofumiIwasaki 39
De-Facto standard building tool
 Determined with “pom.xml”
 Automatic library downloading
 Ease of use, script not supported
 Determined with “build.gradle”
 Automatic library downloading
 Complex scripting supported
@HirofumiIwasaki 40
Three major IDEs support Maven in default setting
*Additional plugin required
* *
“New Project” Dialogs:
@HirofumiIwasaki 41
“Special Project Files” are not required anymore with Maven
Maven Project are used by these three IDEs
@HirofumiIwasaki 42
Summary: recommendation to make Java EE project
Make project with ,
Enjoy programming with
(Choose anything you want)
@HirofumiIwasaki 43
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 44
Web Front-End: Keywords
Security
JavaServer
Faces (JSF)
Page Flow
HTTP
Facelet
Post Back
@HirofumiIwasaki 45
Rich Clients
Web Presentation Business Logic
(no presentations)
Typical usage of Java EE 7
JPA
EJBJSF
DBs
Java FX JTA
Automatic
Transaction
JMS MQ
Connection
RMI-IIOP
Other
Servers
EMail
MTAJavaMail
JAX
Call
Call
Call
Call
Call
Call
Data Access
Messaging
CDI
@HirofumiIwasaki 46
Selection of the front-end frameworks of server side Java
 JavaServer Faces
– Genuine Java EE front-end framework
– Many additional components like “PrimeFaces”.
– View-based operation
– Security countermeasures already
implemented like XSS, XSRF.
@HirofumiIwasaki 47
<Facelet>
View 1
Backing1
- fields
+ load()
+ action()
<Facelet>
View 2
Backing2
- fields
+ load()
+ action()
<Facelet>
View 3
Backing3
- fields
+ load()
+ action()
Front View
&
Backing Bean
Per View Operation
@HirofumiIwasaki 48
Paradigm Changes: From 2000's to 2010's
<<JSP>>
View1
<<JSP>>
View 2
Action1
+ action()
<<JSP>>
View 3
Action2
+ action()
ActionForm1
- fields
+ validate()
ActionForm2
- fields
+ validate()
Operate
Action
Build
Next View
Operate
Action
Build
Next View
<Facelet>
View 1
Backing1
- fields
+ load()
+ action()
<Facelet>
View 2
Backing2
- fields
+ load()
+ action()
<Facelet>
View 3
Backing3
- fields
+ load()
+ action()
Front View
& Backing Bean
1.x
@HirofumiIwasaki 49
Older JSP vs. New Facelet
JavaServer
Pages
Facelet
Compile
Java Servlet
Work
HTML
Rendering
HTML
Rendering
Real-time
Interpreting
&
Work
No Compile,
Rapid Dev.
Re-Deploy
& Compile
Harmful
Dev. Procs
Check
Fix Fix Reload
@HirofumiIwasaki 50
Security Countermeasures and JSF
Cross Site
Scripting
(XSS)
Cross Site
Request Forgery
(CSRF)
Output values to
HTML with escaping.
Requirement
Output one time
token for next page
transitions.
JSF
Automatically
operated
Automatically
operated
@HirofumiIwasaki 51
Summary: Recommendation for the Java EE 7 Front-End
Use For your web front-end,
Implement with Facelet.
@HirofumiIwasaki 52
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 53
Business Logic: Keywords
Enterprise
JavaBeans
(EJB)
Context and
Dependency
Injection (CDI)
JBatch
Transaction
Management
Container
Managed
Transaction
(CMT)
@HirofumiIwasaki 54
Rich Clients
Web Presentation Business Logic
(no presentations)
Typical usage of Java EE 7
JPA
EJBJSF
DBs
Java FX JTA
Automatic
Transaction
JMS MQ
Connection
RMI-IIOP
Other
Servers
EMail
MTAJavaMail
JAX
Call
Call
Call
Call
Call
Call
Data Access
Messaging
CDI
@HirofumiIwasaki 55
Two Solutions for Realtime Logics: EJB or CDI
For Heavy & Mission-Critical
Business Logics
CDIEJB
Context and Dependency
Injection
For Light-weight Logics,
Rapid, Ease of Development
@HirofumiIwasaki 56
Review: What’s EJB? Why EJB?
EJBClient
1. Remote Invocation
EJB
2. Automatic Transaction Management
Database
(BEGIN)
(COMMIT)
EJB
EJB
EJB
EJB
Instance
Pool
Activate
3. Instance Pooling for Faster Operation
RMI-IIOP
SOAP
REST
Web Socket
EJB
Client
4. Security Management
@HirofumiIwasaki 57
Review: CDI – Light Version of EJB
CDIClient
1. Remote Invocation
CDI
2. Automatic Transaction Management
Database
(BEGIN)
(COMMIT)
EJB
EJB
Instance
Pool
Activate
3. Instance Pooling for Faster Operation
RMI-IIOP
SOAP
REST
Web Socket
Client
4. Security Management
Few Functions, Faster Deployment
@HirofumiIwasaki 58
POJO
Java EE ServerJava EE Server
Java Batch
How Design the Batch Logics?
Choice 1: Use EJB/CDI,
Call via EJB/CDI Remote
from Outside
EJB
Batch
Batch
Kicker Call
Choice 2: Use
Java Batch Framework,
Call from Outside
Batch
Kicker Call
Choice 3:
Micro Service
(Java EE 9 style)
Batch
Kicker Call
Full automatic transaction,
Able to use embedded server.
If the standard templates
suitable for your app, try it.
Not released yet, but you can
try with Payara Micro now.
@HirofumiIwasaki 59
Summary: Recommendation for the Java EE 7 Front-End
Use for your real-time logics,
Consider batch logics design.
CDI
@HirofumiIwasaki 60
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 61
Data Access: Keywords
Java
Persistence API
(JPA)
Data Access
Object (DAO)
JDBC
Auto
Generation
Java
Persistence
Query
Language
(JPQL)
@HirofumiIwasaki 62
Rich Clients
Web Presentation Business Logic
(no presentations)
Typical usage of Java EE 7
JPA
EJBJSF
DBs
Java FX JTA
Automatic
Transaction
JMS MQ
Connection
RMI-IIOP
Other
Servers
EMail
MTAJavaMail
JAX
Call
Call
Call
Call
Call
Call
Messaging
Data Access
CDI
@HirofumiIwasaki 63
About JPA – Java Persistence API
Java Persistence API
(from Java EE 5)
@HirofumiIwasaki 64
JPA – Simple Database Mapper
Relational Database
(E-R Diagram)
One by One
JPA Entity
(Class Diagram)
Auto Generate
With Bean Validation
@HirofumiIwasaki 65
JPA – Simple Database Mapper
JPA Entity
JPA Data Access Object (DAO)
Auto CRUD
to Database
Access to RDB
@HirofumiIwasaki 66
public List<Member> findMemberByName(String name) {
String queryString = "SELECT a FROM Member m " +
"WHERE m.name = LOWER(:name)";
Query query = getEntityManager().createQuery(queryString);
query.setParameter("name", name);
List<Member> result = query.getResultList();
}
JPA Custom Queries – JPQL and Criteria Query
JPQL:
Criteria Query:
public List<Member> findMemberByName(String name) {
CriteriaBuilder builder = this.em.getCriteriaBuilder();
CriteriaQuery query = builder.createQuery();
Root<Member> member = query.from(Member.class);
query.select(member);
query.where(builder.equal(member.get(”name"), name));
List<Member> result = this.em.createQuery(query).getResultList();
}
@HirofumiIwasaki 67
JTA Transaction
Management
Java EE Application
EJB Business Logic
Why You Should Not Use Raw JDBC in Java EE?
Java EE Application Server
Java VM
Connection
Pool
EJB Object
Pool
Thread
Pool
Self-Managed
JDBC Connection
JPA
Entity Manager
JNDI
JDBC
Driver Manager
RAW
?
?
No Global Transaction
No Connection Management
@HirofumiIwasaki 68
Combination with EJB Session Bean
Business Logic
(no presentations)
JPA
EJB
DBs
JTA
Automatic
Transaction
Call
Full automatic
transaction management
with EJB session bean
JPA entity manager
automatically join
the CMT of EJB
Data Access
@HirofumiIwasaki 69
Summary: Use JPA, Instead of Raw JDBC.
Apply JPA ordinarily for data,
within the EJB / CDI
Container
Managed Transaction
(CMT)
@HirofumiIwasaki 70
Agenda
1. Enterprise Systems and its Features
2. Java EE Specifications for Enterprise Systems
3. Java EE Applying Points for Real Enterprise Systems
a) Start Application Design with Java EE
b) Specify IDE for Modern Development Style
c) Web Front-End with JSF
d) Business Logic with EJB or CDI
e) Data Access with JPA
f) Connectivity with RMI-IIOP, REST and WebSocket
@HirofumiIwasaki 71
Connectivity: Keywords
RMI over IIOP
(RMI-IIOP)
Web Services
JAX-WS
Web Socket
+ JSON
Remote Method
Invocation
(RMI)
REST + JSON
Global
Transaction
(XA)
@HirofumiIwasaki 72
Review: What’s EJB? Why EJB?
EJBClient
1. Remote Invocation
EJB
2. Automatic Transaction Management
Database
(BEGIN)
(COMMIT)
EJB
EJB
EJB
EJB
Instance
Pool
Activate
3. Instance Pooling for Faster Operation
RMI-IIOP
SOAP
REST
Web Socket
EJB
Client
4. Security Management
@HirofumiIwasaki 73
Supported protocols of Java EE 7 (EJB)
Protocol Supported
From
Annotation Client Stub Value
Marshaling
Global
Transaction
RMI-IIOP J2EE 1.2 @Remote in
remote interface
Remote interface
with auto generate
Auto XA Supported
SOAP Java EE 5 @WebService Auto generate in
development
Auto N/A
REST Java EE 6 @GET, @POST,
etc.
(Nothing special) Work with JSON
or something
(string base)
N/A
Web Socket Java EE 7 @ServerEndpoint @ClientEndpoint
with auto generate
Work with JSON
or something
(string base)
N/A
@HirofumiIwasaki 74
Global Transaction
Management
with XA Protocol
For heavy transaction: consider RMI-IIOP
EJB
Session BeanClient RMI-IIOP
Other
System’s
EJB
Database
Other
Enterprise
Information
Systems
IIOP
AUTO
BEGIN
AUTO
COMMIT
@HirofumiIwasaki 75
For light-weight usage: consider Web Socket / REST + JSON
Local Transaction
Management
EJB
Session BeanClient Web Socket or REST
Database
AUTO
BEGIN
AUTO
COMMIT
Ultra-Fast,
Ease of Dev.
@HirofumiIwasaki 76
EJB Session Bean with RMI-IIOP and Web Socket
@Stateless
@Remote
@ServerEndpoint(value = "/memberlogic")
public class MemberLogic implements MemberLogicRemote {
@OnMessage
public String register(String message, Session session) {
// WRITE TRANSACTIONAL LOGICS HERE!
return xxxx;
}
}
EJB
RMI-IIOP
Web Socket
Some Clients
Transactional
Processing
for RMI-IIOP
for Web Socket
for RMI-IIOP
for Web Socket
@HirofumiIwasaki 77
Summary: Recommendation of Protocols
Select the RMI-IIOP
for heavy transactional distributed systems.
Select the Web Socket or REST
for system that requires light-weight and
faster speed.
@HirofumiIwasaki 78
Summary
Enterprise systems require many
mission critical basement.
Java EE is one of the best platform
on the aspect of the vendor free.
Consider many critical points when
Java EE design & development start.
@HirofumiIwasaki 79
Contact
Hirofumi Iwasaki (@HirofumiIwasaki)
We’re Hiring!!
Rakuten.Careers

Huge Enterprise Systems Architecture Design with Java EE

  • 1.
    @HirofumiIwasaki 1 Huge EnterpriseSystems Architecture Design with Java EE Oct 22, 2016 Hirofumi Iwasaki Group Manager, Rakuten Card Co., Ltd.
  • 2.
    @HirofumiIwasaki 2 Speaker Biography Hirofumi Iwasaki – Group Manager – New System Technology Group, New System Development Department, Rakuten Card Co., Ltd. (seconded from Rakuten, Inc.)  Carrier – 17 Years of experience in planning, designing and implementation of Japanese financial, manufacturing and public enterprise system with emphasis in Java EE and .NET enterprise middleware.  Opus, Lectures, etc. – Conferences: JavaOne 2015, 2014, Oracle OpenWorld 2014, Java Day Tokyo 2016 - 2014, JJUG CCC Spring & Fall (2014), WebLogic roundtable (2012-2013), Rakuten Tech Conference 2016 – 2013, etc. – Book: デベロッパーのキャリアと働き方を語ろうVol.1 (2016) – Magazine: 日経コンピュータ 2015年8月号 @IT (2005-2010), CIO Magazine (2009), IT Architect (2005-2009), Web+DB Press (2005), Java World (2001-2004), etc.
  • 3.
    @HirofumiIwasaki 3 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 4.
    @HirofumiIwasaki 4 About theEnterprise Systems  Enterprise systems (ES) are large-scale application software packages that support business processes, information flows, reporting, and data analytics in complex organizations. -(from Wikipedia "Enterprise Systems")
  • 5.
    @HirofumiIwasaki 5 Enterprise Softwareon Enterprise Systems  Enterprise software, also known as enterprise application software (EAS), is computer software used to satisfy the needs of an organization rather than individual users. Such organizations would include businesses, schools, interest-based user groups, clubs, charities, or governments.[1] Enterprise software is an integral part of a (computer-based) information system. Enterprise Systems Enterprise Software
  • 6.
    @HirofumiIwasaki 6 Non-Functional Requirementsof Enterprise Software Enterprise Software ACID Transaction Management Distributed Transaction Management Efficient Database & MQ Connectivity Variety of Communication Protocols Frameworks of Web Systems and Mobile Apps Efficient Development Environment Security Management, etc.
  • 7.
    @HirofumiIwasaki 7 Custom? orPackaged? on Enterprise Systems Packaging Software Approach Custom Software Approach  For strong area of the enterprise.  Specialties of the competitiveness, depends on each industries.  For non strong area of the enterprise.  E.g. HR, accounting, information sharing systems, etc.
  • 8.
    @HirofumiIwasaki 8 Custom? orPackaged? on Enterprise Systems Packaging Software Approach Custom Software Approach  For strong area of the enterprise.  Specialties of the competitiveness, depends on each industries.  For non strong area of the enterprise.  E.g. HR, accounting, information sharing systems, etc.
  • 9.
    @HirofumiIwasaki 9 For StartMaking Custom Enterprise Software Maturity for Huge Mission Critical Systems OpenStandard,CommunityPower Microsoft .NET Framework Java EE Open Source Platform like PHP, etc. Vendor Locked-In Platform, like ABAP, etc.
  • 10.
    @HirofumiIwasaki 10 For StartMaking Custom Enterprise Software Maturity for Huge Mission Critical Systems OpenStandard,CommunityPower Microsoft .NET Framework Java EE Open Source Platform like PHP, etc. Vendor Locked-In Platform, like ABAP, etc.
  • 11.
    @HirofumiIwasaki 11 Summary: SelectJava EE for Enterprise Apps is even better platform for  Huge, mission critical systems.  Vendor free.  Larger community power.  Amount of engineers.
  • 12.
    @HirofumiIwasaki 12 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 13.
    @HirofumiIwasaki 13 Java EEOverview  Java EE = Java Platform, Enterprise Edition  Java specification for enterprise systems, not light weight systems. – For other matured mission critical systems. – Especially for financial industry systems.
  • 14.
    @HirofumiIwasaki 14 Java EESpec & App Servers  Java EE specification is managed by Java community process (JCP).  Many vendors are making Java EE app server not only for commercial usage but also for free. Specification Java EE App Servers
  • 15.
    @HirofumiIwasaki 15 History ofJava EE Specification 1999 2001 2003 2006 2009 2013 2017 J2EE 1.2 (Dec, 1999) J2EE 1.3 (Sep, 2001) J2EE 1.4 (Nov, 2003) Java EE 5 (May, 2006) Java EE 6 (May, 2006) Project JPE Java EE 7 (June, 2013)
  • 16.
    @HirofumiIwasaki 16 1999 20012003 2006 2009 2013 Java EE 7 Svrs J2EE 1.2 Servers Pre-J2EE J2EE 1.3 Servers J2EE 1.4 Servers Java EE 5 Servers Java EE 6 Servers 2017 History of Java EE Spec Servers
  • 17.
    @HirofumiIwasaki 17 Combination ofJava EE and Java SE J2EE 1.2 (1999) J2EE 1.3 (2001) J2EE 1.4 (2003) Java EE 5 (2006) Java EE 6 (2009) Java EE 7 (2013) J2SE 1.2 (1998) J2SE 1.3 (2000) J2SE 1.4 (2002) J2SE 5 (2004) Java SE 6 (2006) Java SE 7 (2011) Java SE 8 (2014) One EE specification, with latest SE version Java EE 7 relies on SE 7 Sun Microsystems Oracle
  • 18.
    @HirofumiIwasaki 18 Enterprise Systems WebFront End Business Logic Back End
  • 19.
    @HirofumiIwasaki 19 Enterprise Systemsand Java EE Specifications JSF Servlet Web Front End Business Logic JTA CDI EJB Back End JDBCRMI- IIOP JAX- RS JPA JMS JAX- WS Web Socket JBatch Java Mail
  • 20.
    @HirofumiIwasaki 20 Standardization Historyof Java EE J2EE 1.2 J2EE 1.3 J2EE 1.4 Java EE 5 Java EE 6 Java EE 7 Java EE 8 JDBC EJB/JTA/XA/IIOP Servlet/JSP JMS RMI SOAP JPA JSF/Facelet REST CDI JavaBatch Project JPE or earlier WebSocket … … WebLogic Hibernate Spring Framework
  • 21.
    @HirofumiIwasaki 21 New Specsof Java EE J2EE 1.2 J2EE 1.3 J2EE 1.4 Java EE 5 Java EE 6 Java EE 7 Java EE 8 JDBC EJB JSP JMS RMI SOAP JPA JSF/Facelet REST CDI JavaBatch Project JPE or earlier WebSocket EJBEntityBean JSP … …
  • 22.
    @HirofumiIwasaki 22 2017: JavaEE 8 – Now RevisingOriginalPlan: FinalRelease: H12017 RevisedPlan: FinalRelease: Q32017 Early Draft Public Review Propos ed Final Draft Final Release 2016 2017 Q3, 2017 1H, 2017, canceled Public Survey Propos ed Final Draft Final Release
  • 23.
    @HirofumiIwasaki 23 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 24.
    @HirofumiIwasaki 24 Application Designwith Java EE: Keywords App Server and Version Vendor Selection Java EE Version Commercial or Free Product Roadmap
  • 25.
    @HirofumiIwasaki 25 Rich Clients WebPresentation Business Logic (no presentations) Typical Enterprise Systems DBs MQ Connection Other Servers EMail MTA Call Call Call Call Call Call Data Access Messaging
  • 26.
    @HirofumiIwasaki 26 Rich Clients WebPresentation Business Logic (no presentations) Typical Usage of Java EE 7 JPA EJBJSF DBs Java FX JTA Automatic Transaction JMS MQ Connection RMI-IIOP Other Servers EMail MTAJavaMail JAX Call Call Call Call Call Call Data Access Messaging CDI
  • 27.
    @HirofumiIwasaki 27 Use LatestProduct, Latest Spec I'll start my new project with Java EE. Which version should use? Use latest product version, with latest Java EE specification. Because latest version is free of EOL, greater APIs for ease of development.
  • 28.
    @HirofumiIwasaki 28 GlassFish & Payara WebLogic WebSphere JBoss Japan Group App Engine Copy JavaEE World and Others Apache Group Google Interstage Cosminexus Microsoft .NET
  • 29.
    @HirofumiIwasaki 29 Details ofJava EE Application Servers Vendor App Server EE 1.4 (2003-) EE 5 (2006-) EE 6 (2009-) EE 7 (2013-) Open Source GlassFish / Payara - 2.x 3.x 4.x Oracle WebLogic 9.x 10.x 12.1 12.2 IBM WebSphere 5.1-6.x 7.0 8.5 8.5.5 Red Hat JBoss 4.x 5.1 6.0 7.0 Red Hat WildFly - - - 8.0-10.0 Hitachi Cosminexus 7.x 8.x 9.x 10.0 TmaxSoft JEUS 5.0 6.0 7.0 8.0 Fujitsu Interstage 9.0,9.1 9.2-11.0 11.1 - Apache Geronimo - 2.x 3.x - Apache TomEE - - 1.x -
  • 30.
    @HirofumiIwasaki 30 Commercial orFree? Is heavily SLA required? Is open source required? Some supports required? Select Commercial Products Select Free Products Is there few initial cost limitation? Is DIY acceptable?Is long running upgrading path required? WebLogic WebSphere JBoss Cosminexus /Payara
  • 31.
    @HirofumiIwasaki 31 Summary: SelectYour Appropriate Server Select the appropriate Java EE server.  Vendor  Applied Java EE version  Free or Commercial  Commercial support required or not
  • 32.
    @HirofumiIwasaki 32 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 33.
    @HirofumiIwasaki 33 IDE: Keywords IDEor Not Repository Building System Productivity Development Standard
  • 34.
    @HirofumiIwasaki 34 In 1990’s– early 2000’s “Great Engineers” never use such IDEs! Instead, they use text editor! *Is Japanese special habit not to use IDEs?
  • 35.
    @HirofumiIwasaki 35 “Great Engineer”never use such IDEs! Instead, use text editor! We’re now living in 2010’s NEVER Not good for productivity on enterprise development. Apply the latest technologies! *Is Japanese special habit not to use IDEs?
  • 36.
    @HirofumiIwasaki 36 Over 10,000classes in real large systems Crazy amount of source codes!
  • 37.
    @HirofumiIwasaki 37 Manage tonsof codes with modern IDE
  • 38.
  • 39.
    @HirofumiIwasaki 39 De-Facto standardbuilding tool  Determined with “pom.xml”  Automatic library downloading  Ease of use, script not supported  Determined with “build.gradle”  Automatic library downloading  Complex scripting supported
  • 40.
    @HirofumiIwasaki 40 Three majorIDEs support Maven in default setting *Additional plugin required * * “New Project” Dialogs:
  • 41.
    @HirofumiIwasaki 41 “Special ProjectFiles” are not required anymore with Maven Maven Project are used by these three IDEs
  • 42.
    @HirofumiIwasaki 42 Summary: recommendationto make Java EE project Make project with , Enjoy programming with (Choose anything you want)
  • 43.
    @HirofumiIwasaki 43 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 44.
    @HirofumiIwasaki 44 Web Front-End:Keywords Security JavaServer Faces (JSF) Page Flow HTTP Facelet Post Back
  • 45.
    @HirofumiIwasaki 45 Rich Clients WebPresentation Business Logic (no presentations) Typical usage of Java EE 7 JPA EJBJSF DBs Java FX JTA Automatic Transaction JMS MQ Connection RMI-IIOP Other Servers EMail MTAJavaMail JAX Call Call Call Call Call Call Data Access Messaging CDI
  • 46.
    @HirofumiIwasaki 46 Selection ofthe front-end frameworks of server side Java  JavaServer Faces – Genuine Java EE front-end framework – Many additional components like “PrimeFaces”. – View-based operation – Security countermeasures already implemented like XSS, XSRF.
  • 47.
    @HirofumiIwasaki 47 <Facelet> View 1 Backing1 -fields + load() + action() <Facelet> View 2 Backing2 - fields + load() + action() <Facelet> View 3 Backing3 - fields + load() + action() Front View & Backing Bean Per View Operation
  • 48.
    @HirofumiIwasaki 48 Paradigm Changes:From 2000's to 2010's <<JSP>> View1 <<JSP>> View 2 Action1 + action() <<JSP>> View 3 Action2 + action() ActionForm1 - fields + validate() ActionForm2 - fields + validate() Operate Action Build Next View Operate Action Build Next View <Facelet> View 1 Backing1 - fields + load() + action() <Facelet> View 2 Backing2 - fields + load() + action() <Facelet> View 3 Backing3 - fields + load() + action() Front View & Backing Bean 1.x
  • 49.
    @HirofumiIwasaki 49 Older JSPvs. New Facelet JavaServer Pages Facelet Compile Java Servlet Work HTML Rendering HTML Rendering Real-time Interpreting & Work No Compile, Rapid Dev. Re-Deploy & Compile Harmful Dev. Procs Check Fix Fix Reload
  • 50.
    @HirofumiIwasaki 50 Security Countermeasuresand JSF Cross Site Scripting (XSS) Cross Site Request Forgery (CSRF) Output values to HTML with escaping. Requirement Output one time token for next page transitions. JSF Automatically operated Automatically operated
  • 51.
    @HirofumiIwasaki 51 Summary: Recommendationfor the Java EE 7 Front-End Use For your web front-end, Implement with Facelet.
  • 52.
    @HirofumiIwasaki 52 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 53.
    @HirofumiIwasaki 53 Business Logic:Keywords Enterprise JavaBeans (EJB) Context and Dependency Injection (CDI) JBatch Transaction Management Container Managed Transaction (CMT)
  • 54.
    @HirofumiIwasaki 54 Rich Clients WebPresentation Business Logic (no presentations) Typical usage of Java EE 7 JPA EJBJSF DBs Java FX JTA Automatic Transaction JMS MQ Connection RMI-IIOP Other Servers EMail MTAJavaMail JAX Call Call Call Call Call Call Data Access Messaging CDI
  • 55.
    @HirofumiIwasaki 55 Two Solutionsfor Realtime Logics: EJB or CDI For Heavy & Mission-Critical Business Logics CDIEJB Context and Dependency Injection For Light-weight Logics, Rapid, Ease of Development
  • 56.
    @HirofumiIwasaki 56 Review: What’sEJB? Why EJB? EJBClient 1. Remote Invocation EJB 2. Automatic Transaction Management Database (BEGIN) (COMMIT) EJB EJB EJB EJB Instance Pool Activate 3. Instance Pooling for Faster Operation RMI-IIOP SOAP REST Web Socket EJB Client 4. Security Management
  • 57.
    @HirofumiIwasaki 57 Review: CDI– Light Version of EJB CDIClient 1. Remote Invocation CDI 2. Automatic Transaction Management Database (BEGIN) (COMMIT) EJB EJB Instance Pool Activate 3. Instance Pooling for Faster Operation RMI-IIOP SOAP REST Web Socket Client 4. Security Management Few Functions, Faster Deployment
  • 58.
    @HirofumiIwasaki 58 POJO Java EEServerJava EE Server Java Batch How Design the Batch Logics? Choice 1: Use EJB/CDI, Call via EJB/CDI Remote from Outside EJB Batch Batch Kicker Call Choice 2: Use Java Batch Framework, Call from Outside Batch Kicker Call Choice 3: Micro Service (Java EE 9 style) Batch Kicker Call Full automatic transaction, Able to use embedded server. If the standard templates suitable for your app, try it. Not released yet, but you can try with Payara Micro now.
  • 59.
    @HirofumiIwasaki 59 Summary: Recommendationfor the Java EE 7 Front-End Use for your real-time logics, Consider batch logics design. CDI
  • 60.
    @HirofumiIwasaki 60 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 61.
    @HirofumiIwasaki 61 Data Access:Keywords Java Persistence API (JPA) Data Access Object (DAO) JDBC Auto Generation Java Persistence Query Language (JPQL)
  • 62.
    @HirofumiIwasaki 62 Rich Clients WebPresentation Business Logic (no presentations) Typical usage of Java EE 7 JPA EJBJSF DBs Java FX JTA Automatic Transaction JMS MQ Connection RMI-IIOP Other Servers EMail MTAJavaMail JAX Call Call Call Call Call Call Messaging Data Access CDI
  • 63.
    @HirofumiIwasaki 63 About JPA– Java Persistence API Java Persistence API (from Java EE 5)
  • 64.
    @HirofumiIwasaki 64 JPA –Simple Database Mapper Relational Database (E-R Diagram) One by One JPA Entity (Class Diagram) Auto Generate With Bean Validation
  • 65.
    @HirofumiIwasaki 65 JPA –Simple Database Mapper JPA Entity JPA Data Access Object (DAO) Auto CRUD to Database Access to RDB
  • 66.
    @HirofumiIwasaki 66 public List<Member>findMemberByName(String name) { String queryString = "SELECT a FROM Member m " + "WHERE m.name = LOWER(:name)"; Query query = getEntityManager().createQuery(queryString); query.setParameter("name", name); List<Member> result = query.getResultList(); } JPA Custom Queries – JPQL and Criteria Query JPQL: Criteria Query: public List<Member> findMemberByName(String name) { CriteriaBuilder builder = this.em.getCriteriaBuilder(); CriteriaQuery query = builder.createQuery(); Root<Member> member = query.from(Member.class); query.select(member); query.where(builder.equal(member.get(”name"), name)); List<Member> result = this.em.createQuery(query).getResultList(); }
  • 67.
    @HirofumiIwasaki 67 JTA Transaction Management JavaEE Application EJB Business Logic Why You Should Not Use Raw JDBC in Java EE? Java EE Application Server Java VM Connection Pool EJB Object Pool Thread Pool Self-Managed JDBC Connection JPA Entity Manager JNDI JDBC Driver Manager RAW ? ? No Global Transaction No Connection Management
  • 68.
    @HirofumiIwasaki 68 Combination withEJB Session Bean Business Logic (no presentations) JPA EJB DBs JTA Automatic Transaction Call Full automatic transaction management with EJB session bean JPA entity manager automatically join the CMT of EJB Data Access
  • 69.
    @HirofumiIwasaki 69 Summary: UseJPA, Instead of Raw JDBC. Apply JPA ordinarily for data, within the EJB / CDI Container Managed Transaction (CMT)
  • 70.
    @HirofumiIwasaki 70 Agenda 1. EnterpriseSystems and its Features 2. Java EE Specifications for Enterprise Systems 3. Java EE Applying Points for Real Enterprise Systems a) Start Application Design with Java EE b) Specify IDE for Modern Development Style c) Web Front-End with JSF d) Business Logic with EJB or CDI e) Data Access with JPA f) Connectivity with RMI-IIOP, REST and WebSocket
  • 71.
    @HirofumiIwasaki 71 Connectivity: Keywords RMIover IIOP (RMI-IIOP) Web Services JAX-WS Web Socket + JSON Remote Method Invocation (RMI) REST + JSON Global Transaction (XA)
  • 72.
    @HirofumiIwasaki 72 Review: What’sEJB? Why EJB? EJBClient 1. Remote Invocation EJB 2. Automatic Transaction Management Database (BEGIN) (COMMIT) EJB EJB EJB EJB Instance Pool Activate 3. Instance Pooling for Faster Operation RMI-IIOP SOAP REST Web Socket EJB Client 4. Security Management
  • 73.
    @HirofumiIwasaki 73 Supported protocolsof Java EE 7 (EJB) Protocol Supported From Annotation Client Stub Value Marshaling Global Transaction RMI-IIOP J2EE 1.2 @Remote in remote interface Remote interface with auto generate Auto XA Supported SOAP Java EE 5 @WebService Auto generate in development Auto N/A REST Java EE 6 @GET, @POST, etc. (Nothing special) Work with JSON or something (string base) N/A Web Socket Java EE 7 @ServerEndpoint @ClientEndpoint with auto generate Work with JSON or something (string base) N/A
  • 74.
    @HirofumiIwasaki 74 Global Transaction Management withXA Protocol For heavy transaction: consider RMI-IIOP EJB Session BeanClient RMI-IIOP Other System’s EJB Database Other Enterprise Information Systems IIOP AUTO BEGIN AUTO COMMIT
  • 75.
    @HirofumiIwasaki 75 For light-weightusage: consider Web Socket / REST + JSON Local Transaction Management EJB Session BeanClient Web Socket or REST Database AUTO BEGIN AUTO COMMIT Ultra-Fast, Ease of Dev.
  • 76.
    @HirofumiIwasaki 76 EJB SessionBean with RMI-IIOP and Web Socket @Stateless @Remote @ServerEndpoint(value = "/memberlogic") public class MemberLogic implements MemberLogicRemote { @OnMessage public String register(String message, Session session) { // WRITE TRANSACTIONAL LOGICS HERE! return xxxx; } } EJB RMI-IIOP Web Socket Some Clients Transactional Processing for RMI-IIOP for Web Socket for RMI-IIOP for Web Socket
  • 77.
    @HirofumiIwasaki 77 Summary: Recommendationof Protocols Select the RMI-IIOP for heavy transactional distributed systems. Select the Web Socket or REST for system that requires light-weight and faster speed.
  • 78.
    @HirofumiIwasaki 78 Summary Enterprise systemsrequire many mission critical basement. Java EE is one of the best platform on the aspect of the vendor free. Consider many critical points when Java EE design & development start.
  • 79.
  • 81.