Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Java EE 8 Development with Eclipse
Java EE 8 Development with Eclipse

Java EE 8 Development with Eclipse: Develop, test, and troubleshoot Java Enterprise applications rapidly with Eclipse , Third Edition

eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Java EE 8 Development with Eclipse

Introducing JEE and Eclipse

Java Enterprise Edition (JEE, which was earlier called J2EE) has been around for many years now. It is a very robust platform for developing enterprise applications. J2EE was first released in 1999, but underwent major changes with the release of version 5 in 2006. Since version 5, it has been renamed Java Enterprise Edition (JEE). Recent versions of JEE have made developing a multi-tier distributed application a lot easier. J2EE had focused on core services and had left the tasks that made application development easier to external frameworks, for example, MVC and persistent frameworks. But JEE has brought many of these frameworks into the core services. Along with the support for annotations, these services simplify application development to a large extent.

Any runtime technology is not good without good development tools. The Integrated Development Environment (IDE) plays a major part in developing applications faster, and Eclipse provides just that for JEE. Not only do you get good code editing support in Eclipse, but you also get support for build, unit testing, version control, and many other tasks important in different phases of software application development.

In this chapter, we are going to cover the following topics:

  • Introduction to different technologies in JEE
  • Introduction to the Eclipse development environment
  • Installation and configuration of some of the frequently used software in this book, for example, JEE servers, Eclipse IDE, and MySQL Database Server

The goal of this book is to show how you can efficiently develop JEE applications using Eclipse by using many of its features during different phases of the application development. But first, here is a brief introduction to JEE and Eclipse.

In 2017, Oracle agreed to hand over control of Java EE to Eclipse Foundation. In April 2018, Eclipse Foundation renamed Java EE as Jakarta EE. You can find more information about Jakarta EE at https://jakarta.ee/. At the time of writing, the latest Java EE version is 8. But all future versions of Java EE will be called Jakarta EE.

JEE

JEE is a collection of many of the Java Community Process (https://www.jcp.org) programs. Currently, JEE is in Version 8. However, different specifications of JEE are at their own different versions.

JEE specifications can be broadly classified into the following groups:

  • Presentation layer
  • Business layer
  • Enterprise integration layer

Note that JEE specification does not necessarily classify APIs in the preceding broad groups, but such classification could help in better understanding the purpose of the different specifications and APIs in JEE.

Before we see APIs in each of these categories, let's understand a typical JEE web application flow, as shown in the following diagram, and where each of the preceding layers fits in:

Figure 1.1: A typical JEE web application flow

Requests start from the clients. A client can be any application requesting services from a remote application—for example, it could be the browser or a desktop application. The request is first received by the web server at the destination. Examples of web servers include Apache web server, IIS, and nginx. If it is a request for static content, then it is served by the web server(s). However, a dynamic request typically requires an application server to process. JEE servers are such application servers that handle dynamic requests. Most JEE specification APIs execute in the application server. Examples of JEE application servers are WebSphere, GlassFish, and WildFly.

Most non-trivial JEE applications access external systems, such as a database or Enterprise Integration Server (EIS), for accessing data and process it. A response is returned from the application server to the web server and then to the clients.

The following sections provide a brief description of each of the JEE specifications in different layers. We will see how to use these specifications and their APIs in more detail in subsequent chapters. However, note that the following is not the exhaustive list of all the specifications in JEE. We will see the most commonly used specifications here. For the exhaustive list, please visit http://www.oracle.com/technetwork/java/javaee/tech/index.html.

The presentation layer

JEE specifications or technologies in this layer receive requests from the web server and send back the response, typically in HTML format. However, it is also possible to return only data from the presentation layer, for example in JavaScript Object Notation (JSON) or eXtensible Markup Language (XML) format, which could be consumed by Asynchronous JavaScript and XML (AJAX) calls to update only part of the page, instead of rendering the entire HTML page. Classes in the presentation layer are mostly executed in the web container—it is a part of the application server that handles web requests. Tomcat is an example of a popular web container.

Now let's take a look at some of the specifications in this layer.

Java Servlets

Java Servlets are server-side modules, typically used to process requests and send back responses in web applications. Servlets are useful for handling requests that do not generate large HTML markup responses. They are typically used as controllers in Model View Controller (MVC) frameworks, for forwarding/redirecting requests, or for generating non-HTML responses, such as PDFs. To generate HTML response from the servlet, you need to embed HTML code (as a Java String) in Java code. Therefore, it is not the most convenient option for generating large HTML responses. JEE 8 contains servlet API 4.0.

JavaServer Pages

Like servlets, JavaServer Pages (JSPs) are also server-side modules used for processing web requests. JSPs are great for handling requests that generate large HTML markup responses. In JSP pages, Java code or JSP tags can be mixed with other HTML code, such as HTML tags, JavaScript, and CSS. Since Java code is embedded in the larger HTML code, it is easier (than servlets) to generate an HTML response from the JSP pages. JSP specification 2.3 is included in JEE 8.

JavaServer Faces

JavaServer Faces (JSFs) make creating a user interface on the server side modular by incorporating the MVC design pattern in its implementation. It also provides easy-to-use tags for common user interface controls that can save states across multiple request-response exchanges between client and server. For example, if you have a page that posts form data from a browser, you can have a JSF save that data in a Java bean so that it can be used subsequently in the response to the same or different request. JSFs also make it easier to handle UI events on the server side and specify page navigation in an application.

You write the JSF code in JSP, using custom JSP tags created for JSF. JavaServer Faces API 2.3 is part of JEE 8.

The business layer

The business layer is where you typically write code to handle the business logic of your application. Requests to this layer could come from the presentation layer, directly from the client application, or from the middle layer consisting of, but not limited to, web services. Classes in this layer are executed in the application container part of JEE server. GlassFish and WebSphere are examples of web container plus application container.

Let us take a tour of some of the specifications in this group.

Enterprise JavaBeans

Enterprise JavaBeans (EJBs) are the Java classes where you can write your business logic. Though it is not a strict requirement to use EJBs to write business logic, they do provide many of the services that are essential in enterprise applications. These services are security, transaction management, component lookup, object pooling, and so on.

You can have EJBs distributed across multiple servers and let the application container (also called the EJB container) take care of component lookup (searching component) and component pooling (useful for scalability). This can improve the scalability of the application.

EJBs are of two types:

  • Session beans: Session beans are called directly by clients or middle-tier objects
  • Message-driven beans: Message-driven beans are called in response to Java Messaging Service (JMS) events

JMS and message-driven beans can be used for handling asynchronous requests. In a typical asynchronous request processing scenario, the client puts a request in a messaging queue or a topic and does not wait for immediate response. An application on the server side gets the request message, either directly using JMS APIs or by using MDBs. It processes the request and may put the response in a different queue or topic, to which the client would listen and get the response.

Java EE 8 contains EJB specification 3.2 and JMS specification 2.0.

The enterprise integration layer

APIs in this layer are used for interacting with external (to the JEE application) systems in the enterprise. Most applications would need to access a database, and APIs to access that fall in this group.

Java Database Connectivity 

Java Database Connectivity (JDBC) is a specification to access a relational database in a common and consistent way. Using JDBC, you can execute SQL statements and get results on different databases using common APIs. A database-specific driver sits between the JDBC call and the database, and it translates JDBC calls to database-vendor-specific API calls. JDBC can be used in both the presentation and business layers directly, but it is recommended to separate the database calls from both the UI and the business code. Typically, this is done by creating Data Access Objects (DAOs) that encapsulate the logic to access the database. JDBC is actually a part of Java Standard Edition. Java SE 8 contains JDBC 4.2.

The Java Persistence API

One of the problems of using JDBC APIs directly is that you have to constantly map the data between Java objects and the data in columns or rows in the relational database. Frameworks such as Hibernate and Spring have made this process simpler by using a concept known as Object Relational Mapping (ORM). ORM is incorporated in JEE in the form of the Java Persistence API (JPA).

JPA gives you the flexibility to map objects to tables in the relational database and execute queries with or without using Structured Query Language (SQL). When used in the content of JPA, the query language is called Java Persistence Query Language. JPA specification 2.2 is a part of JEE8.

Java Connector Architecture

Java Connector Architecture (JCA) APIs can be used in JEE applications for communicating with enterprise integration systems (EISes), such as SAP, and Salesforce. Just like you have database drivers to broker communication between JDBC APIs and relational databases, you have JCA adapters between JCA calls and EISes. Most EIS applications now provide REST APIs, which are lightweight and easy to use, so REST could replace JCA in some cases. However, if you use JCA, you get transaction and pooling support from the JEE application server.

Web services

Web services are remote application components and expose self-contained APIs. Web services can be broadly classified based on following two standards:

  • Simple Object Access Protocol (SOAP)
  • Representational State Transfer (REST)

Web services can play a major role in integrating disparate applications, because they are standard-based and platform-independent.

JEE provides many specifications to simplify development and consumption of both types of web services, for example, JAX-WS (Java API for XML—web services) and JAX-RS (Java API for RESTful web services).

The preceding are just some of the specifications that are part of JEE. There are many other independent specifications and many enabling specifications, such as dependency injection and concurrency utilities, which we will see in subsequent chapters.

Eclipse IDE

A good IDE is essential for better productivity while coding. Eclipse is one such IDE, which has great editor features and many integration points with JEE technologies. The primary purpose of this book is to show you how to develop JEE applications using Eclipse. So the following is a quick introduction to Eclipse, if you are not already familiar with it.

Eclipse is an open source IDE for developing applications in many different programming languages. It is quite popular for developing many different types of Java applications. Its architecture is pluggable—there is a core IDE component and many different plugins can be added to it. In fact, support for many languages is added as Eclipse plugins, including support for Java.

Along with editor support, Eclipse has plugins to interact with many of the external systems used during development. Examples include source control systems such as SVN and Git, build tools such as Apache Ant and Maven, file explorers for remote systems using FTP, managing servers such as Tomcat and GlassFish, database explorers, memory and CPU profilers. We will see many of these features in the subsequent chapters. The following screenshot shows the default view of Eclipse for JEE application development:

Figure 1.2: Default Eclipse view

When working with Eclipse, it is good to understand the following terms.

Workspace

The Eclipse workspace is a collection of projects, settings, and preferences. It is a folder where Eclipse stores this information. You must create a workspace to start using Eclipse. You can create multiple workspaces, but only one can be opened at a time by one running instance of Eclipse. However, you can launch multiple instances of Eclipse with different workspaces.

Plugin

Eclipse has pluggable architecture. Many of the features of Eclipse are implemented as plugins, for example, editor plugins for Java and many other languages, plugins for SVN and Git, and many more. The default installation of Eclipse comes with many built-in plugins and you can add more plugins for the features you want later.

Editors and views

Most windows in Eclipse can be classified either as an editor or a view. An editor is something where you can change the information displayed in it. A view just displays the information and does not allow you to change it. An example of an editor is the Java editor where you write code. An example of a view is the outline view that displays the hierarchical structure of the code you are editing (in the case of a Java editor, it shows classes and methods in the file being edited).

To see all views in a given Eclipse installation, open the Window | Show View | Other menu:

Figure 1.3: Show all Eclipse views

Perspective

Perspective is a collection of editors and views, and how they are laid out or arranged in the main Eclipse window. At different stages of development, you need different views to be displayed. For example, when you are editing the code, you need to see Project Explorer and Task views, but when you are debugging an application, you don't need those views, but instead want to see variable and breakpoint views. So, the editing perspective displays, among other views and editors, Project Explorer and Task views, and the Debug perspective displays views and editors relevant to the debugging activities. You can change the default perspectives to suit your purposes.

Eclipse preferences

The Eclipse Preferences window (Figure 1.4) is where you customize many plugins/features. Preferences are available from the Window menu in the Windows and Linux installations of Eclipse, and from the Eclipse menu in Mac:

Figure 1.4: Eclipse preferences

Installing products

In the subsequent chapters, we will learn how to develop JEE applications in Eclipse. But the applications are going to need a JEE application server and a database. We are going to use the Tomcat web container in the initial few chapters and then use the GlassFish JEE application server. We are going to use a MySQL database.

We are going to need these products for many of the applications that we are going to develop. So the following sections describe how to install and configure Eclipse, Tomcat, GlassFish, and MySQL.

Installing Eclipse

Download the latest version of Eclipse from https://eclipse.org/downloads/. You will see many different packages for Eclipse. Make sure you install the Eclipse IDE for Java EE Developers package. Select an appropriate package based on your OS and JVM architecture (32 or 64 bit). You may want to run the command java -version to know whether the JVM is 32-bit or 64-bit.

If you plan to use Eclipse for AWS development, then it is recommended to download Eclipse from the Oomph installer. Refer to https://wiki.eclipse.org/Eclipse_Installer and https://docs.aws.amazon.com/toolkit-for-eclipse/v1/user-guide/setup-install.html.

Unzip the downloaded ZIP file and then run the Eclipse application (you must install JDK before you run Eclipse). The first time you run Eclipse, you will be asked to specify a workspace. Create a new folder in your filesystem and select that as the initial workspace folder. If you intend to use the same folder for the workspace on every launch of Eclipse, then check the Use this as the default and do not ask again checkbox:

Figure 1.5: Select Eclipse workspace

You will then see the default Java EE perspective of Eclipse as shown in Figure 1.2.

Installing the Tomcat server

Tomcat is a web container. It supports APIs in the presentation layer described earlier. In addition, it supports JDBC and JPA. It is easy to configure and could be a good option if you do not want to use EJBs.

Download the latest version of Tomcat from http://tomcat.apache.org/. Unzip the downloaded file in a folder. Set the JAVA_HOME environment variable to point to the folder where JDK is installed (the folder path should be the JDK folder, which has bin as one of the subfolders). To start the server, run startup.bat in Command Prompt on Windows and startup.sh in a Terminal window on Mac and Linux. If there are no errors, then you should see the message Server startup in --ms or Tomcat started.

The default Tomcat installation is configured to use port 8080. If you want to change the port, open server.xml under the conf folder and look for a connector declaration such as the following:

<Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" /> 

Change the port value to any port number you want, though in this book we will be using the default port 8080. Before we open the default page of Tomcat, we will add a user for administration of the Tomcat server. Open tomcat-users.xml under the conf folder using any text editor. At the end of the file, you will see commented example of how to add users. Add the following configuration before the closure of </tomcat-users> tag:

  <role rolename="manager-gui"/> 
  <user username="admin" password="admin" roles="manager-gui"/> 

Here, we are adding a user admin, with password also as admin, to a role called manager-gui. This role has access to web pages for managing an application in Tomcat. This and other security roles are defined in web.xml of the manager application. You can find it at webapps/manager/WEB-INF/web.xml.


For more information for managing Tomcat server, refer to http://tomcat.apache.org/tomcat-8.0-doc/manager-howto.html.

After making the preceding changes, open a web browser and browse to http://localhost:8080 (modify the port number if you have changed the default port). You will see the following default Tomcat page:

Figure 1.6: The default Tomcat web application

Click on the Manager App button on the right. You will be asked for the username and password. Enter the username and password you configured in tomcat-users.xml for manager-gui, as described earlier. After you are successfully logged in, you will see the Tomcat Web Application Manager page, as shown in Figure 1.7. You can see all the applications deployed in Tomcat in this page. You can also deploy your applications from this page:

Figure 1.7: Tomcat Web Application Manager

To stop the Tomcat server, press Ctrl/cmd + C or run the shutdown script in the bin folder.

Installing the GlassFish server

Download GlassFish from https://glassfish.java.net/download.html. GlassFish comes in two flavors: Web Profile and Full Platform. Web Profile is like Tomcat, which does not include EJB support. So download the Full Platform.

Unzip the downloaded file in a folder. The default port of the GlassFish server is 8080. If you want to change that, open glassfish/domains/domain1/config/domain.xml in a text editor (you could open it in Eclipse too, using the File | Open File menu option) and look for 8080. You should see it in one of the <network-listener>. Change the port if you want to (which may be the case if some other application is already using that port).

To start the server, run the startserv script (.bat or .sh depending on the OS you use). Once the server has started, open a web browser and browse to http://localhost:8080. You should see a page like the following:

Figure 1.8: The default Glassfish web application

This page is located at glassfish/domains/domain1/docroot/index.html. Click on the go to the Administration Console link in the page to open the GlassFish administrator (see the following screenshot):

Figure 1.9: The Glassfish administrator

For details on administrating the GlassFish server, refer to 
https://javaee.github.io/glassfish/doc/5.0/administration-guide.pdf.

To stop the GlassFish Server, run the stopserv script in the glassfish/bin folder.

Installing MySQL

We will be using a MySQL database for many of the examples in this book. The following sections describe how to install and configure MySQL for different platforms.

We would like to install MySQL Workbench too, which is a client application to manage MySQL Server. Download MySQL Workbench from https://dev.mysql.com/downloads/workbench/.

Installing MySQL on Windows

Download MySQL Community Server from http://dev.mysql.com/downloads/mysql/. You can either download the web installer or the all-in-one installer. The web installer would download only those components that you have selected. The following instructions show the download options using the web installer.

The web installer first downloads a small application, and it gives you options to select the components that you want to install:

  1. Select the Custom option and click on Next:
Figure 1.10: MySQL Installer for Windows
  1. Select the MySQL Server and MySQL Workbench products and complete the installation. During the installation of the server, you will be asked to set the root password and given the option to add more users. It is always a good idea to add a user other than root for applications to use:
Figure 1.11: Select MySQL products and features to Install
  1. Make sure you select All Hosts when adding a user so that you are able to access MySQL database from any remote machine that has network access to the machine where MySQL is installed:
Figure 1.12: Add MySQL user
  1. Run MySQL Workbench after installation. You will find that the default connection to the local MySQL instance is already created for you:
Figure 1.13: MySQL Workbench connections
  1. Click on the local connection and you will be asked to enter the root password. Enter the root password that you typed during the installation of MySQL Server. MySQL Workbench opens and displays the default test schema:
Figure 1.14: My SQL Workbench

Installing MySQL on macOS X

OS X versions before 10.7 had MySQL Server installed by default. If you are using OS X 10.7 or later, then you will need to download and install MySQL Community Server from http://dev.mysql.com/downloads/mysql/.

There are many different ways to install MySQL on OS X. See http://dev.mysql.com/doc/refman/5.7/en/osx-installation.html for installation instructions for OS X. Note that users on OS X should have administrator privileges to install MySQL Server.

Once you install the server, you can start it either from Command Prompt or from the system preferences:

  1. To start it from Command Prompt, execute the following command in the Terminal:
sudo /usr/local/mysql/support-files/mysql.server start  
  1. To start it from System Preferences, open the preferences and click the MySQL icon:
Figure 1.15: MySQL System Preferences - OS X
  1. Click the Start MySQL Server button.

Installing MySQL on Linux

Creating MySQL users

You can create MySQL users either from Command Prompt or by using MySQL Workbench:

  1. To execute SQL and other commands from Command Prompt, open the Terminal and type the following command:
mysql -u root -p<root_password> 
  1. Once logged in successfully, you will see the mysql Command Prompt:
mysql>  
  1. To create a user, first select the mysql database:
mysql>use mysql;
Database changed
mysql>create user 'user1'@'%' identified by 'user1_pass';  
mysql>grant all privileges on *.* to 'user1'@'%' with grant option

The preceding command will create a user named 'user1' with password 'user1_pass' having all privileges, for example to insert, update, and select from the database. And because we have specified the host as '%', this user can access the server from any host.


See https://dev.mysql.com/doc/refman/5.7/en/adding-users.html for more details on adding users to MySQL database

If you prefer a graphical user interface (GUI) to manage the users, then run MySQL Workbench, connect to the local MySQL server (see Figure 1.13 MySQL Workbench connections), and then click on Users and Privileges under the Management section:

Figure 1.16: Creating a user in MySQL Workbench

Having installed all the preceding products, you should be in a position to start developing JEE applications. We may need some additional software, but we will see how to install and configure it at the appropriate time.

Summary

In this chapter, we had a brief introduction to different JEE specifications for the presentation layer, business layer, and enterprise integration layer. We learned some of the important terminologies in Eclipse IDE. We then learned how to install Eclipse, Tomcat, Glassfish, MySQL, and MySQL Workbench. We are going to use these products in this book to develop JEE applications.

In the next chapter, we will configure the JEE server and create a simple application using servlets, JSPs, and JSFs. We will also learn how to use Maven to build and package the JEE applications.

Left arrow icon Right arrow icon

Key benefits

  • •Explore the complete workflow of developing enterprise Java applications
  • •Develop microservices with Docker Container and deploy it in cloud
  • •Simplify Java EE application development

Description

Java EE is one of the most popular tools for enterprise application design and development. With recent changes to Java EE 8 specifications, Java EE application development has become a lot simpler with the new specifications, some of which compete with the existing specifications. This guide provides a complete overview of developing highly performant, robust and secure enterprise applications with Java EE with Eclipse. The book begins by exploring different Java EE technologies and how to use them (JSP, JSF, JPA, JDBC, EJB, and more), along with suitable technologies for different scenarios. You will learn how to set up the development environment for Java EE applications and understand Java EE specifications in detail, with an emphasis on examples. The book takes you through deployment of an application in Tomcat, GlassFish Servers, and also in the cloud. It goes beyond the basics and covers topics like debugging, testing, deployment, and securing your Java EE applications. You'll also get to know techniques to develop cloud-ready microservices in Java EE.

Who is this book for?

If you are a Java developer with little or no experience in Java EE application development, or if you have experience in Java EE technology but are looking for tips to simplify and accelerate your development process, then this book is for you.

What you will learn

  • •Set up Eclipse, Tomcat, and Glassfish servers for Java EE application development
  • •Use JSP, Servlet, JSF, and EJBs to create a user interface and write business logic
  • •Create Java EE database applications using JDBC and JPA
  • •Handle asynchronous messages using MDBs for better scalability
  • •Deploy and debug Java EE applications and create SOAP and REST web services
  • •Write unit tests and calculate code coverage
  • •Use Eclipse MAT (Memory Analysis Tool) to debug memory issues
  • •Create and deploy microservices
Estimated delivery fee Deliver to Romania

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 29, 2018
Length: 596 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788833776
Vendor :
Oracle
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Romania

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Publication date : Jun 29, 2018
Length: 596 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788833776
Vendor :
Oracle
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 103.97
Java EE 8 Design Patterns and Best Practices
€36.99
Java EE 8 Development with Eclipse
€41.99
Building RESTful Web Services with Java EE 8
€24.99
Total 103.97 Stars icon
Banner background image

Table of Contents

15 Chapters
Introducing JEE and Eclipse Chevron down icon Chevron up icon
Creating a Simple JEE Web Application Chevron down icon Chevron up icon
Source Control Management in Eclipse Chevron down icon Chevron up icon
Creating JEE Database Applications Chevron down icon Chevron up icon
Unit Testing Chevron down icon Chevron up icon
Debugging the JEE Application Chevron down icon Chevron up icon
Creating JEE Applications with EJB Chevron down icon Chevron up icon
Creating Web Applications with Spring MVC Chevron down icon Chevron up icon
Creating Web Services Chevron down icon Chevron up icon
Asynchronous Programming with JMS Chevron down icon Chevron up icon
Java CPU Profiling and Memory Tracking Chevron down icon Chevron up icon
Microservices Chevron down icon Chevron up icon
Deploying JEE Applications in the Cloud Chevron down icon Chevron up icon
Securing JEE Applications Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(1 Ratings)
5 star 0%
4 star 0%
3 star 100%
2 star 0%
1 star 0%
Original Elvis Nov 28, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
The prerequisites for Java EE 8 Development with Eclipse are basic knowledge of the Java language and object-oriented programming similar to what you'd have after working through Headfirst Java and Headfirst Object-Oriented Design. Rudimentary knowledge of your operating system and how environment variables are set is also necessary. Unix/GNU Linux based readers should understand Unix file permissions and how to create and add users to groups to solve any read/write problems they encounter. Introductory knowledge of HTML forms and GET/POST submissions to a web server is helpful.Java EE 8 Development with Eclipse was written for developers new to Java/Jarkarta Enterprise Edition, formerly known as J2EE. It provides specific examples, and walks the reader through them step-by-step. Exposition is kept to a minimum, but the author provides enough information for the reader to understand what they're working with and why they are inputting code; furthermore, the author points out when the examples deviate from actual production design patterns. The third edition of the book adds new chapters for microservices using Docker, deploying JEE applications in Amazon Web Services (AWS), and securing JEE Applications. Readers that complete the book will have the basics that they can use as a foundation for further supplemental learning. Many of the JEE technologies discussed have tutorials available online for free. Readers who prefer books should consider Java EE 7 The Big Picture (ISBN 978-0-07-183734-7) by Dr. Danny Coward for the historical architectural perspective of JEE and Java EE 8 Application Development (ISBN 978-1-78829-367-9) by David R. Heffelfinger for better coverage of JEE 8 written from a practicing programmer perspective (David Heffelfinger gets PUT vs. POST wrong in Chapter 10 by using PUT for new operations and POST for updates. He also uses tables for user input like logins instead of CSS.)Unfortunately, much of the text for Java EE 8 Development with Eclipse was carried over from second edition, which was written for Java 7, Apache Tomcat 7, and MySQL version 5. Java 8 deprecated managed beans in favor of context-dependency injection (CDI) beans; yet the author continues to use managed beans in the examples. The recommendation to use JDK 1.7 on page 3 in the Preface is a dead give-away to the book's older roots despite the cover claiming Java 8 support.Readers modernizing the sample applications to Java 8 and beyond with the latest jar files will encounter headaches that are just as instructional as the book itself. Apache Tomcat is a basic servlet and Java Server Page (JSP) web server. It requires additional Maven java jar files to support CDI beans and various java front-end technologies like Java Standard Template Language (JSTL) and Java Server Faces (JSF). The examples in the book are understandably missing some of the configuration steps when the reader updates to MySQL version 8, CDI beans, the latest jar files, and a 3rd party bean manager like JBOSS Weld. A lot of these configuration headaches could have been avoided if the author stuck to using Glassfish server throughout the book, or if he adopted Apache TomEE, which is Apache Tomcat updated for all the extra JEE components covered in the book. Readers substituting the book's Apache Tomcat server with something more modern should make liberal use of the <scope>provided</scope> attribute for their Maven dependencies.I was a bit disappointed with the database examples in Chapter 4. The author cleverly adds fields that accept null values to the examples - most notably the last name field, so celebrities like Sting or Cher could be instructors or students - but then leaves the update and delete steps for CRUD operations as an exercise for the reader. Since objects and text fields resolve to NULL by default, it makes a big difference when performing updates on records that accept null values verses those set to NOT NULL in the database. This was a great instructional opportunity that was completely missed in the book; but I give the author credit for including null fields, because most authors follow the happy path in their database designs.Eclipse in 2018 still has some annoying bugs and warnings that the author could have documented for new users. For example, many new projects will report themselves as Java SE 1.5 even though the JAVA_HOME environment variable is set. This causes Eclipse to display warnings about mismatched Dynamic Web and Java versions for Project Facets. The solution is to right-click the project, select Preferences and update the Java Build variable to 1.8 (the version used for the book), then go to Project Facets and change Dynamic Web to 4.0 and Java Version to 1.8. Sometimes the Properties UI dialog throws an exception, and when that happens, the user must go to the settings folder for their project in the Eclipse Workspace folder, open org.eclipse.wst.common.project.facet.core.xml, change the jst.web setting version from 2.3 to 4.0, and save the file. The java version can also be updated in the xml file if the user wants to bypass the Properties dialog UI entirely. Showing users how to eliminate some of Eclipse's bogus warnings while working on the exercises would definitely move the book towards a 5 star rating.Readers new to web development should also realize that many of the examples in the book render elements in tables, partly as a result of what the stock Java Server Faces (JSF) API renders as html output. It was the preferred approach when JSF was initially created in the aughts, but in 2018 outputting html for items that don't belong in tables - like a simple web login form - causes headaches for front-end web designers modifying the site with Cascading Style Sheets, mobile users, and visually impaired users using reader software. Keep this in mind as you transition from book exercies to actual production code.In conclusion, if you're new to JEE and willing to put in some effort correcting and updating the author's examples, this book is a good starting point because it offers step-by-step instructions. Working through the book's exercises meets its stated objectives of providing an overview of JEE technologies, hands-on experience with the Eclipse IDE, and an introduction to the Maven build system. If you don't have any interest in the Docker or AWS coverage, you can save yourself some money by buying the second edition of the book. I recommend pairing this book with David Heffelfingers Java EE 8 Application Development as a reference when replacing managed beans with CDI beans. 3/5 stars. The material is 4 star worthy, but I'm deducting a star for the coding errors, outdated APIs, minimal samples (no data validation or update/delete operations), and the use of an older version of MySQL.Check the comments section below where I correct most of the problems with the book. I submitted these notes to the publisher Packt as errata for their website, but they've been slow to post it. Thanks to Amazon comments, you can find the errata here.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela