Oracle WebLogic a JEE server… but what is JEE?

Oracle WebLogic is a JEE application server, that is Java Enterprise Edition. But what does this mean?

The JEE distributed system

A WebLogic infrastructure containing multiple managed JEE application servers is called a distributed system.

It divides the work among several independent modules. The failure of a single module has less impact on the overall system, which makes the system more:

  • Available
  • Scalable
  • Maintainable

JEE standards allow:

  • Modularization of complex hardware and software
  • A larger portion of the project costs to go toward solving business software needs

Java EE is a widely used platform for server programming in the Java programming language. The Java EE platform differs from the standard edition of Java, in that it adds libraries which provide functionality to deploy fault-tolerant, distributed, multi-tier Java software, based largely on modular components running on one or more JEE application servers.

Applications deployed with Java EE technologies are standardized, have specification guidelines, are written in Java, and are deployable to any JEE application server.

The following diagram shows an example of a typical JEE architecture:

The JEE distributed system

In this overview, you can see practically all components that are a part of the JEE. We will discuss some of them in this chapter.

JEE Resources

As your boss was screaming for resources, well, you can present him the JEE distributed system. It contains a lot of resources, such as:

  • Java Servlets
  • Java Server Pages (JSP)
  • Enterprise JavaBeans (EJB)
  • Java Database Connectivity (JDBC)
  • Java Naming and Directory Interface (JNDI)
  • Java Transaction API (JTA)
  • Java Message Service (JMS)
  • Java Authentication and Authorization (JAAS)
  • Java Management Extensions (JMX)
  • Java EE Connector Architecture (JCA)

We will look into the different components and how they interact with each other to get an overview of how a (WebLogic) JEE system works.

Java Servlets

A servlet is a Java program that executes on the server, accepts client requests, and generates dynamic responses. An example of a servlet is an HttpServlet that accepts HTTP requests and generates other HTTP Servlets, which may be packaged in a WAR file as a Web application.

Simple code of an HttpServlet:

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 " +
"Transitional//EN">
" +
"<html>
" +
"<head><title>Hello WWW</title></head>
" +
"<body>
" +
"<h1>Hello WWW</h1>
" +
"</body></html>");
}
}

Note

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.

Java Server Pages (JSP)

A JavaServer page is a way to generate dynamic HTML and XML. This is done by Java code and some predefined actions, called JSP actions.

JSPs use a JSP compiler to access the Java code and loads this into a servlet, as you can see in the following code:

The following is an example snippet of a JSP generated servlet:

package jsp_servlet;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import example ; // Imported as a result of <%@ page import="com.foo.bar" %>
import …
class _myservlet implements javax.servlet.Servlet, javax.servlet.jsp.HttpJspPage {
// Inserted as a
// result of <%! int serverInstanceVariable = 1;%>
int serverInstanceVariable = 1;
…
public void _jspService( javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response )
throws javax.servlet.ServletException,
java.io.IOException
{
javax.servlet.ServletConfig config = …; // Get the servlet config
Object page = this;
PageContext pageContext = …; // Get the page context for this request
javax.servlet.jsp.JspWriter out = pageContext.getOut();
HttpSession session = request.getSession( true );
try {
out.print( "<html>
" );
out.print( "<head>
" );

Java Naming and Directory Interface (JNDI)

The API used for accessing resources is JNDI. It's a layer built for accessing naming and directory services (naming service such as an internet address). It uses a directory kind of structure to bind the objects and is accessible by passing simple strings showing logical directory structure such as "jdbc/DB1" (a JNDI for a JDBC service).

A developer does not need to code resource references by using the computer, host, or database names, he /she can use the JNDI name. This makes the code much more generic and can be easily reused. Therefore it's independent of the underlying structure. In the following diagram you can see how a web service connects to an EJB using JNDI.

Java Naming and Directory Interface (JNDI)

Enterprise JavaBeans (EJB)

The Enterprise Java Bean is a JAVA API server-side component that handles business logic of an application. The beans are running in an EJB Container on a JEE Server.

Many Oracle products, such as the Oracle SOA Suite, use EJBs. As an administrator, it's good to know the basic knowledge of EJB and how they behave in a WebLogic environment. As an example, it can help you to know how to size your JVMs.

Enterprise JavaBeans (EJB)

From the previous diagram, you can see that the EJB client (can be an application)connects over RMI (Remote Method Invocation) by using JNDI naming.

Java Database Connectivity (JDBC)

An important resource in your Oracle WebLogic is most certainly your set of JDBC resources. Java Database Connectivity (JDBC) is also a standard Java API that consists of a set of classes and interfaces.

Developers use JDBC to write database applications and execute SQL statements. JDBC requires the use of a driver; implements database-specific connectivity, and statement handling. WebLogic provides many drivers for different kinds of databases. It's used internally for metadata purposes and for application and business purposes.

Java Database Connectivity (JDBC)

As noted, JDBC can be used for supporting the infrastructure (for example, the Oracle SOA Suite Infra application) or for customer-related data.

Java Transaction API (JTA)

JTA is an API too that allows distributed transactions, such as XA transactions. It contains three elements: a high-level application transaction demarcation interface, a high-level transaction manager interface intended for an application server, and a standard Java mapping of the X/Open XA protocol intended for a transactional resource manager. It supports user transaction in EJB, JNDI, and Servlets. The WebLogic Server can process the transaction process that is addressed by the JTA. Application servers handle the bulk of application operations and take some of the load off the end-user application.

Java Transaction API (JTA)

Java Message Service (JMS)

Java Message Service is an API for accessing message-oriented middleware.

The interface supports:

  • Point-to-point communication
  • Publish/subscribe ("pub/sub") communication
  • Guaranteed message delivery
  • Transactional participation
  • Application- or system-scoped resources
  • Interoperability with other messaging systems

JMS is a way of loosely coupled messaging. It uses a queuing mechanism; the publisher puts a message on the queue without knowing that it will be picked up. The subscriber then picks up the message. It knows that the message is for that person because it's embedded in the message header.

Key components of JMS are:

  • JMS provider
    • The JMS interface for a Message Orientated Middleware (MOM)
  • JMS client
    • Produces and/or receives messages
  • JMS producer/publisher
    • Creates and sends messages
  • JMS consumer/subscriber
    • Receives messages
  • JMS message
    • The actual message
  • JMS queue
    • An area that contains messages that have been sent and are waiting to be read
  • JMS topic
    • A distribution mechanism for publishing messages

The next diagram shows the WebLogic JMS Server Architecture:

Java Message Service (JMS)

Java Authentication and Authorization Service (JAAS)

Java Authentication and Authorization Service (JAAS) is a Java-based security management framework. It supports Single Sign-On, and is implemented within the WebLogic Server. Terms that are used in the WebLogic JAAS implementation are security providers and realms.

A realm is a collection of users and groups that are controlled by the same authentication policy. Security providers implement the underlying security framework for your JEE applications. The default security providers can be used or one can implement his/her own security provider within the WebLogic Server. The following diagram shows an example of an authentication process:

Java Authentication and Authorization Service (JAAS)

JMX

Java Management Extensions is a technology that lets you implement management interfaces for Java applications. The specification describes MBeans, which are the building blocks of JMX. One can access these MBeans (Managed Beans) using the WebLogic Scripting Tool (WLST). It supports managing and monitoring for all kinds of services.

JMX is an open technology that is not specific to WebLogic, but is a part of JEE/JSR specification.

JMX

Java EE Connector Architecture (JCA)

Another connector API is called the JCA adapter. It connects EIS (Enterprise Information System) with the so-called resource adapters, deployed in an archive (RAR).

For instance, you could use a SAP resource adapter to connect to a SAP EAI.

Java EE Connector Architecture (JCA)

With JCA, one could connect to many Enterprise systems, such as SAP, PeopleSoft, and Siebel, among others.

Secondary components in the JEE architecture

Besides the components that are directly managed in a JEE system, there are also external, yet influential, components that should be discussed briefly here.

HTTP clients and servers

During the 90's, with the expanding Internet, the web server began to play a key role. A web server as the name suggests provides web content, mainly with the HTTP(S) protocol, and sometimes also through FTP and others. It can handle some scripting such as JavaScript and CGI.

A HTTP client connects to a web server, and depending on the role of the web server, passes the request through to an application server. Web clients can connect through JAVA, web browsers, FTP, and Mail.

Proxy servers

A proxy server is more like an intermediate between clients and web servers or application servers. It can speed up connections by caching frequently requested pages. It can apply policies and mask the identities of the clients. Sometimes it is also referred to as a gateway.

Firewalls

Firewalls are a well-known and always topical issue. Firewalls can block unauthorized users from outside a company, detect intrusions, and scan for malware and spyware. In fact, they are the lock on the door to the outside world.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.35.247