Oracle WebLogic is a JEE application server, that is Java Enterprise Edition. But what does this mean?
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:
JEE standards allow:
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:
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.
As your boss was screaming for resources, well, you can present him the JEE distributed system. It contains a lot of resources, such as:
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.
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>"); } }
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.
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> " );
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.
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.
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.
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.
As noted, JDBC can be used for supporting the infrastructure (for example, the Oracle SOA Suite Infra application) or for customer-related data.
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 Message Service is an API for accessing message-oriented middleware.
The interface supports:
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:
The next diagram shows the WebLogic JMS Server Architecture:
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 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.
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.
With JCA, one could connect to many Enterprise systems, such as SAP, PeopleSoft, and Siebel, among others.
Besides the components that are directly managed in a JEE system, there are also external, yet influential, components that should be discussed briefly here.
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.
3.145.35.247