Facilities Guide

CHAPTER 6

Server Implementation Notes

This chapter presents some implementation details about the Novell exteNd Application Server. Topics include:

 
Top of page

J2EE containers

At the heart of the J2EE component model are containers. Containers are the runtime environments supplied by J2EE platform providers such as the Novell exteNd Application Server. Containers provide life-cycle management and other services, freeing application developers to focus on the presentation and business logic of their applications.

The application server implements each of the three kinds of J2EE container:

 
Top of section

Web container

The Web container contains Web applications, which are packaged in Web archive (WAR) files. Each WAR you deploy to the application server functions as a complete, standalone application. The WAR file must contain all JSP pages, servlets, JavaBeans components, utility classes, static HTML pages, images, and sounds used by the application.

JSP pages and servlets   Once you've deployed a WAR to the server, each JSP page in the WAR behaves like a servlet. The page is associated with an URL. When a Web client or server-side object performs an operation on that URL, the server finds the associated servlet, instantiates it, and calls the init() and service() methods associated with the servlet. When the servlet is about to be unloaded, the server calls the destroy() method.

The servlet context for any JSP page (or servlet) within the WAR is the WAR itself. That means a JSP page or servlet cannot forward to (or include) a JSP page or servlet that resides in a different WAR, since the WAR defines the boundaries of the application.

Persistence   JSP pages running on the application server are not persistent. A new instance of a JSP page might be created for each HTTP request (depending on whether the JSP page is defined as threadsafe in the deployment descriptor).

Response   The application server uses the Servlet API to implement response buffering. It uses the following methods of the ServletResponse interface to buffer response data:

Length   If a servlet does not specify the length of its content by calling setContentLength(), the server uses HTTP 1.1 chunking to transfer the content as a series of chunks.

How URLs are processed

When a Web client or server-side object requests a resource in a WAR, the server breaks the request URL down into several components:

Component

Description

context path

Identifies the WAR

servlet path

Identifies the requested item (JSP page, servlet, or other resource) in the WAR

pathinfo

(Optional) Provides extra data to be passed to the servlet. In general, performance is better when query parameters (instead of pathinfo data) are passed to a request—because pathinfo slows down the lookup process, but parameters do not.

The following example shows the components of the URL for a WAR file deployed at myWar:

  http://host/db/path/to/war/myWar/foo.jsp/pathinfo/for/jsp

Here the context path is /db/path/to/war, the servlet path is /myWar/foo.jsp, and the pathinfo is /pathinfo/for/jsp.

Dispatching requests within a WAR

A JSP page or servlet can forward to (or include) any other JSP page or servlet that resides in the same WAR.

If you use the <jsp:forward> or <jsp:include> action, the target URL can be context-relative or page-relative. A context-relative URL begins with a slash (/) and is interpreted relative to the WAR. A page-relative URL does not begin with a slash and is interpreted relative to the current page.

Suppose the complete URL for a JSP page is http://localhost/myDatabase/jsptests/myjsps/test.jsp, and the URL you give to the WAR at deployment time is jsptests. In this case you can forward a request to the page by embedding the following tag in a JSP page in the same WAR:

  <jsp:forward page="/myjsps/test.jsp"/>

In a servlet, if you use the getRequestDispatcher() method of the ServletContext object to specify the target URL, the URL is context-relative. It must begin with a slash and is interpreted relative to the WAR. To forward a request to http://localhost/myDatabase/jsptests/myjsps/test.jsp, you could embed the following code in a servlet in the same WAR:

  ServletConfig sconfig = getServletConfig();
  ServletContext sc = sconfig.getServletContext();
  RequestDispatcher rd =
     sc.getRequestDispatcher("/myjsps/test.jsp");
  rd.forward(req, res);

The forward() method call passes the implicit request and response objects as arguments.

JSP pages and session management

The application server can use either cookies or URL rewriting to track sessions. It uses cookies if the browser supports cookies and uses URL rewriting if the browser does not.

For more information    For more information, see the section on session management in the chapter on server configuration in the Administrator's Guide.

 
Top of section

EJB container

The EJB container provides the runtime environment for EJB2.0 and EJB 1.1 beans. The runtime environment includes such low-level services as naming, remote access, security, and transaction support.

This section describes the features of the EJB container and includes these topics:

Supported EJBs

The EJB container supports:

EJB container services

This section describes the services provided when an EJB is deployed an application server.

Debugging

The EJB container provides debugging support at both deployment time and runtime.

Deployment debugging support    Deployment debugging support is provided through the command-line tool SilverCmd. The following table describes the commands that are most useful for debugging:

SilverCmd command

Description

ValidateEJB

Validates EJBs against the specification

Validates the deployment plan and the deployment descriptor

Is also called by both SilverCmd DeployEAR and DeployEJB

Generates errors and warnings

DeployEAR

Allows you to specify verbose level (-v). You can specify three levels of messages:

  • Low: specify 1

  • Medium: specify 3

  • High: specify 5

To skip validation, use -n

DeployEJB

For more information    For more information on SilverCmd, see SilverCmd Reference.

Runtime debugging support    Runtime debugging support is provided through a server startup switch or a command shell from the server console. The following table describes the switches and how to use them:

Server switch

Description

EJBDebug

Lets you specify the types of messages the server should output. Use this syntax when starting the server:

  SilverServer +DEJBDebug=n

Valid values for n are:

  • 1: Shows the SQL the container generates for CMP entity beans (as an alternative, you can use sql.debug)

  • 2: Shows transaction starts, commits, and rollbacks

  • 4: Shows any Exceptions

  • 8: Shows security

  • 16: Shows EJB metadata

  • 32: Shows the contents of the context pool

To specify more than one type of output    Use the sum of values. For example, to see SQL and Exceptions, use the value 5.

Viewing messages    You can view the messages for all deployed beans or for a specific bean. To see values for a subset of beans, use EJBDebugName (described next).

EJBDebugName

Lets you specify a single bean or a set of beans for which you want to see EJB debug messages. Use this in conjunction with the EJBDebug flag (above). The syntax when starting the server is:

  SilverServer +DEJBDebugName=name

where name:

  • Is the ejb-name element of the deployment descriptor

  • Is case-sensitive

  • Can be a single letter or a string (debug messages will display for any bean whose name contains the letter or string)

Instance pooling

The EJB container supports instance pooling for entity, stateless session, and message-driven beans. Pooling is per bean and is specified in the deployment plan. To reconfigure the pool size, redeploy the bean with an updated deployment plan.

For entity and session beans, you specify values for the following:

Deployment plan item

What you do

initialPoolSize

To preallocate pools, set this to a number greater than zero

maxPoolSize

Set the maximum number of unused instances in the pool

The defaults are:

  • 500 for session beans

  • 0 for entity beans

  • 5 for message-driven beans

poolingPolicy

Define what happens when maximum pool size is reached

Values are CREATE and FAIL (described below)

Entity and stateless session bean pooling policies   The EJB container does not create the instance pool when you deploy the bean; instead, it populates the pool as the need for instances increases:

For message-driven beans, the container provides instance pooling by implementing the ServerSessionPool interface.

Stateful session bean passivation   The application server monitors memory usage by measuring the Garbage Collection (GC) rate. When the GC rate increases significantly, the server will start stateful session beans passivation. To disable the monitoring and passivation, add the following line to the httpd.props file:

  http-server.com.sssw.srv.disableMemMonitor=false

The httpd.props file is located in the server's \Resources directory.

Load balancing

Load balancing is per session. All EJBs used within a single session reside on one server within the cluster. Load balancing is transparent to the user; the client can do a normal JNDI lookup, and the naming server selects the server for the bean to run on.

When using EJBs within a cluster, you must start your servers on different name service ports. The default name service port is 54890. You can configure the name service port via the SMC.

For more information    For more information on application server clustering mechanisms, see the chapter on administering a cluster in the Administrator's Guide.

Naming service

EJBs are registered in the root context of the Java Naming and Directory Interface (JNDI). If you specify a hierarchical naming structure for JNDI names, bean references, resource references, environment variables, or UserTransactions in the deployment plan, the container creates any intermediate subcontexts that do not already exist.

By default, the server registers bean references, environment variables, and resource references in the java:comp/env context. You can follow the recommendations of the EJB specification and store the objects in separate subcontexts, but the application server does not enforce these naming conventions. That means you can use the naming conventions that work best in your own production environment.

Remote access

The application server supports access to EJBs via RMI/IIOP using Novell exteNd ORB (Object Request Broker). exteNd ORB is an enterprise-class Java-based CORBA ORB and is part of the Novell exteNd Messaging Platform.

For more information    For more information on exteNd ORB, see the Novell exteNd Messaging Platform help.

For portable lookups for EJBs, use the CORBA name syntax—like this:

  corbaname:iiop:host:port#name

For example:

  corbaname:iiop:MyMachine:54520#MyEJB

Client access   A client accessing an EJB needs a JAR that contains the EJB's interfaces (for compile-time references) and the container-generated stubs (for runtime).

EJB developers should create an EJB client JAR and verify that the deployment descriptor includes the ejb-client-jar element. When this element is present, the container generates stub classes, places the stubs in the client JAR, and uploads the client JAR to the server.

Since the EJB client JAR is generated by the container and resides on the server, you'll need to download the JAR from the server to the appropriate location on disk. Put the disk location of the EJB client JAR on the classpath of the client. Remember to download a new version of the EJB client JAR each time you make changes to the EJB and redeploy it.

Local access

To look up a local bean use:

  EJBLocalHome/beanName

Security

The EJB container manages security at runtime using:

Authentication and caller propagation

When you call an EJB, the server authenticates the user and uses the caller's identity for the duration of the caller's session on that server. All method calls run with the identity of that session. You can map a role name to a principal (user, group, or list of principals) in the deployment plan.

Access authorization

Access authorization is defined by the security-role and method-permission elements specified in the deployment descriptor. If you secure at least one method of a bean in the EJB JAR, you must secure all methods—or the container assumes all methods with unspecified security are restricted and cannot be called by any user. In addition, you can specify a set of methods that should not be called using the exclude-list element of the deployment descriptor. When a restricted method is called, the container throws an AccessRightsViolation Exception. Alternatively, you can choose a nonsecure mode by not securing any methods.

Secure communications

You can establish a secure connection between an EJB client and the application server using SSL. Novell exteNd ORB provides the IIOP over SSL support for RSA only.

You do not need to be running HTTPS. The following are required:

For more information    For more information on establishing a secure connection between an EJB client and the application server, see the chapter on setting up security in the Administrator's Guide.

Transaction support

The EJB container supports distributed transactions via the Novell exteNd JTS server, which fully implements Java Transaction Service (JTS).

If the transaction attribute is not specified in the deployment descriptor, the container uses the Supports attribute as the default transaction attribute.

 
Top of section

Client container

J2EE application clients are the standard way to provide Java-based clients that run on user machines and access J2EE servers. They are hosted by a client container that (at a minimum) provides JNDI namespace access. Beyond that, the J2EE specification allows for a wide range of client container implementations, from basic to robust.

The application server supplies a client container named SilverJ2EEClient that users can invoke to run J2EE application clients you've deployed to the server. SilverJ2EEClient provides a robust set of supporting services, including:

For more information    For details, see SilverJ2EEClient.

 
Top of page

Session-level failover

The application supports session-level failover for Web applications (WARs) and stateful session beans (EJB JARs). Session-level failover refers to the ability of an application to retain temporary user data (state) across server failures in a cluster. The data is stored in a persistent storage repository (such as a database or file system shared by the servers in the cluster) so that it can be recovered by any server in the cluster in the event of a server failure.

To support session-level failover, you must have a hardware dispatcher installed as the dispatcher for your cluster. All clients accessing the applications configured for session-level failover should access the application via the cluster's (hardware) dispatcher.

Failover support is not a mechanism for load-balancing EJBs belonging to a single session across multiple servers.

 
Top of section

EJB support for session-level failover

The EJB container supports session-level failover for stateful session beans (local and remote). The stateful session beans must meet these requirements:

How session-level failover works for stateful session beans

If your session beans meet the requirements listed above and a failure occurs, the recovery works like this:

  1. At the end of each transaction that includes one or more recoverable stateful session beans, the EJB container passivates and serializes all recoverable beans used in the transaction and saves them to the database (the AgSessBeans table in the SilverMaster database).

  2. As long as the server is up, the client will continue to use the same server.

  3. If the client gets a communication failure on a remote call, it assumes the server failed:

The performance of your EJB applications might be impacted if the recoverable session bean does a lot of work in the ejbActivate() method. For example, if the session bean allocates and caches a database connection.

Server settings to support session-level failover

To support session-level failover when using IIOP over SSL, you must also configure a range of ports for IIOP SSL communications for the server.

For more information    For more information on setting the range of ports, see the section on specifying ORB settings in the Administrator's Guide.

 
Top of section

Web application support for session-level failover

The WAR container supports session-level failover. The Web application must meet the following requirements:

How session-level failover works for Web applications

If your Web application meets the requirements listed above and a failure occurs, the session-level failover recovery works like this:

  1. On each HTTP request to the Web application, the server serializes the HTTPSession state to the database (the AgSessBeans table of the SilverMaster) at the end of each request.

    Because the container passivates, serializes, and saves the HTTPSession state to the database at the end of each HTTP request, this can impact the overall performance of the application.

  2. As long as the server is up, client requests will continue to be directed to the same server.

  3. If the server fails between requests and you have a hardware dispatcher, the dispatcher detects the server failure and sends the next request to a different server.

If you do not have a hardware dispatcher

If you use the application server's software Dispatcher (instead of a hardware dispatcher), the user application will have to manually return to the dispatcher after the failure to be redispatched. Once redispatched, the new server will not automatically restore the state, since the session ID cookie will be different.

When failover might not work

Because the HTTPSession state is not transactional, updates to the HTTPSession during a request can be lost under certain circumstances—for example, if the server crashes during a request (but before the state is saved). However, if the server crashes after the state is saved but before returning a reply, the state can be recovered.

 
Top of section

Application client support for session-level failover

A J2EE client application can access Web application components or EJBs that support session-level failover as long as the Web components and EJBs meet the session-level failover requirements described in Web application support for session-level failover just above. The J2EE client must initially connect to the cluster's (hardware) dispatcher like this:

  SilverJ2EEClient dispatcher-name:port database-name application-name

For more information    For details on SilverJ2EEClient, see SilverJ2EEClient.

 
Top of page

CORBA support

The application server includes Novell exteNd ORB. exteNd ORB is an enterprise-class Java-based CORBA ORB. You can use exteNd ORB from the application server, SilverJ2EEClient, or any browser. You can use exteNd ORB to develop, deploy, and manage Java-based CORBA applications. The application server uses the following subset of features:

For more information    For more information on exteNd ORB, see the Novell exteNd Messaging Platform help.

 
Top of page

XML support

XML (eXtensible Markup Language) allows you to create XML documents that can be used to exchange data between computer systems (of different types) and applications on the Web. This section describes the application server's use of and support for XML documents and includes the following topics:

 
Top of section

Application server support for XML

The application server uses XML documents for:

For information, see:

 
Top of section

Resources for learning about XML

If you're new to XML or just need to explore a specific XML topic, try the following learning resources:

Resource

Description

Available at

Novell exteNd developer site

An index to XML learning and reference materials with links to many documents and Web sites

developer.novell.com/extend

XML.org site

A directory of XML news and information

www.xml.org

 
Top of page

Internationalization support

This section describes the following internationalization topics:

 
Top of section

Database support

All JDBC drivers certified for use with the application server have been fully tested to support Western/Eastern European and Asian languages.

Procedure To use the multibyte version of the server's JDBC-ODBC bridge driver:

  1. Add the following line to AgUserIni.props in your server's \Resources directory:

      com.sssw.srv.ambry.mbcs.AgOdbc=true
    
  2. Restart the application server.

 
Top of section

Client-side support

The application server includes runtime language libraries for Simplified and Traditional Chinese, English, French, German, Italian, Japanese, Korean, Portuguese, Russian, and Spanish.

If you encounter font-mapping problems in SilverJ2EEClient where the correct characters are not displaying, you can fix the problem by editing the JRE's font.properties file. You must edit the font.properties.XX file in the Novell exteNd Common\jre\lib directory (where XX is the two-character language encoding for the language you are interested in). For example, you would edit font.properties.ko for Korean.

Two sections in the file   There are two sections of interest in the file that appear one after the other. They are labeled name aliases and for backward compatibility.

The original version of font.properties.ko is:

  # name aliases
  #
  # alias.timesroman=serif
  # alias.helvetica=sansserif
  # alias.courier=monospaced
  # for backward compatibility
  timesroman.0=Times New Roman,ANSI_CHARSET
  helvetica.0=Arial,ANSI_CHARSET
  courier.0=Courier New,ANSI_CHARSET
  zapfdingbats.0=WingDings,SYMBOL_CHARSET

How to proceed   The name aliases section maps nonexistent font names to font mappings defined in the file. You should uncomment those alias lines. (This is the preferred way of handling the mapping. The section for backward compatibility is the old way of mapping nonexistent font names to fonts described in the file.)

NOTE:   You need to comment the first three lines of this section.

The updated version of the file would then be:

  # name aliases
  #
  alias.timesroman=serif
  alias.helvetica=sansserif
  alias.courier=monospaced
  # for backward compatibility
  # timesroman.0=Times New Roman,ANSI_CHARSET
  # helvetica.0=Arial,ANSI_CHARSET
  # courier.0=Courier New,ANSI_CHARSET
  zapfdingbats.0=WingDings,SYMBOL_CHARSET


Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...