Getting Started with Oracle WebLogic Server 12c - William Markito Oliveira - E-Book

Getting Started with Oracle WebLogic Server 12c E-Book

William Markito Oliveira

0,0
44,39 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

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.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 414

Veröffentlichungsjahr: 2013

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Getting Started with Oracle WebLogic Server 12c: Developer's Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Overview of WebLogic Server 12c and Related Technologies
Introducing Oracle WebLogic Server 12c
WebLogic Server @ Oracle
Most relevant features
Overview of JDK 7
The Project Coin
The diamond operator
The try-with-resources statement
Strings in switch statements
Manipulating binary integral literals
Exception handling with multicatch statements
Delving into Java EE 6
Other technologies in the book
Oracle Enterprise Pack for Eclipse
Oracle Coherence
PrimeFaces
MySQL
The Cloud Application Foundation (CAF)
Oracle Traffic Director
Oracle Tuxedo
Oracle Virtual Assembly Builder
Oracle Exalogic and WebLogic 12c
Web resources
Java and Java EE 6
WebLogic 12c
Coherence
Other tools
Summary
2. Setting Up the Environment
About the directory structure
Installing JDK 1.7
Installing Oracle WebLogic Server
Installing Oracle Enterprise Pack for Eclipse (OEPE)
Installing MySQL
Installing on Linux using a package manager
Downloading and installing manually
Disabling case sensitivity for tables on Unix/Linux
Some Windows specifics
Configuring MySQL databases
Preparing PrimeFaces
Downloading the binaries
Creating a shared library
Setting up a WebLogic domain
Configuring Eclipse and OEPE
Linking WebLogic's runtime environment
Adding a reference to the PrimeFaces' shared library
Linking WebLogic Server's instance
Referencing MySQL databases
Creating WebLogic data sources
Adding database connections to Eclipse
Using OpenLDAP
Installing OpenLDAP
Configuring an OpenLDAP server
Loading sample entries and testing
Web resources
Summary
3. Java EE Basics – Persistence, Query, and Presentation
The business scenario – movie ticket system
Business entities of the system
Organizing projects in Eclipse
Creating the StoreBO project
Generating classes from database tables
Creating named queries
Tweaking the persistence.xml file
Packing the project
The Store web project
Adding references to PrimeFaces' shared library
Adding references to StoreBO
Referencing the persistence configuration file
Creating a named bean
Configuring the Web descriptor
Defining the test page
Deploying and testing the application
Web resources
Summary
4. Creating RESTful Services with JAX-RS
Creating Theater entities
Customizing the generated entities
Creating named queries
Preventing cyclic references
Formatting exhibitions' date and time
Completing the persistence.xml file
Packaging the library
Creating the Theater web application
Setting up the project
Enabling JAX-RS
Exposing RESTful Services through JAX-RS
Coding the API
Testing the web service
Creating the REST client
Configuring JAX-RS client libraries and optional package
Creating the web service consumer
Updating the SearchManager bean
Updating the query page
Structuring the web application
Applying templates through Facelets
Creating an entity listing page
Web resources
Summary
5. Singleton Bean, Validations, and SOAP Web Services
Using bean validation
About built-in constraints
Combining and grouping validation rules
Creating a custom constraint
Coding a constraint validator
Showing validation messages
Using the message component
PrimeFaces's Growl
Dealing with null and empty strings on JSF components
Singleton session beans
Implementing a singleton session bean
Understanding how to use the startup annotation
Establishing a startup and shutdown sequence
Dealing with concurrency when using singletons
Singleton applied to web services
Persisting an object using JPA
Understanding the available transaction contexts
Using container-managed transactions
Using bean-managed transactions
Acquiring a transaction context manually
A brief intermission
Web services and SOAP
The reservation web service
Testing the service provider
Consuming the service
Web resources
Summary
6. Using Events, Interceptors, and Logging Services
Understanding interceptors
Creating a log interceptor
Interceptors and Aspect Oriented Programming
Using asynchronous methods
Understanding WebLogic's logging service
Anatomy of a log message
Redirecting standard output to a log file
Integrating Log4J to WebLogic's logging services
Accessing and reading log files
Events
Defining audit events
Web resources
Summary
7. Remote Access with JMS
WebLogic clients
Thin T3 client – wlthint3client.jar
RMI thin client – wlclient.jar
JMS thin client – wljmsclient.jar
JMS SAF client – wlsafclient.jar
JMS T3 SAF client – wlsaft3client.jar
Full client – wlfullclient.jar
JMX client – wljmxclient.jar
Java Messaging Service (JMS) and WebLogic
The persistent store
The JMS server
The JMS module
The JMS subdeployment
The JMS queue
The JMS connection factory
Posting messages from a standalone client
Creating the project
Coding the message producer
Queuing messages
Consuming messages with an MDB
Configuring thread limits for MDBs
The Store-and-Forward client feature
Creating the configuration file
Encrypting the connection password
Adjusting the configuration file
Adjusting the code
Testing the SAF client
Web resources
Summary
8. Adding Security
Exploring Java SE and Java EE security
WebLogic security
Authentication providers and security realms
Using an external LDAP server
Configuring an OpenLDAP authentication provider
Securing the web application
Modifying the web.xml descriptor file
Modifying the weblogic.xml descriptor file
Creating and mapping a global role
Creating the login form
Testing the login procedure
Protecting WebLogic resources
Signing up a user and OpenLDAP
Creating a user on the database
Publishing a customer to a JMS queue
Security policies for the JMS queue
Updating the login bean
From the JMS queue to the LDAP server
Creating the LDAP client
Creating the MDB
Testing LDAP user provisioning
Completing the application
Web resources
Summary
9. Servlets, Composite Components, and WebSockets
Overview of JavaServer Faces
Using composite components
Learning a few Servlet tricks
Deprecated features
Identifying the default name of a servlet
Asynchronous request processing
Creating dynamic components
Using WebSockets
Creating the server component
Testing the component
Using an encrypted connection
Web resources
Summary
10. Scaling Up the Application
Introducing the Node Manager
Defining machines
Using Cluster and Managed Servers
Creating a static cluster
Creating a dynamic cluster
Configuring a software load balancer
Creating a new Managed Server for load balancing
Enabling the load balancer
Retargeting applications and resources
Updating web.xml of clustered web applications
Retargeting auxiliary components
Making the application cluster friendly
Changing deployment target from Eclipse
Using a singleton service
Creating a singleton service
Adjusting the service client
Using Oracle Coherence
Replicating sessions with Coherence*Web
Creating a Coherence cluster
Enabling Coherence*Web storage
Adjusting the application to use the cache
Caching JPA objects with TopLink Grid
Web resources
Summary
11. Some WebLogic Internals
Understanding deployment structures
Packaging as an archived file
Using an exploded archive directory
Using a virtual application
Configuring the deployment model
Using FastSwap to reduce deployment time
Packaging modules into an application
Creating an application-scoped module
Restricting access to an application-scoped resource
Declaring data sources using annotations
Using the Classloader Analysis Tool (CAT)
Starting CAT
Finding potential conflicts
Using RESTful management services
Enabling the management service
Monitoring resources
Formatting the response
Web resources
Summary
Index

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

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

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: September 2013

Production Reference: 1190913

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-84968-696-9

www.packtpub.com

Cover Image by J.Blaminsky (<[email protected]>)

Credits

Authors

Fabio Mazanatti Nunes

William Markito Oliveira

Reviewers

Daniel Amadei

Vinicius Rodrigo dos Santos

Wickes Potgieter

Acquisition Editors

Edward Gordon

Julian Ursell

Lead Technical Editor

Mayur Hule

Technical Editors

Aparna K

Sharvari Baet

Kanhucharan Panda

Copy Editors

Tanvi Gaitonde

Aditya Nair

Alfida Paiva

Kirti Pai

Laxmi Subramanian

Project Coordinators

Arshad Sopariwala

Venitha Cutinho

Proofreaders

Amy Guest

Jonathan Todd

Indexers

Tejal R. Soni

Mariammal Chettiyar

Mehreen Deshmukh

Monica Ajmera Mehta

Graphics

Abhinash Sahu

Sheetal Aute

Production Coordinator

Prachali Bhiwandkar

Cover Work

Prachali Bhiwandkar

About the Authors

Fabio Mazanatti Nunes: With more than two decades of experience in system design and development, Fabio worked in a wide range of projects and architectures (mainframe, client-server, distributed architecture, and SOA) for large corporations in Brazil, and for the last dozen years, he specialized in the architecture and implementation of Java EE and SOA solutions, mainly using BEA and Oracle products. You can find more material related to these topics on his blog, http://mazanatti.info.

I'd like to thank my wife, Valesca, for her constant support and for keeping calm and distracting the little ones while I was focused on writing this book, my kids, Gabriela and Caio, for being such wonderful people and a joy in my life, and my parents, for always being there for us.

A great thank you to my friend and co-author, William, for not letting my acid comments corrode his will to get this book done and for being such a curious and committed individual, raising the bar for everyone who happen to work with him.

I'd also like to thank the technical reviewers of the book, especially my friends Vinicius Santos and Daniel Amadei for accepting this tricky task and for being such nice lads to work with.

Finally, I'd like to mention the honey badger as our role model for this project, because he just takes what he wants, and sometimes in life, that's what we should do—in a positive way, of course!

William Markito Oliveira has more than 15 years of experience in software development, including solution architecture and consulting. For the last few years, he had focused on Service Oriented Architecture (SOA) solutions, Enterprise Application Integration (EAI), and system optimization.

Currently, he is looking into cloud systems with specific focus on in-memory data grid and Java EE. He is also a member of the Java EE Tutorial documentation team, helping with write-ups and code examples about new Java EE technologies and can be reached at Twitter (@william_markito) or through his blog, http://blog.markito.info.

He has authored another book, The Java EE 6 Tutorial: Advanced Topics, Fourth Edition, Addison-Wesley Professional, 978-0-13708-186-8.

I'd like to thank my wife Rebeca, as she was always supportive and encouraged me several times during the writing, helping me by distracting our little man when he tried to type his own words for the book.

Antônio, my son, who also behaved and understood things beyond his age, by letting me write the book while watching Toy Story several times in a row. Love you both more than anything.

Also, a special mention to my family, especially my mother, father, and stepfather. Regina, Antônio, and Vanderlei, thank you for giving me the best and for always being supportive during my night hacks.

Thanks to the reviewers, who prevented us from publishing some silly errors and gave us great ideas on how to write things in a clear way, especially my friend and the best man, Daniel Amadei.

And of course, I'd like to thank the Honey Badger and Fabio, for always being so inspirational and hustler on the way we look at computers and programming in general.

About the Reviewers

Daniel Amadei is a Senior Principal Consultant working for Oracle Consulting Services in Brazil and has more than 10 years of experience in the IT market, being a specialized consultant and solutions architect for SOA and Enterprise Applications. He has strong analytical and problem-solving abilities with solid experience in the development and architecture of applications.

He is a specialist in SOA and EAI Oracle middleware products, web services and related technologies, and the Java Platform, especially Java EE. He has been working with Java since 1999, and SOA/EAI since 2007, and has, at the time of this book's writing, eight certifications related to his specialties, including Oracle Certified SOA Architect, Oracle SOA Foundation Practitioner, and Sun Certified Enterprise Architect for J2EE.

You can write to him at <[email protected]>, and read about his works at http://www.amadei.com.br.

I'd like to thank the authors for giving me the chance to learn a lot by reviewing the book.

Wickes Potgieter has worked as a product specialist for over 12 years. His main focus was on the BEA WebLogic suite of products, and after the Oracle acquisition of BEA Systems, he focused on the Oracle Fusion Middleware suite of products. His experience ranges from Solution Architecture, Infrastructure Design, administration, development, pre-sales, and training to performance tuning of the Oracle Fusion Middleware products, JVM, and custom applications. He specializes in Oracle WebLogic Server, JRockit, Service Bus, SOA, AIA, BPM, BAM, Enterprise Manager 11g/12c, WebCenter, Identity & Access Management, and Application Performance Management.

They have formed a specialized consulting company in 2003 with offices in the United Kingdom and South Africa, covering customers in the EMEA region. They are in partnership with Oracle Gold and have a team of specialized Oracle Fusion Middleware consultants servicing customers both onsite and offsite.

The website of TSI-Systems is www.tsisystems.co.uk, and Wickes can be contacted on <[email protected]>.

I would like to thank my wife Mary Jane for her patience and for assisting me through all the late nights. Thank you to all my friends and family for constant encouragement.

Vinícius Rodrigo dos Santos has been working on software development since 1999 on high school projects and has developed his career focusing on middleware and EAI ever since.

He has worked for companies as a Software Engineer in South America and North America, creating and maintaining critical systems that served clients around the world.

After dedicating the last 5 years almost exclusively to SOA, he is now focused on multiplatform mobile development and cloud computing solutions.

The solutions he has worked with have served companies mainly focused on Vehicle Engineering, Home Broker, Telecommunications, and the Government.

He now owns a startup named IstyaTech ( http://www.istya.net ) in Brazil that serves customers on mobile and cloud computing solutions.

I would like to thank my parents, my mother Elisabete Brito dos Santos and my father Raimundo Nonato dos Santos, for giving me support in my young years so I could one day participate in a project as satisfying as this one. Of course my special thanks goes to my loving wife Cristiane Danna who has given me strength to carry on; I love you.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. 

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Instant Updates on New Packt Books

Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.

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 newerOracle WebLogic Server Version 12.1.2Oracle Enterprise Pack for Eclipse (OEPE) Version 12.1.2MySQL server and client packages, Version 5.1 or newerPrimeFaces Version 3.5OpenLDAP 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 <[email protected]>, 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 erratasubmissionform 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 <[email protected]> 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 <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Overview of WebLogic Server 12c and Related Technologies

In this chapter, we're going to see some basic information about the subject of this book, including:

A brief history of Oracle WebLogic ServerThe most significant additions to Java SE Version 7New features of Java EE 6, the specification implemented by the WebLogic ServerThe improvements added to Version 12.1.2, the latest release of the product

Before we get into the new features of Oracle WebLogic Server 12c, let's do a quick recap on how it all started.

Introducing Oracle WebLogic Server 12c

In a very brief history of WebLogic, we must remember that it came to Oracle through the acquisition of BEA (Bill, Edward, Alfred). Although the name WebLogic is widely associated with BEA, they didn't create the product.

In fact, WebLogic itself was a company formed in 1995 (same year as BEA) that created a middle-tier server to enhance communication between applets and servers providing implementations for SNMP, JDBC drivers, and ping. This server was named Tengah but also had a codename, T3Server (the three-tier server) and used a custom proprietary network protocol called T3. This server later evolved to be a Java application server as we know today and right after BEA acquired WebLogic (the company) in 1998, Tengah was officially renamed to WebLogic (Version 4.5). Later, BEA acquired a high performance JVM (BEA JRockit, now Oracle JRockit) that was certified against WebLogic and received various performance awards.

The last BEA release of WebLogic Server was Version 10.0, a full Java EE 5 application server.

WebLogic Server @ Oracle

After BEA's acquisition in 2008, Oracle announced WebLogic as the strategic application server to replace Oracle Application Server (OC4J), and it also became the foundation for Oracle Fusion Middleware and Oracle Fusion Applications, the main families of Oracle products.

The first release under Oracle's brand was WebLogic Server 10gR3 (10.3.0), soon followed by Version 11g. Here's a figure showing all 11g and 12c releases till now:

The focus of this book is WebLogic Sever 12c, which is approximately the eighth release by Oracle and has lots of new and improved features, as shown in the next section.

Most relevant features

Here is a list of the most important features of Oracle WebLogic Server 12c Version 12.1.2, the most current version and the focus of this book:

Full Java EE 6 support: WebLogic 12c is the first release to implement Java EE 6 specification, delivering all its features. The next section of this chapter is going to explain new and relevant additions to Java EE 6.Certified with JDK 6 and JDK 7: Through the use of JDK 7, developers can leverage all language optimizations available in the new version of the JDK, including features already converged from JRockit—the proprietary JDK that came from BEA.JDBC Store for JTA logs: WebLogic supports JDBC Store to persist transaction logs (TLOGs) in a database, and leverages replication and high availability on the underlying database. It also simplifies disaster recovery since the synchronization happens at the database level.Built-in Classloader Analysis Tool (CAT): WebLogic CAT is a web-based application that can filter the different classloaders available (JVM, application server, applications) showing the classes loaded by each one of them. This functionality enables the analysis of common classloader issues such as conflicts. The tool even offers suggestions on how to fix problems.Coherence 12.1.2: This release includes support for Coherence Servers Management through WebLogic Management Framework, including security and application deployment through GAR (Grid Archive) files. It offers asynchronous backup, multiple Coherence REST applications, integration with Oracle Universal Installer, and support for ECID (Execution Context ID) for correlation with Oracle Fusion Middleware. Other than these, it still offers WebLogic integration for HTTP session management (Coherence*Web) and Oracle TopLink Grid as a JPA mechanism.Glassfish to WebLogic deployment descriptor support: WebLogic offers support for Glassfish deployment descriptors so you can seamlessly deploy web applications written for Glassfish Server on WebLogic Server.Enhanced WebLogic Maven support: In this release, one of the most important changes is that it's not required to generate the WebLogic Maven plugin anymore; there is now a bundled version under /wlserver/server/lib/. Also, several new tasks were added to the plugin, including support for server installation from zip files, domain creation, start/stop servers, and execution of inline WLST scripts.WebSockets support: The newest release 12.1.2, brings support for the WebSocket protocol, which provides two-way and full-duplex communication over a single TCP connection between clients and the server. With this, we can open a direct connection between a browser and the server, receiving and sending information in an asynchronous way, opening possibilities to create Rich Internet Applications (RIA).OSGi bundles: The OSGi architecture is now available as a WebLogic feature, providing us a way to create a set of configurations to define our own modules and use its API to, for instance, start and stop modules and acquire data sources. The implementation that comes with WebLogic Server is Apache Felix 4.0.3.Server templates and dynamic servers/clusters: To make Oracle's Cloud Application Foundation more flexible, Version 12.1.2 of WebLogic Server introduced these concepts that basically give us an easy way to scale up a WebLogic domain. Up to this version, we had to manually create and configure managed servers to distribute workload; now, we create a server template once, setting up a few basic points of information such as name prefix, and create a dynamic cluster based on this template. When the workload reaches a peak, we just instruct the environment to fire up additional servers based on these configurations, and it's done. It's quick and easy.Dynamic clustered JMS Servers: Another improvement that involves ease of configuration when dealing with dynamic clusters is that now a JMS Server—the component used to deploy JMS resources such as queues and topics to a server—can be targeted to a WebLogic cluster. Previous versions only accepted a managed server as a target for such components, and now management and migration tasks are a lot easier to perform.

Delving into Java EE 6

This topic deserves special attention because of the huge impact Java EE 6 made into the way we develop enterprise Java applications by adding new, powerful technologies and features to its specification. Several topics are mentioned here, and most of them will be demonstrated throughout the next chapters:

Java API for RESTful Web Services (JAX-RS, JSR 311): This enables lightweight web services' development following the Representational State Transfer (REST) architectural paradigm. The concept of manipulating resources through different networks using a standard protocol such as HTTP, is a growing paradigm and an alternative to the traditional SOAP-based services.Context and Dependency Injection for Java EE Platform (CDI, JSR 299): This provides a built-in dependency injection mechanism for Java EE that offers a set of services that bind several components (for example, EJB and JSF Managed Beans) to lifecycle contexts. Another facility provided by CDI is a loosely coupled event mechanism that works with annotation and simple POJOs (Plain Old Java Object). In a nutshell, the main objective of CDI is to create a unified programming model for EJB and JSF while keeping other important services (transactions, for instance) available to all Java EE tiers.Bean validation (JSR 303): Developers tend to validate objects in many layers. Sometimes they generate duplicated code and may even forget to replicate a validation logic to one of the layers, which can lead to catastrophic consequences. To solve such problems, the bean validation framework provides a standard set of validation rules that can be shared by all layers; so the same rule can be applied to the user interface (through JSF and managed beans) and more internal tiers (attached to JPA, for instance), avoiding duplicated code.Enterprise JavaBeans 3.1: In this update of the EJB specification, the main focus was to make it simple and easy to use. The most noticeable change is that EJBs now can be packaged in WAR files, removing the need to produce specific packages for EJBs and combine them in an EAR file. But other important features were added, such as the following:
Singleton beans: These are the EJBs that can primarily be shared and support concurrent access, with the guarantee that the container will have only a single instance per JVMEmbeddable API for Java SE: With some limitations, it runs client code and EJB instances in the same JVM on SE environments using an embeddable containerEJB Lite: Since Java EE 6 has the concept of profiles, specific vendors can choose to implement the full container or the Lite version with a subset of EJB API
Servlet 3.0: Servlets are one of the main components of Java EE since its initial release, but few changes were made to its specification since then, except for adding filters and web application events. Servlet 3.0 adds important changes into the API such as the following:
Support for annotations: It's now possible to declare a servlet by just adding an annotation (@WebServlet) to a Java class. There are also annotation for filters, listeners, and parameters.Asynchronous processing: Servlets now allow asynchronous method calls. This feature helps applications to scale up, since it releases the caller while the processing is done by the server, allowing other requests to be accepted by the released thread.
Java Persistence API 2.0: JPA 2.0 has some major enhancements over the previous version. These new features include new annotations for mappings, enhancements to Java Persistence Query Language (JPQL), typed queries, shared cache, integration with bean validation, and probably the most powerful feature, Criteria API for dynamic strongly-typed query creation.Java Server Faces 2.0: JSF 2.0 brings some important features long awaited by the community such as official integration with Facelets (an XML-based view declaration language), more options for error handling, better integration with Ajax, and many more. In this release, there is a new concept of resourceand how you can integrate the different kinds (stylesheets, images, and JavaScript files). Componentization and composites form the main theme, with an easy API that supports the creation of UI components for reuse.

Note

Under the topic of Java EE 6, we could list and discuss several updates and enhancements in other areas, but that would be out of the scope of this book. We'll be showing examples on most of what we have seen here during the construction of case studies and the main application that will be built along with the book.

Other technologies in the book

To be able to develop the application throughout this book, other products and technologies will be used. A few of them are discussed in the following sections.

Oracle Enterprise Pack for Eclipse

Oracle Enterprise Pack for Eclipse (OEPE) is a set of plugins for the Eclipse IDE that enables Java EE application development and leverages the toolset of Oracle specific technologies for Oracle Fusion Middleware.

The following is a list of key features that OEPE supports:

Oracle WebLogic Server (including WLST, SCA, and shared libraries)Oracle CloudOracle DatabaseObject Relational Mapping (ORM)Spring 3.2 integrationOracle Coherence

Oracle Coherence

Coherence provides a replicated and distributed data management and caching services, on top of a peer-to-peer clustering protocol, shared across multiple servers but with very high throughput, low response times, and predictable scalability.

In this book we're going to show examples of Coherence*Web, which is an HTTP session management module dedicated to managing the session state in clustered environments. This module integrates with WebLogic Server and provides a pluggable mechanism to scale up Java EE applications, having the benefit of not requiring any application instrumentation or changes to be activated.

PrimeFaces

PrimeFaces is a popular, free, and open source JSF component suite that provides several extensions and has a rich set of components, including an HTML editor and animated charts. It's very lightweight (only one jar, less than 2 MB) with no required dependencies other than JSF itself, making it a breeze to use and create Java EE web user interfaces.

MySQL

Since the very early years of the Web, MySQL empowers millions of websites and systems worldwide, being considered the world's most used open source database. It is a relational database system and supports many high profile products such as Wikipedia, Google, Twitter, Facebook, and YouTube.

MySQL offers a huge and rich set of features, but one of the most important features is the cross-platform support. So you can run the same product on Microsoft Windows, GNU/Linux, FreeBSD, or even Apple's OS X.

The Cloud Application Foundation (CAF)

WebLogic Server is part of Oracle Cloud Application Foundation (CAF), which is defined as a superset of products provided by Oracle that enable the infrastructure for building cloud environments for private or public clouds, hosting end-user applications.

Here's a graphical representation of the CAF stack, followed by a description of each component:

Oracle Traffic Director

Oracle Traffic Director is a high-speed, layer-7 (the application layer of the OSI Model) load balancer that can be set as the main entry point for HTTP and HTTPS traffic for large volumes, low latency, and mission-critical systems. It is optimized for Oracle Exalogic Elastic Cloud and leverages InfiniBand fabric for more throughput.

It can be configured to do traffic routing and to offload SSL/TLS, acting as the termination point for HTTPS requests, reducing the overhead of security processing on the application server. Also, it can improve performance for clients through content caching and reducing impact on the backend servers.

Oracle Tuxedo

Oracle Tuxedo runs mission-critical C/C++/COBOL applications in x86 servers or cloud environments, with ultra-high performance and linear scalability. It provides service-oriented infrastructure to manage distributed transaction processing, tracking participants, and monitoring XA two-phase commit, thus, ensuring that transactions are all committed or rolled back properly.

Oracle Virtual Assembly Builder

Oracle Virtual Assembly Builder provides an easy way for system administrators to configure new environments of multitier applications in cloud and virtualized environments. It allows drawing blueprint diagrams of the application topology and wire logical connections between the different appliances that compose the architecture.

Oracle Exalogic and WebLogic 12c

Oracle Exalogic is an engineered system, which means that it provides the best-of-breed components (storage, compute nodes, network, operating system, and software products) that are tested, tuned, and optimized to deliver extremely high performance. It can be considered as the evolution of Oracle Grid architecture as it moves into a concept of a Private Cloud in a Box platform, ideal for consolidation of mission-critical and cloud systems.

WebLogic 12c is fully supported on Oracle Exalogic and has many enhancements that can be enabled through WebLogic's Administration Console. These enhancements leverage the Exalogic architecture and tune WebLogic Server to perform using the benefits of SDP API, for example.

Tip

SDP or Socket Direct Protocol is a low-level network technology that provides higher throughput. It is supported by JDK 7 and can be used for inter-process communication in WebLogic.

Other major features that can be enabled for Exalogic are as follows:

Scattered reads and gathered writes: This feature allows us to increase the efficiency during I/O in environments with high network throughputLazy deserialization: This feature allows us to increase efficiency for session replicationSelf-tuning thread pool optimization: This feature allows us to increase efficiency of the self-tuning thread pool by aligning it with the Exalogic processor architecture threading capabilities

This book will not discuss WebLogic 12c features that are specific to Exalogic systems, but it is important to know what can be accomplished through the use of Oracle-engineered systems.

Web resources

For further reading about the topics discussed in this chapter, here is a list of links with documentation or tutorials freely available on the Internet.

Java and Java EE 6

Your First Cup: An Introduction to the Java EE Platform
http://docs.oracle.com/javaee/6/firstcup/doc/
The Java EE 6 Tutorial
http://docs.oracle.com/javaee/6/tutorial/doc/
Java API docs
http://docs.oracle.com/javaee/6/api/
Java EE 6 Specification
http://www.jcp.org/en/jsr/detail?id=316
Java SE 7 Specification
http://download.oracle.com/otndocs/jcp/java_se-7-final-eval-spec/index.html
Support for Dynamically Typed Languages Specification
http://www.jcp.org/en/jsr/detail?id=292
Class file Specification
http://www.jcp.org/en/jsr/detail?id=202
Concurrency Utilities Specification
http://www.jcp.org/en/jsr/detail?id=166
More New I/O APIs Specification
http://www.jcp.org/en/jsr/detail?id=203
JAXB 2.0 Specification
http://www.jcp.org/en/jsr/detail?id=222
JAX-WS 2.0 Specification
http://www.jcp.org/en/jsr/detail?id=224
JAX-RS Specification
http://www.jcp.org/en/jsr/detail?id=311
JSR 206: JavaTM API for XML Processing (JAXP) 1.3
http://www.jcp.org/en/jsr/detail?id=206
Context and Dependency Injection Specification
http://www.jcp.org/en/jsr/detail?id=299
Bean Validation Specification
http://www.jcp.org/en/jsr/detail?id=303
The WebSocket Protocol
http://tools.ietf.org/html/rfc6455
Code Samples
http://www.oracle.com/technetwork/java/javaee/documentation/code-139018.html

WebLogic 12c

Documentation
http://docs.oracle.com/middleware/1212/wls/index.html
Developing applications
http://docs.oracle.com/middleware/1212/wls/wls-developdeploy.htm
What's new
http://docs.oracle.com/middleware/1212/wls/NOTES/index.html#NOTES254
YouTube channel
http://www.youtube.com/user/OracleWebLogic
WebLogic Server community
http://www.oracle.com/technetwork/middleware/weblogic/community/index.html
Creating dynamic clusters
http://docs.oracle.com/middleware/1212/wls/CLUST/dynamic_clusters.htm
Exalogic overview
http://www.oracle.com/us/products/middleware/exalogic/oracle-exalogic-brochure-1934171.pdf
Using the Maven plugin
http://docs.oracle.com/middleware/1212/wls/WLPRG/maven.htm#WLPRG586

Coherence

Developer's guide
http://docs.oracle.com/middleware/1212/coherence/coherence-developdeploy.htm
Knowledge base
http://coherence.oracle.com/display/COH/Oracle+Coherence+Knowledge+Base+Home
Coherence Incubator
http://coherence.oracle.com/display/INC10/Home
Webcasts
http://www.oracle.com/technetwork/middleware/coherence/coherence-webcasts-098958.html

Other tools

Oracle Enterprise Pack for Eclipse
http://www.oracle.com/technetwork/developer-tools/eclipse/overview/index.html
MySQL
http://dev.mysql.com
PrimeFaces
http://primefaces.org