Describe a typical Java EE architecture?

This question is a very popular white board session question for both Java architects and experienced JEE Developers. You need to draw on your experience to tackle this question as there are no right or wrong answers. These high level diagrams and summary will help you refresh your memory.

Q. What should be a typical Java EE architecture for let’s say, a medium-size web-based application?
A. Before start drawing the components on the whit board, you need to show that you gather requirements.

#1. Ask some questions like How many transactions per minute or hour should the system handle? How many concurrent users should it handle?, etc.

#2. Draw a big picture diagram. Mark the tiers, layers, key components, frameworks, etc. This is a 100 feet bird’s eye view of the components.

JEE High Level Architecture

JEE High Level Architecture

Be prepared for drill down questions like

1) Client pull Vs Server push. Client pull requires a special directive either in the HTML document header. This directive instructs the client to retrieve a specified document after a certain amount of time. In other words, the client opens a new connection to the server. Server push involves sending packets of data to the client periodically. The HTTP connection between the client and the server is kept open indefinitely. For example, you can use an asynchronous servlet.

2) When to use queue vs topic. Queue is for single receiver and a topic is for multiple subscribers.

3) When to use LDAP vs Database. LDAP stores data hierarchically and more suited for read intensive operations like looking up users, roles, etc for authorization, and database is more suited for CRUD operations.

4) What is Rich Internet Application (RIA)? Modern web applications are rich single page applications making use of JavaScript code and frameworks like angularjs. A single rich page makes ajax calls to back end systems to populate a particular section or tab of a rich page. This architecture is summarized below with an architecture diagram.

The modern web applications using AngulaJS or any other JavaScript based MVC frameworks may have two war files. One for the GUI and the second one for exposing the data via web services in JSON format.

Separate war files for UI and data

Separate war files for UI and data

When using multiple domains as shown above, you need to use CORS (Cross Origin Resource Sharing) to overcome the JavaScript restriction on cross domains. CORS allows you to share GET, POST, PUT, and DELETE requests and CORS is supported by the modern browsers. The CORS make use of 2 requests.

Request 1: “OPTIONS” request as part of the handshake to determine if cross domain is allowed by the server.

Request 2: GET, POST, PUT, or DELETE request that performs the actual operation on the server.

CORS

CORS

#3. Security considerations

Enterprise applications make use of SSO (Single-Sign-On) with enterprise level products like SiteMinder, Tivoli Access Manager, etc.

For example, SSO application like SiteMinder is configured to intercept the calls to authenticate the user. Once the user is authenticated, a HTTP header “SM_USER” is added with the authenticated user name. For example “123”. The user header is passed to Spring 3 security. The “Security.jar” is a custom component that knows how to retrieve user roles for a given user like 123 from a database or LDAP server. This custom component is responsible for creating a UserDetails Spring object that contains the roles as authorities. Once you have the authorities or roles for a given user, you can restrict your application URLs and functions to provide proper access control.

Learn more about SSO

SSO with SiteMinder

SSO with SiteMinder

#4. Transaction Management

Transaction management takes place at the service layer. You can use a Spring transaction manager with annotations such as @Transactional to demarcate transactional boundaries. The service class can call multiple data access object (DAOs) within a transactional context.

Transaction Manager

Transaction Manager

#5. Quality of Service (QoS) considerations

Quality of service (QoS) requirements are technical specifications that specify the system quality of features such as availability, scalability, serviceability, etc. This is covered in detail under QoS interview questions and answers.

Finally, the modern applications are highly distributed making use of various architecture and integration styles described in:

Java integration styles and Java architectures. A typical enterprise application will make use of a combination of these integration styles and architecture. For example, here is a very simplified trading application making use of “synchronous” and “asynchronous” calls. This allow traders to place buy/sell trades online.

FIX to send trades to stock exchange

FIX to send trades to stock exchange

as you can see, it makes use of

1) Message Oriented Middle wares (MOM) like WebMethods or Tibco to publish or subscribe messages (i.e. trades).
2) Web services to perform CRUD (Create Read Update and Delete) operations.
3) MVC architecture to display data on the GUI to provide a user interface.
4) JDBC to persist/read user interactions via CRUD operations.
5) FIX protocol to communicate to the stock exchange. It is a standard to exchange financial information.


300+ Enterprise Java Interview Q&As
Module 1 Describe the recent Java application that you had worked on from a 100 feet?-
Unit 1 12 High-level JEE architecture overviews at 100 feet with diagrams  - Preview
Unit 2 Describe a typical Java EE architecture?  - Preview
Unit 3 11 JEE application integration styles with diagrams  - Preview
Module 2 JEE Overview+
Unit 1 10 JEE overview interview Q&As
Unit 2 4 JEE bean validation, asynchronous processing & web fragments interview Q&As
Module 3 Web Basics+
Unit 1 4 Http methods, content types, headers, MIME types, cookies, etc Q&As
Unit 2 12 Web development basics interview Q&AS
Unit 3 8 Web development design patterns interview Q&As
Module 4 Java Servlets+
Unit 1 21 Java servlet interview Q&As
Unit 2 5 web.xml, ServletConfig, and ServletContext interview Q&As
Module 5 View Technologies in Java Web applications+
Unit 1 Client-side vs server side view technologies interview Q&As
Unit 2 13 AngularJs interview Q&As
Unit 3 7 JSP interview Q&As
Unit 4 9 JSF interview Q&As
Module 6 Java Web Services+
Unit 1 6 must know Java Web Services Interview Q&As
Unit 2 6 Micro & web services interview Q&As
Unit 3 6 RESTful web services interview Q&As
Unit 4 JAX-RS how to create a RESTFul Web Service in Java?
Unit 5 5 JAXB interview Questions & Answers
Unit 6 RESTful interview question on 12 rules to remember
Unit 7 REST constraints (i.e. design rules) interview Q&As
Unit 8 HATEOAS question on RESTful web service
Unit 9 HATEOAS RESTFul Service with Spring tutorial
Unit 10 11 SOAP web services interview Q&As
Unit 11 SOAP Web Service Styles Interview Q&As
Module 7 Java and Spring Microservices+
Unit 1 10+ Domain Driven Design (i.e. DDD) Interview Q&As
Unit 2 10+ Key Microservices Interview Questions Answered
Unit 3 7 Apache Kafka interview Q&As
Unit 4 DevOps, Kubernetes, Docker & Microservices Q&As
Module 8 Spring Core+
Unit 1 9 Spring framework overview interview Q&As
Unit 2 DIP, DI, Spring IoC and loose coupling in detail Q&As
Unit 3 4 Spring bean lifecycle interview Q&As
Unit 4 17 Spring bean scopes interview Q&As
Module 9 Spring MVC and Spring Boot+
Unit 1 11 Spring MVC interview Q&As
Unit 2 15 Spring boot Interview Q&As
Unit 3 Spring Cloud Microservices interview Q&As
Module 10 JPA and Hibernate+
Unit 1 8 JPA interview Q&As
Unit 2 8 Hibernate basics interview Q&As
Unit 3 8 Hibernate object states, lazy loading & optimistic locking Q&As
Module 11 JDBC, Transaction Management & JTA+
Unit 1 5 JDBC overview interview Q&As
Unit 2 12 JDBC basics interview Q&As
Unit 3 9 Java Transaction Management interview Q&As
Unit 4 8 JTA interview Q&As
Module 12 JMS, JNDI, and JMX+
Unit 1 16 JMS interview Q&As
Unit 2 9 JNDI & LDAP interview Q&As
Unit 3 5 JMX and MBean interview Q&As
Module 13 Database & SQL+
Unit 1 15 Database interview Q&As
Unit 2 15 SQL interview Q&As
Unit 3 3 SQL subqueries interview Q&As
Module 14 Unix & Regex+
Unit 1 14 Unix interview Q&As
Unit 2 Power of regex for string manipulation
Unit 3 9 Regular expressions (aka regex) in Java interview Q&As
Module 15 JSON, XML & XSD+
Unit 1 17 XML interview Q&As
Unit 2 11 XSD interview Q&As
Unit 3 7 Processing XML in Java interview Q&As
Unit 4 5 JAXB interview Q&As
Unit 5 6 JSON interview Q&As
Unit 6 Processing JSON in Java
Module 16 UML & ERD+
Unit 1 12 UML interview Q&As
Unit 2 10 ERD (i.e. Entity-Relationship Diagrams) interview Q&As
Module 17 Maven & Git+
Unit 1 12 Maven build tool interview Q&As
Unit 2 7 Maven, Nexus, and other build tools Q&As
Unit 3 8 Git Source control system interview Q&As
Unit 4 6 Git Q&As on pull requests, rebasing, merging, etc
Module 18 JavaScript+
Unit 1 3 Java Vs. JavaScript interview Q&As
Unit 2 10 JavaScript Interview Q&As on variable scopes & context
Unit 3 10 JavaScript interview Q&As on functions, prototypes, “this” variable, binding, etc
Unit 4 10 JavaScript interview Q&As on functions
Unit 5 7 JavaScript interview Q&As on closures
Module 19 SDLC+
Unit 1 5 SDLC interview Q&As for Java developers
Unit 2 18 Agile development methodology interview Q&As
Unit 3 30+ SDLC activities performed by developers
Module 20 Enterprise Code Quality+
Unit 1 3 Ensuring code quality in Java applications Q&As
Unit 2 6 Unit testing Spring boot applications Q&As
Unit 3 4 Q&As on unit testing the DAO layer
Unit 4 Unit testing Spring controller
Unit 5 BDD development in Java
Module 21 Judging Experience+
Unit 1 3 How would you go about ..." Q&As to judge experience
Unit 2 11 In your Java experience, what are ... Q&As
Unit 3 7 Interview Q&As on debugging skills
Unit 4 18 Java scenarios based interview Q&As
Unit 5 9 SQL scenarios Q&As judge experience
Unit 6 How would you go about designing Java apps with UML diagrams?
Learn by categories on the go...
Learn by categories such as FAQs – Core Java, Key Area – Low Latency, Core Java – Java 8, JEE – Microservices, Big Data – NoSQL, Architecture – Distributed, Big Data – Spark, etc. Some posts belong to multiple categories.
Top