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

2 (1 reviews total)
By Fabio Mazanatti Nunes , William Markito Oliveira
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Overview of WebLogic Server 12c and Related Technologies

About 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.

Publication date:
September 2013


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 Server

  • The most significant additions to Java SE Version 7

  • New features of Java EE 6, the specification implemented by the WebLogic Server

  • The 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.


Overview of JDK 7

Version 7 of JDK was a huge release for Java, providing great functionality for a wide group of developers and platforms, and Oracle WebLogic Server has been certified on this version since WebLogic 11g. Even though this isn't a brand new feature, it is an important one, so let's check some of the main features of this release:

  • For those who work at the JVM level, InvokeDynamic (JSR 292) is the big name, providing extensions for dynamically-typed languages (such as Ruby, Perl, and Groovy) to perform at almost the same level as a pure Java program.

  • The new class loader architecture introduces safe multithreaded class loading, among other related improvements.

  • Concurrency and collections updates (JSR 166) create new classes that support the fork/join structure, new synchronization barriers, and a utility class ThreadLocalRandom that generates random numbers in applications invoking it from multiple threads.

  • New APIs for filesystem access, part of NIO.2 (JSR 203), with support file metadata, symbolic links, multicast datagrams, and socket-channel binding. Also, there is a new file system provider for zip/jar files and enhancements to the Watch Service API that allows you to register for file change notifications.

  • SDP (Socket Direct Protocol) support: An implementation of a high performance network protocol that streams data over InfiniBand connections on Linux and Solaris. To enable SDP you just need to set a JVM system property and a configuration file.


    InfiniBand is a communications link used in high-performance computing (HPC) systems and datacenters that delivers low latency, scalable throughput between processor nodes and I/O systems, with transmission speeds up to 300 GBps.

  • On the security side, there are many important enhancements, including support for Elliptic Curve Cryptography (ECC), TLS 1.1/1.2, and NLTM (Microsoft's security protocol).

  • The JDBC was upgraded to Version 4.1, enabling the developer to use try-catch structures when dealing with the objects of Connection, Statement, and ResultSet—no need to write finally blocks to release these components anymore.

  • Enhancements to the current MBeans (Management Beans) available at to access information about CPU usage on the system and the JVM.

  • There was a minor update on the XML stack, including JAXP 1.4 (JSR 206), JAXB 2.2a (JSR 222), and JAX-WS 2.2 (JSR 224).


    That's a pretty extensive list but it leaves out tons of RFEs (Request for Enhancement) that were addressed in JDK 7; the complete list can be found at

The Project Coin

The objective of Project Coin is to define a set of simple changes to the Java language that would make the developer's life easier. Some of these changes make their way to JDK 7, and some are expected to be released with Version 8.

Let's explore some of these enhancements with quick examples.

The diamond operator

Following the DRY (Don't Repeat Yourself) principle, the diamond operator (<>) allows developers to have protection at compile time by inferring types from generic collections without repeating the declared type. Before JDK 7, if we had to declare a map that contains a list of Strings, it would look something like this:

Map<String, List<String>> words = new HashMap<String,List<String>>();

In JDK 7 it can be replaced with the following statement:

Map<String, List<String>> words = new HashMap<>();

The try-with-resources statement

The try-with-resources feature is also known as Automatic Resource Management because it's focused on resources such as connections, files, input/output streams, but in the end a so-called resource can be defined as an object that needs to be closed after being used. Basically, any object that implements the java.lang.AutoClosable interface can benefit from the try-with-resources statement.

The feature allows you to simplify resource management by closing one or more resources that were declared within a try block right after their use, without having to write code to release the resources (usually inside finally blocks), avoiding insertion of potential leaks.

A quick example on how this feature can be applied to execute a query is as follows:

try (Statement st = con.createStatement()) {
   ResultSet rs = st.executeQuery(q);

  // Process the results
} catch (SQLException e) {

In the preceding example, a JDBC Statement is created within the try context and then used by a SQL query. After execution, the Statement will be automatically closed by JVM. In previous versions, we had to manually dispose of the Statement resource when it was no longer necessary, confirming that it isn't null and then releasing it.


The try-with-resources statement can still use finally blocks just like the traditional try statement; the difference is that any catch or finally block is now executed after the resources declared have been closed.

Strings in switch statements

Strings in switch statements is a long-awaited feature that you should have already asked yourself: Why don't we have strings in a Java switch statement? Some might say it is a performance issue or something like that, but there's not much sense discussing an optimization that sometimes even the Java compiler doesn't care about. Besides, even cell phones are multi-core nowadays, so processing power really isn't a factor here.

So, developers can have a good time when crafting their code now; if we need to test against a list of possible Strings, we can use one switch statement and save many if and else blocks:

for (Order order : orderList) {
  switch (order.getStatus()) {
  case "NEW":
  case "PENDING":
  case "CLOSED":

Of course it's a simple example, but remember that you would need to replace the case blocks with several cumbersome if and else statements.

Manipulating binary integral literals

The use of binary number manipulation is common in some programming domains (compression encoding, network protocols, or any other type of bitmapped application), though, Java supported the use of only other numeric representations such as decimal, hexadecimal, and octal.

The idea of adding some methods to let the programmer write the numbers directly in binary format is much more practical, and avoids injection of bugs, because the programmer doesn't need to keep in mind that a special variable with numbers in hexadecimal is in fact a number to be translated to binary.

Exception handling with multicatch statements

Usually it's a common requirement to write code that needs to catch multiple exceptions and deal with error handling using a common approach (the same piece of code replicated a few times). Until JDK 7, the simplest option was to write a common method to reuse the same error treatment (or re-throw the exception) for some common exceptions or even use the finally block (which is pretty nasty—getting your code executed even with no exceptions? Please don't!). With multicatch, it is possible to catch multiple exceptions and avoid this duplicated code in catch clauses.

A common exception handling block from Java 6 would look like this:

try {
  // try-code throwing IOException or SQLException
} catch (IOException ex) {
    throw ex;
} catch (SQLException ex) {
    throw ex;

After JDK 7 the same code can be written like this:

try {
  // try-code throwing IOException or SQLException
} catch (IOException | SQLException ex) {
    throw ex;

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 JVM

    • Embeddable API for Java SE: With some limitations, it runs client code and EJB instances in the same JVM on SE environments using an embeddable container

    • EJB 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 resource and 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.


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 Cloud

  • Oracle Database

  • Object Relational Mapping (ORM)

  • Spring 3.2 integration

  • Oracle 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 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.


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.


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 throughput

  • Lazy deserialization: This feature allows us to increase efficiency for session replication

  • Self-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



This chapter presented an overview of the latest Java SDK 7, Java EE 6 technologies, and Oracle WebLogic 12c features. Most of them will be covered in this book. It also positions WebLogic Server 12c in the Cloud Application Foundation architecture, showing how co-related products such as Oracle Coherence can be integrated into a cohesive solution.

In the next chapter, we're going to set up the development environment with all the necessary components to create the application that will be used to demonstrate several features of WebLogic Server in the book.

About the Authors

  • Fabio Mazanatti Nunes

    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 t hese topics on his blog,

    Browse publications by this author
  • William Markito Oliveira

    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, He has authored another book, The Java EE 6 Tutorial: Advanced Topics, Fourth Edition, Addison-Wesley Professional, 978-0-13708-186-8.

    Browse publications by this author

Latest Reviews

(1 reviews total)