Book Image

Getting Started with Oracle WebLogic Server 12c: Developer's Guide

Book Image

Getting Started with Oracle WebLogic Server 12c: Developer's Guide

Overview of this book

Oracle WebLogic server has long been the most important, and most innovative, application server on the market. The updates in the 12c release have seen changes to the Java EE runtime and JDK version, providing developers and administrators more powerful and feature-packed functionalities. Getting Started with Oracle WebLogic Server 12c: Developer's Guide provides a practical, hands-on, introduction to the application server, helping beginners and intermediate users alike get up to speed with Java EE development, using the Oracle application server. Starting with an overview of the new features of JDK 7 and Java EE 6, Getting Started with Oracle WebLogic Server 12c quickly moves on to showing you how to set up a WebLogic development environment, by creating a domain and setting it up to deploy the application. Once set up, we then explain how to use the key components of WebLogic Server, showing you how to apply them using a sample application that is continually developed throughout the chapters. On the way, we'll also be exploring Java EE 6 features such as context injection, persistence layer and transactions. After the application has been built, you will then learn how to tune its performance with some expert WebLogic Server tips.
Table of Contents (18 chapters)
Getting Started with Oracle WebLogic Server 12c: Developer's Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Oracle WebLogic Server has been the most innovative and important application server in the market since its conception in 1995. In release 12c, which brings support for Java EE 6 platform and JDK 7, it provides developers and administrators several new and powerful functionalities along with long-awaited improvements to existing features.

With this book you will learn some of the basic WebLogic Server concepts such as domains, managed servers and node managers, and dive into more practical topics such as how to expose and consume web services and how to use and protect JMS queues, exploring Java EE 6 APIs and features such as context dependency injection (CDI), EJB 3.1, JPA 2.1, and others. This is done through an incremental development of a business case, building up a sample application with very detailed steps and screenshots, so readers can follow and apply them to real-world solutions.

What this book covers

Chapter 1, Overview of WebLogic Server 12c and Related Technologies, presents an overview of the latest Java Development Kit (JDK) 7 and Java EE 6 technologies, along with an introduction to the most relevant features of Oracle WebLogic 12c. It also positions WebLogic Server 12c in the Oracle Cloud Application Foundation (CAF) architecture.

Chapter 2, Setting Up the Environment, explains how to install and configure Oracle WebLogic Server and an IDE (Eclipse OEPE), setting them up to be able to develop and run the sample applications we will build throughout the book. We also set up a database (MySQL) and an LDAP Server (OpenLDAP).

Chapter 3, Java EE Basics – Persistence, Query, and Presentation, defines the business case used as a background to the technical features and implementation details that will be covered throughout the remaining chapters, giving an overview of some of the basic features of Java EE and WebLogic Server—how to create and use an optional package, the creation of a web application and a persistence layer project, including how to deploy and do sanity checks on them.

Chapter 4, Creating RESTful Services with JAX-RS, shows how to create and expose an Enterprise JavaBean as a RESTful web service through the usage of JAX-RS annotations, representing the business entities as JSON or XML instances leveraging JAXB parsing.

Chapter 5, Singleton Bean, Validations, and SOAP Web Services, explains the concepts of the validation framework, showing how to use the built-in rules and how to create custom validations. The chapter demonstrates how to persist an entity to the database and the transactional aspects involved in this operation. There is also the development of a JAX-WS service and an example of a Java EE singleton bean.

Chapter 6, Using Events, Interceptors, and Logging Service, shows how to use Java EE interceptors by creating a logging annotation that can be attached to classes or methods, how to publish and observe events by using CDI, how to create and use asynchronous methods on an EJB, and details about the logging services available in WebLogic Server.

Chapter 7, Remote Access with JMS, explains the different modes of remote connection presented by WebLogic Server, creating a standalone Java application to post messages to a JMS Queue and then enhancements to avoid problems when the server is down by keeping the message local using the SAF client.

Chapter 8, Adding Security, covers the basics of the Java EE Security model with step-by-step instructions on how to configure it on a WebLogic server, creating an authentication mechanism using LDAP, and integrating it on the sample application.

Chapter 9, Servlets, Composite Components, and WebSockets, shows how to create and apply reusable web components by applying JSF templates, how to create and test a WebSocket component, and includes a few tips about the new Servlet specification.

Chapter 10, Scaling Up the Application, explains how to create and configure a WebLogic Server cluster using a software load balancer to distribute requests among the servers, how to make session replication more scalable by using Coherence*Web, and how to use the WebLogic Singleton Service.

Chapter 11, Some WebLogic Internals, covers a few features brought by WebLogic Server and Java EE 6 that helps the development process by cutting deployment time, optimizing class redefinitions without the need to restart the whole application, finding classloader issues, and monitoring server resources in a simple way.

What you need for this book

The following are the software applications we will use to develop and test the sample applications of this book:

  • Oracle Java JDK Version 7u21 or newer

  • Oracle WebLogic Server Version 12.1.2

  • Oracle Enterprise Pack for Eclipse (OEPE) Version 12.1.2

  • MySQL server and client packages, Version 5.1 or newer

  • PrimeFaces Version 3.5

  • OpenLDAP Version 2.4.x

We need to run at least one instance of Oracle WebLogic Server, the development environment, Eclipse with OEPE (Oracle Eclipse Pack for Eclipse), MySQL server, and OpenLDAP. You may be able to run all this on a machine with 2 GB of RAM, but consider at least 4 GB to have a smoother experience.

Who this book is for

This book is intended for entry level and intermediate Java EE developers who want to learn how to develop for and use Oracle WebLogic Server by showing how to apply its concepts and features to a real-world scenario. The book is also intended for those who want to learn about the new features of 12c and Java EE 6 releases, and how those updates make things easier and more productive, both at design and runtime.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You can find the logging configuration file at $JAVA_HOME/jre/lib/logging.properties."

A block of code is set as follows:

package com.packt.store.log;

@Inherited
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface Log {
   @Nonbinding 
   LogLevel value() default LogLevel.FINEST;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

package com.packt.store.log;

@Inherited
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface Log {
   @Nonbinding 
   LogLevel value() default LogLevel.FINEST;
}

Any command-line input or output is written as follows:

/oracle/jdk1.7.0_21/bin/java/java -jar wls_121200.jar

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "By clicking on the Print button the selected reservation will be printed."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.