Vendors - Vendors work together on specifications and then compete in implementations. In the areas of
Scalability, Performance, Reliability, Availability, Management and development tools, and so on. Freedom
to innovate while maintaining the portability of applications. Do not have create/maintain their own
proprietary APIs
Business Consumer - Application portability. Many implementation choices are possible based on various
requirements. Price (free to high-end), scalability (single CPU to clustered model), reliability, performance,
tools, and more. Best of breed of applications and platforms. Large developer pool.
Enterprise JavaBeans™ (EJBs) provide the J2EE implementation of the business logic, whether data (Entity
EJBs) or logic (Session EJBs).
The Presentation Tier processes input from the Client Side Tier, calls components in the Business Logic
Tier, and then sends a response back to the Client Side Tier.
The J2EE Web container supports the execution of the servlet and JSP™ programming artifacts, manages
the HTTP requests, and provides common services (session state, security, transactions, naming, and
database access)
Depends on several factors for example requirements of applications, availability of EJB tier, availability
of developer resource
Application needs to be scalable or support variety of clients, transactions are required to ensure data
integrity.
Page 1 of 12
Note for slide 8
Deployment descriptor contains deployment time runtime instructions to the Web/EJB container
- For example the URL that the client uses to access the web component, EJB name, home, remote and ejb
classes, Local references for EJBs, resources, etc
Security roles, method permissions. Transaction attribute for each method. Every module has to have it
3. The Web server immediately passes the request to the Web server plug-in. All requests go to the
WebSphere plug-in first.
4. The Web server plug-in examines the URL, verifies the list of host name aliases from which it will accept
traffic based on the virtual host information, and chooses a server to handle the request.
6. If the servlet class is not loaded, the dynamic class loader loads the servlet (servlet init(), then doGet() or
doPost()).
7. JNDI is used for lookup of either datasources or EJBs required by the servlet.
8. Depending upon whether a datasource is specified or an EJB is requested, the JNDI directs the servlet:
– To the corresponding database and gets a connection from its connection pool in the case of a data
source.
– To the corresponding EJB container, which then instantiates the EJB when an EJB is requested.
9. If the EJB requested involves an SQL transaction, it goes back to the JNDI to look up the datasource.
10.The SQL statement is executed and the data retrieved is sent back either to the servlet or to the EJB.
11.Data beans are created and handed off to JSPs in the case of EJBs.
13.The JSP generates the HTML that is sent back through the WebSphere plug-in to the Web server.
14.The Web server sends the output page (output HTML) to the browser.
Page 2 of 12
Note for slide 20
Sample plugin-cfg.xml
<?xml version="1.0" encoding="ISO-8859-1"?><!--HTTP server plugin config file for the webserver
dmCell.http1Node.HTTP1 generated on 2004.10.12 at 04:43:03 PM EDT-->
<VirtualHostGroup Name="default_host">
</Server>
</Server>
</Server>
<PrimaryServers>
Page 3 of 12
<Server Name="app1Node_Web1"/> <Server Name="app2Node_Web2a"/> <Server
Name="app2Node_Web2b"/>
</PrimaryServers>
</ServerCluster>
</UriGroup>
</filters>
</filters>
</filters>
</filters>
</RequestMetrics>
</Config>
To begin with, we have a weight of 4 for Web1 and a weight of 3 for Web2a:
Page 4 of 12
1. When the first request comes in, Web1 is randomly chosen. The request is OK. Web1 weight is
decremented by 1 to 3.
2. The second request is sent to Web2a. The request is OK. Web2a weight is decremented by 1 to 2.
3. The third and fourth requests are sent to Web1 and Web2a, respectively. So Web1 now has a weight of 2
and Web2a now has a weight of 1.
4. The fifth request has a cookie that specifies a server affinity to Web1. The request is sent to Web1 and its
weight is decremented by 1 to 1.
5. The sixth request is again sent to Web1 because of server affinity. The request is OK. Web1’s weight is
decremented by 1 to 0.
6. The seventh request again has a cookie that specifies server affinity to Web1. The request is sent to
Web1 and its weight is decremented by 1 to -1.
7. The eighth to eleventh request all have server affinity to Web1. The weight is decremented by 1 for each
request. After the eleventh request, Web1 now has a weight of -5 while Web2a still has a weight of 1.
8. The twelfth request has no server affinity so it is sent to Web2a. Web2a weight is decremented by 1 to 0.
9. When processing the thirteenth request, the plug-in decides to reset the weights because there are no
servers marked up having positive weights. A multiple of the lowest common denominator of the servers’
maximum weight is added back to the current weights to make all weights positive again.
Important: In our example, the current weight of Web1 is -5 because many session-based requests have
been served. Web2a has a weight of 0. The plug-in checks how many times the maxWeight should be
added to make the current weight positive for all servers. The starting weight for Web1 was 4 and 3 for
Web2a. Because Web1’s current weight is -5, adding 4 (the lowest common denominator) would not set it to
a positive weight. Thus the plug-in decides to add the starting weights * 2, which is 8 for Web1 and 6 for
Web2a. So the new current weights are 3 for Web1 (-5 + 2 * 4) and 6 for Web2a (0 + 2 * 3).
The extensions class loader is responsible for loading the code in the extensions directories
(<JAVA_HOME>/lib/ext or any other directory specified by the java.ext.dirs system property). This class
loader is implemented by the sun.misc.Launcher$ExtClassLoader class.
Page 5 of 12
The system class loader is responsible for loading the code that is found on java.class.path, which
ultimately maps to the system CLASSPATH variable. This class loader is implemented by the
sun.misc.Launcher$AppClassLoader class.
// Loading Classes
wcl2.getTheClass();
==========================================================================
Page 6 of 12
System.out.println("->WCL 3 was loaded by:"+wcl3.getClass().getClassLoader());
==========================================================================
Page 7 of 12
Create a separate file, for example Resource.jar, configure it as a utility JAR, move all log4j.properties files
from the modules into this file, make their names unique (like war1_log4j.properties, war1-2_log4j.properties
and ejb1_log4j.properties). When initializing log4j from each module, tell it to load the proper configuration
file for the module instead of the default (log4j.properties).
Keep the log4j.properties for the Web modules in their original place (/WEB-INF/classes), add log4j.jar to
both Web modules (/WEB-INF/lib) and set the class loader mode for the Web modules to PARENT_LAST.
When initializing log4j from a Web module, it loads the log4j.jar from the module itself and log4j would find
the log4j.properties on its local classpath, the Web module itself. When the EJB module initializes log4j, it
loads from the application class loader and it finds the log4j.properties file on the same class path, the one
in the EJB1.jar file.
The simple name binding is guaranteed to succeed if lookup is within the same server or when connected
directly to the name space of the server containing the target of the lookup. It can be used in a servlet or
EJB, if it is certain that the object is located on the same application server. Here is an example of a simple
name:
ejb/webbank/Account
Lookup names of this form provide a level of indirection such that the name used to look up an object is not
dependent on the object's name as it is bound in the name server's name space. The deployment
descriptors for the application provide the mapping between the name and the name server lookup name.
The container sets up the name space based on the deployment descriptor information so that the name is
correctly mapped to the corresponding object.
Compound name
Applications that do not run in the same server cannot use simple name lookup because the simple name is
not local to the application. Instead, an application of this type must look the object up directly from the
name server. Each application server contains a name server. System artifacts such as EJB homes are
bound relative to the server root context in that name server. The fully qualified (compound name) JNDI
name is always guaranteed to work. Here is an example of a compound name:
cell/nodes/node1/servers/server1/ejb/webbank/Account
Corbaname
The corbaname binding is always guaranteed to work. However, it requires that you know the correct path
to the object at deployment time. Here is an example of a corbaname:
corbaname::myhost1:9812/NameServiceServerRoot#ejb/webbank/Account
Page 8 of 12
such as deployment manager, node agent and application server, hosts its own ORB, NameService and
local name space. Lookups are made by accessing the NameService in the most convenient process. They
are not bottlenecked through a single server process in the cell. The WebSphere Application Server naming
architecture uses CORBA CosNaming as its foundation. The CosNaming architecture has been changed to
support a distributed and federated collection of CosNaming servers. Each deployment manager, node
agent, and application server is a CosNaming server and is responsible for managing the names of the
objects that are bound locally. Objects are bound into the local context. Lookups start in the local process
and end in the process where the target object is located. This reduces the dependency of the WebSphere
Application Server network on a single name server for all lookups. A single, logical name space exists
across the cell. The separate name spaces of each server process are linked and federated via context links
in the cell name space. It is possible to navigate to specific subcontexts, as every server cluster and non-
clustered server has its own context stored in a level of the cell name space. The contents of the federated
name space are mostly transient, built from configuration data read from the XML configuration files on the
startup of each server process. Persistent roots are provided at the cell and node level of the name space to
provide locations where objects can be persistently bound. These bindings are persisted to XML files on the
file system. Each separate server process has its own bootstrap port, thereby reducing bottlenecks.
Example
Page 9 of 12
corbaname:iiop:hostA:9810,:hostA:9811#cell/clusters/EJBCluster/ejb/com/ibm/it/invokeejb/Add
ressHome
Page 10 of 12
Note for slide 42
The four proxy classes are:
Service endpoint interface (SEI): WeatherForecast—defines the method signatures of the Web service.
Service interface: WeatherForecastService—defines the service methods of the locator class (for example,
retrieving the SEI).
Binding stub: WeatherForecastSoapBinding—implements the SEI (makes the actual calls to the Web
service).
import java.io.*;
import java.util.*;
import itso.test.*;
try{
System.out.println(temperature);
System.out.println("WeatherForecastClient completed");
} catch (Exception e) {
e.printStackTrace();
Page 11 of 12
Note for slide 45
Dynamic Proxy example:
import javax.xml.namespace.QName;
import java.io.*;
import java.util.*;
try{
System.out.println(temperature);
System.out.println("DynamicProxyJavaClient completed");
e.printStackTrace();
Page 12 of 12