Sun Java Solaris Communities My SDN Account
 
Compatibility & Java Verification

Java[tm] Application Verification Kit (AVK) for the Enterprise 1.4.2 User's Guide

 
Compatibility
White Papers
 
Forums
Bug Database
 
New to Java Center
Tutorials & Code Camps
Training
Certification
J2EE Learning Path
Quizzes
 
 
 

This User's Guide describes the JavaTM Application Verification Kit (AVK) for the Enterprise and the technical recommendations behind it. This Guide covers the following topics:

Introduction

This Guide describes what the Java AVK for the Enterprise does and how to use the tools provided as part of the kit. It also describes the features of the Sun Java System Application Server Platform Edition 8.2 ("the Application Server") that support the kit.

Why Portability Matters

Portability is one of the most attractive aspects of the Java programming language. Applications coded in the Java programming language can run unchanged in many different types of stand-alone or client operating environments. The Java 2 Platform, Enterprise Edition (J2EETM) extends the portability benefits of the Java language to the enterprise, providing a single set of specifications for application servers and an extensive set of compatibility tests. It allows you to run applications across different types of J2EE servers. Given the large investment most businesses have in client-server applications, the J2EE platform can save companies a lot of development time and money. With the portability features of the J2EE platform, there is little or no need to rewrite code for different servers.

Whatever product you use to develop your enterprise applications, you need to ensure that your code will be easy to migrate from one application server to another. To do this, you need to make sure that your code does not use vendor-specific extensions to the J2EE platform. The Java AVK for the Enterprise is designed to help developers avoid such situations.

The Java AVK for the Enterprise is designed to identify enterprise applications developed with J2EE technology that are intended to be portable across different implementations of the J2EE platform.

Creating Portable Applications: Using Java BluePrints

The Java BluePrints program provides an extensive set of guidelines, design patterns, and sample applications that serve as models for developers writing portable applications. In particular, the Java Adventure Builder Reference application showcases how to design interoperable and portable web services on the J2EE 1.4 platform, and the Java Pet Store Sample Application shows how to use the capabilities of the J2EE platform to develop robust, scalable, portable, and maintainable enterprise applications. We recommend that anyone implementing a J2EE application study these applications.

See http://java.sun.com/blueprints/enterprise for information about installing the sample applications and about developing portable enterprise applications.

What the Java AVK for the Enterprise Does

The Java AVK for the Enterprise is a set of tools intended to help developers test their applications for correct use of J2EE APIs and portability across J2EE compatible application servers.

The Java AVK for the Enterprise tools determine that an application suite follows the J2EE platform specification (including all the specifications for the technologies that are part of the platform) and that it runs on the Application Server. They do this in two stages:

  • Static verification determines that an application suite's deployment descriptors follow the specification and that it contains no methods that are proprietary to a particular vendor.
  • Runtime verification determines the proportion of enterprise bean component methods, web services methods, and web components that are invoked by running the application.

This section covers the following topics:

The Application Server

Sun Java System Application Server Platform Edition 8.2 is a compatible production-grade implementation of the J2EE 1.4 specification. This product provides extensive support for web services, including the industry's most complete support for WS-I Basic Profile. Furthermore, it is also the first application server to provide integrated support for JavaServer Faces.

The Application Server includes various tools to help developers prototype J2EE applications and learn about the J2EE platform and technologies.

The Java AVK for the Enterprise requires an application to use the Application Server to confirm that it runs on a complete and correct implementation of the J2EE 1.4 platform.

Terms Used

Here are a few terms that apply to the Java AVK for the Enterprise.

Application suite
One or more application EAR files and other deployment units that make up the application to be verified. A deployment unit may be either a standalone module or an EAR file containing one or more modules. The Application Server requires that each deployment unit be deployed under a unique name. An application suite is typically bundled in one or more EAR and/or WAR files, which must be deployed together for the application to work. For example, the Java Pet Store Sample Application is an application suite that consists of four EAR files.

Web components
The physical implementations of the servlets and JavaServer PagesTM (JSPTM) components in an application suite (not their URL mappings).

Introspection
The process of discovering all Enterprise JavaBeansTM (EJBTM) component methods and web components contained within an application suite.

Instrumentation
The process of tracking EJB component methods and web components invoked while running an application suite on the Application Server.

See also the J2EE Glossary at http://java.sun.com/j2ee/glossary.html.

Scope

A J2EE application suite is composed of one or more deployment units, and each unit can contain one or more deployment descriptors. If the deployment unit is an EAR file, its deployment descriptor lists its components as modules; each component must also have a deployment descriptor. The deployment unit can also be a standalone module. There are four types of modules:

  • J2EE application client JAR file
  • EJB JAR file
  • Web Component WAR file
  • Resource Adapter RAR file

The Java AVK for the Enterprise performs runtime verification on only a subset of the J2EE components:

  • A J2EE application suite delivered as one or more EAR files
  • A J2EE module of either of the following types: EJB JAR file, web component WAR file

At this release, the Java AVK for the Enterprise does not perform runtime verification on the following:

  • Resource adapters (RAR files)
  • Message-driven beans
  • Servlet filters

Coverage

Good programming practice can lead to specific code paths that are difficult or inappropriate to test. These include:

  • White-box test hooks
  • Debug methods
  • Certain exception paths, where the triggering error is hard to generate

To provide flexibility to permit these reasonable cases, the Java AVK for the Enterprise sets a coverage guideline of 80% EJB method execution. The reporting tool presents coverage status based on this guideline. Different organizations may choose different internal guidelines to meet their own processes and requirements. The reporting tool provides detailed results information that will be useful.

The following criteria are tracked or required by the Java AVK for the Enterprise tools:

  • Criteria for Verifying EJB Components
    • Pass all the static verification tests (warnings should be examined)
    • Successfully exercise the application suite in the Application Server and invoke at least 80% of the EJB and business logic methods (with no system exceptions)
  • Criteria for Verifying Web Components
    • Pass all the static verification tests (warnings should be examined)
    • Invoke all servlets and JSP pages with no compilation or runtime errors
    • Name all the JSP files with the .jsp extension or declare those JSP pages in the deployment descriptors
    • Provide a servlet mapping for all servlets in the web.xml file

What the Java AVK for the Enterprise Includes

To install the Java AVK for the Enterprise 1.4.2, refer to the Installation Instructions. The Java AVK for the Enterprise is installed in the javke1.4.2 directory at a location you specify. This document refers to this location as <JAVKE_HOME>.

This section describes what you get when you install the Java AVK for the Enterprise. It covers the following topics:

The installation process for the Java AVK for the Enterprise automatically installs an instrumented version of the Application Server at <JAVKE_HOME>/appserver.

Application Server Directory Structure

Table 1 describes the most important directories within <JAVKE_HOME>/appserver.

Table 1. Application Server Directories
Directory Contents
bin Application Server commands
config
domains/domain1/config
Configuration files
docs Release documentation. API documentation for this release is online at http://java.sun.com/j2ee/1.4/docs/api/index.html.
lib
imq/lib
Libraries, schema files, and Document Type Definition (DTD) files
domains/domain1/logs Server logs
domains/domain1/applications Deployed applications
domains/domain1/autodeploy Applications and modules that the server deploys automatically

Application Server Tools

The Application Server comes with a set of tools for managing the server and for packaging, deploying, and running J2EE applications. Many of these tools are listed in Table 2. Most of the commands that invoke these tools are in the <JAVKE_HOME>/appserver/bin directory. For more information, see the files <JAVKE_HOME>/appserver/docs/about.html and <JAVKE_HOME>/appserver/docs/QuickStart.html and the Sun Java System Application Server Platform Edition 8.2 Administration Guide.

Table 2. Application Server Tool Commands
Command Description
asadmin Runs the application server administration utility, used to start and stop the Application Server and its database and to manage users, resources, and applications. See Starting the Instrumented Application Server for details on starting the server.

The Java AVK for the Enterprise installation procedure adds special instrumentation to the Application Server. The instrumentation is activated automatically when you start the server.

Type asadmin help to get a list of the many asadmin subcommands.

The asadmin command has a corresponding tool, the Admin Console, which allows you to perform administrative tasks using a Graphical User Interface. To use the Admin Console, open the URL http://localhost:4848/ in a browser after starting the server.

asant Runs a portable command line build tool that is an extension of the Ant tool developed by the Apache Software Foundation (see http://ant.apache.org/). asant provides additional tasks that interact with the Application Server administration utility. You will use asant tasks to perform static verification.
deploytool Runs the Application Server deployment tool, a standalone GUI tool to package applications, generate deployment descriptors, and deploy applications on the application server.
startserver If your application uses entity beans, they normally access the PointBase database management server, which is included in the Application Server. To start PointBase on a UNIX system, use the pointbase/tools/serveroption/startserver.sh command. On a Windows system, the command is startserver.bat. To stop PointBase, enter q or x in the window in which PointBase is running.
appclient Runs a J2EE application client by launching the application client container and invoking the client application packaged in the application client JAR file.
wscompile Generates stubs, ties, serializers, and WSDL files used in JAX-RPC clients and services.
wsdeploy Generates implementation-specific, ready-to-deploy WAR files for web service applications that use JAX-RPC.

Java AVK for the Enterprise Tools

You will use the following tools to verify your application suite:

  • The Application Server asant tool, which you use to run the static archive tests and to translate deployment descriptors
  • The Application Server deployment tool, which you run with the <JAVKE_HOME>/appserver/bin/deploytool command
  • The Java AVK for the Enterprise reporting tool, which you run with the <JAVKE_HOME>/bin/reporttool command

Verifying an Application Suite

This section describes the steps to verify an application suite using the Java AVK for the Enterprise.

Here is an overview of these steps:

  1. Add the Java AVK for the Enterprise Ant tasks to the build.xml file(s) for your application suite.
  2. Perform static verification tests on each module.
  3. Start the instrumented Application Server.
  4. Create resources for the application suite.
  5. Specify runtime information for each module.
  6. Deploy the application suite on the instrumented Application Server.
  7. Create an exclude list for component libraries, if your application suite uses them.
  8. Execute the application suite and use its functionality in a way that exercises 80% of its EJB methods and accesses 100% of its JSP pages and servlets.
  9. Stop the instrumented J2EE server.
  10. Run the reporting tool to produce verification results.
  11. Interpret the results produced by the reporting tool.

The following sections describe these steps in detail.

Adding the Ant Tasks to your Build File

You will find a sample build.xml file containing the Java AVK for the Enterprise Ant tasks in the following directory:

<JAVKE_HOME>/samples

This file also contains some sample Ant targets that you can run in order to become familiar with the tasks before you adapt them for your own code. The code for running the targets is also in the samples directory.

You can either add the necessary code to the build.xml file for your application, or you can create a separate targets file (javke_targets.xml, for example) and include it in the application build.xml file:

<!DOCTYPE project [
  <!ENTITY javke_targets SYSTEM "./javke_targets.xml">
]>
 ...
&javke_targets;

The tasks you can use are defined as follows in the sample build.xml file:

<taskdef name="ArchiveTest"
classname="org.apache.tools.ant.taskdefs.optional.sun.verification.StaticArchive
Test" 
classpath="${cpath}" />

<taskdef name="TranslateRuntimeDD" 
classname="org.apache.tools.ant.taskdefs.optional.sun.verification.TranslateRuntimeDD" 
classpath="${cpath}"/>

You must define the classpath to include the following:

<property name="cpath" value="${avk.home}/lib/javke-ant.jar"/>

You must also define a property named avk.home whose value is the directory where the Java AVK for the Enterprise is installed. The samples directory has a build.properties file that defines this property; you can add the property to your own build.properties file or define the property explicitly.

The file in the samples directory contains sample targets that use the tasks:

  • The static-archive-test target uses the ArchiveTest task to validate an archive file against the J2EE specifications.
  • The translate-dd target uses the TranslateRuntimeDD task to convert runtime deployment descriptors from other application servers into Application Server deployment descriptors.

You do not have to have the Application Server running in order to use these tasks.

The following sections provide details about using the tasks.

Note: The SourceScan task, which scans source code for proprietary APIs, is still available but is obsolete. The ArchiveTest task has been enhanced to detect proprietary APIs. You can continue to use the SourceScan task at this release if you do not wish to modify your build files at this time. However, the task will be removed from a future release of the Java AVK for the Enterprise.

Performing Static Verification Tests

The tasks that perform the static verification tests do the following:

Static Archive Testing

Use the ArchiveTest task to ensure that your application modules comply with the J2EE specifications. This task identifies and reports problems with the module file components' method signatures and other static inconsistencies. It looks at all components of the file and reports any inconsistencies with the API and deployment descriptors defined in the J2EE specifications. It also validates the packaging and structure of the modules. For example, the following target in the sample build.xml file scans the WAR file bookstore.war:

<target name="static-archive-test" description="static archive tests for 
application containing web components, reporting on all tests">
  <ArchiveTest appName="${avk.home}/samples/bookstore/bookstore.war"
               reportingOpts="a" />
</target>

The appName attribute is required. The value can be the path name of an EAR, JAR, WAR, or RAR file. If you use the task without defining any other attributes, it scans all modules in the archive and reports all failures and warnings. At the end, it provides the path names where you can find the results:

>asant static-archive-test
Buildfile: build.xml

static-archive-test:
     [exec] Dec 12, 2005 6:16:46 PM APIRepository Initialize
     [exec] INFO: C:\Sun\AppServer\lib\verifier\standard-apis.xml
     [exec] Dec 12, 2005 6:16:47 PM com.sun.enterprise.tools.verifier.BaseVerifier preVerification
     [exec] INFO: Verifying: [ bookstore ]
     [exec] Dec 12, 2005 6:16:47 PM com.sun.enterprise.tools.verifier.apiscan.packaging.Archive listAllExtDirs
     [exec] INFO: Extension Dir Path is C:\jdk1.5.0_05\jre\lib\ext;C:\Sun\AppServer\domains\domain1\lib\ext
     [exec] Dec 12, 2005 6:16:47 PM com.sun.enterprise.tools.verifier.web.WebVerifier getClassPath
     [exec] INFO: Using CLASSPATH C:\Documents and Settings\me\Local Settings\Temp\exploded20051212061646\
bookstore\WEB-INF\classes\;C:\DOCUME~1\me\LOCALS~1\Temp\.vc0.0327003
     [exec] Dec 12, 2005 6:16:47 PM com.sun.enterprise.tools.verifier.tests.web.AllJSPsMustBeCompilable compile
     [exec] INFO: Starting to compile JSPs with archiveUri C:\DOCUME~1\me\LOCALS~1\Temp\exploded20051212061646\bookstore
     [exec] Dec 12, 2005 6:16:47 PM com.sun.enterprise.tools.verifier.tests.web.AllJSPsMustBeCompilable compile
     [exec] INFO: JSPC classpath C:\Documents and Settings\me\Local Settings\Temp\exploded20051212061646\
bookstore\WEB-INF\classes\;C:\DOCUME~1\me\LOCALS~1\Temp\.vc0.0327003;C:\Sun\AppServer\lib\j2ee.jar;C:\Sun\
AppServer\lib\jaxrpc-api.jar;C:\Sun\AppServer\lib\jaxr-api.jar;C:\Sun\AppServer\lib\saaj-api.jar;C:\Sun\AppServer\
lib\mail.jar;
     [exec] Dec 12, 2005 6:16:48 PM com.sun.enterprise.tools.verifier.ReportHandler writeToConsole
     [exec] INFO:
     [exec] # of Failures : 0
     [exec] # of Warnings : 0
     [exec] # of Errors   : 0
     [exec] Dec 12, 2005 6:16:48 PM com.sun.enterprise.tools.verifier.ReportHandler writeToConsole
     [exec] INFO: Look in file "C:\Sun\javke1.4.2\reporttool\static\bookstore.war.txt" for detailed results.
     [echo] See "C:\Sun\javke1.4.2\reporttool\static\verifierSummary.html" for results.

BUILD SUCCESSFUL

You can use the attributes listed in Table 3 to change the reports.

Table 3. Ant Task Attributes for Static Archive Testing
Attribute Description
reportingOpts Changes the level of reporting. Specify any of the following values:
w or "" Report only warning and failure results (default)
f Report only failure results
a Report all results, including passed tests and tests that are not applicable
partitionOpts Limit the verification process to one or more component types. You can specify any of the following, using a comma as separator:
ejb Enterprise bean module tests
web Web module tests
webservices Web services (both EJB and web) tests
connector Connector tests
app Application module tests
appclient Application client tests
webservicesclient Web services client tests

For example, you could specify the following to generate reports showing only failures, on only the application client and enterprise bean components of an EAR file:

<target name="archive-test" description="static archive tests">
  <ArchiveTest appName="./MyApp.ear" 
               reportingOpts="f" 
               partitionOpts="appclient,ejb" />
</target>

The summary page from the static archive tests shows the failures, warnings, passes and nonapplicable test results for each of the modules of the J2EE platform contained in the application. Each result contains a link to detailed information, including a description of the test that was run, the assertion in the specification being tested, and the name of the test. In addition, the summary includes a section that lists any errors the static archive tests encountered.

If your code contains proprietary APIs, you will need to provide portable, functionally equivalent alternative code that can be executed instead of the proprietary APIs. You will need to rebuild your application using the alternative code in order to verify it.

Note: For a few static archive tests, execution of the tests stops after the first failed test. Once you have corrected a failure, run the static archive test task again in order to find and correct further failures.

Translating Runtime Deployment Descriptors

Every application server has its own runtime deployment descriptors that specify implementation-specific aspects of deployment. An application that previously ran on another J2EE server must convert its runtime deployment descriptors to work with the Application Server. This process does not replace your original module or application; instead, it creates a new one with new deployment descriptors.

Use the TranslateRuntimeDD task to generate the deployment descriptors. For example, the following target in the sample build.xml file converts the deployment descriptors for the EAR file HelloWorld.ear from WebLogic 6 to the Application Server:

<target name="translate-dd" description="translate runtime DD for 
deployment">
  <TranslateRuntimeDD 
archiveName="${avk.home}/samples/weblogic_6_x/HelloWorld/HelloWorld.ear"
                      srcServer="weblogic6" />

Both the archiveName and the srcServer attributes are required. The srcServer attribute specifies the server that was used to generate the application. It can have any one of the following values:

sunone65 Sun ONE Application Server 6.x
sjsappserver7 Sun Java System Application Server 7.x
weblogic5 BEA WebLogic Server 5.1
weblogic6 BEA WebLogic Server 6.0
weblogic61 BEA WebLogic Server 6.1
weblogic81 BEA WebLogic Server 8.1
websphere4 IBM WebSphere Application Server 4.x
websphere5 IBM WebSphere Application Server 5.x
jboss3 JBoss 3.x
j2eesdk13 Sun J2EE 1.3.x SDK
j2eesdk14 Early-access and Beta versions of Sun J2EE 1.4 SDK
tomcat Apache Tomcat 4.1

If you run the translate-dd target, it generates the following output:

>asant translate-dd
Buildfile: build.xml

translate-dd:
     [echo] Some xml files may not have translated correctly.
     [java]       [war] Warning: selected war files include a WEB-INF/web.xml 
which will be ignored (please use webxml attribute to war task)
     [java]       [ear] Warning: selected ear files include a 
META-INF/application.xml which will be ignored (please use appxml attribute to 
ear task)

     [java] BUILD SUCCESSFUL
     [java] Total time: 3 seconds
     [echo] See "C:\Sun\javke1.4.2\reporttool\translate\translationSummary.html" 
for results.
     [echo] We attempted to create an ear file even if minor errors occurred. 
The application with translated deployment descriptors is in a new .ear file 
located in C:\Sun\javke1.4.2\reporttool\translate\Input_Archives\asmtbuild 

BUILD SUCCESSFUL

Do not use the new EAR file created by the task. Instead, open the translationSummary.html file in a web browser. This file shows the locations of the new runtime descriptors, which begin with the prefix sun-. Add these descriptors to your original application.

Note: The task also generates new standard descriptors (application.xml, ejb-jar.xml, web.xml); do not add these to your application.

Starting the Instrumented Application Server

After you perform static archive testing, start the Application Server with instrumentation turned on. The installation process for the Java AVK for the Enterprise modifies the server configuration files to enable instrumentation. As a result, when you start the server, instrumentation is enabled.

To start the server, use the following command:

UNIX: <JAVKE_HOME>/appserver/bin/asadmin start-domain domain1
Windows: <JAVKE_HOME>\appserver\bin\asadmin start-domain domain1

Use the --verbose option to display the server log output:

asadmin start-domain --verbose domain1

For database access, you can use the Derby database that is part of the Application Server. It has a preconfigured Java Database Connectivity (JDBCTM) resource and connection pool. See the Sun Java System Application Server Platform Edition 8.2 Developer's Guide for details on using the JDBC API for database access.

If your application uses a database, start the database now. Use the following command:

asadmin start-database

Creating Resources for the Application Suite

If your application uses server resources, you create them administratively. For example, you can use the Admin Console or the asadmin command to create JDBC resources, Java Message Service (JMS) resources and destinations, connector resources, users and groups for security realms, and the like.

To use the Admin Console, open the URL http://localhost:4848/ in a browser. Enter your administrative username and password (created when you installed the Application Server).

You can use the Admin Console help system, the asadmin help command, and the J2EE 1.4 Tutorial to learn more.

Specifying Runtime Information

Before you deploy your application, you should open each module in the Application Server deployment tool and verify that the runtime information required by the Application Server is correct. Much of this information consists of the Java Naming and Directory InterfaceTM (JNDI) API names of any resources used by the application. To do this, perform the following steps:

  1. Start the deployment tool with no arguments:
  2. UNIX: <JAVKE_HOME>/appserver/bin/deploytool
    Windows: <JAVKE_HOME>\appserver\bin\deploytool
  3. Choose Open from the File menu to open each module in your application suite in the deploytool.
  4. Expand each module in turn. For each module, look at the Sun-specific Settings. Start with the module as a whole. The Sun-specific Settings dialog has several panes you can view. Work your way down through the JAR and WAR files to the individual component level. Fill in or correct any values your application needs.
  5. Choose Save from the File menu to save each module.

Specific places where you need to set runtime information include the following tabs in the right-hand pane of the deploytool:

  • EJB Refs tab: Specify the JNDI name if the enterprise bean uses a remote interface.
  • Resource Refs tab: Specify the JNDI name for each resource.
  • Message Destinations tab -- Specify the JNDI name of the target destination resource. You may also need to specify the physical destination name.
  • Resource Env Refs tab -- Specify the JNDI name of the target destination resource.
  • Web Services tab -- specify the WSDL publish location.
  • Entity tab (for an entity bean) -- see Generating Database Tables for Entity Beans.
  • Message-Driven tab (for a message-driven bean) -- Specify the JNDI name of the associated connection factory for the message-driven bean.

Generating Database Tables for Entity Beans

For each entity bean in your application suite, you need to generate database tables. You may use the Derby database that comes with the Application Server. It has a preconfigured JDBC connection pool called DerbyPool and a preconfigured JDBC resource called jdbc/__default. You can use this resource or create your own administratively with the Admin Console.

If you have a database that needs to be prepopulated with data, the simplest way to this is to create an asant task. The task and the property and path settings it uses would look like this:

  <property name="db.delimiter"  value=";" />
  <property name="db.root"  value="${j2ee.home}/derby" />
  <property name="db.driver"  value="org.apache.derby.jdbc.ClientDriver" />
  <property name="db.datasource"  value="org.apache.derby.jdbc.ClientDataSource" />
  <property name="db.host"  value="localhost" />
  <property name="db.port"  value="1527" />
  <property name="db.sid"  value="sun-appserv-samples" />
  <property name="db.url"  
value="jdbc:derby://${db.host}:${db.port}/${db.sid};create=true;" />
  <property name="db.user"  value="APP" />
  <property name="db.pwd"  value="APP" />
  <property name="db.jvmargs"  value="-ms16m -mx32m" />
  <property name="sql.script"  value="YOUR SCRIPT PATH NAME HERE" />
  
  <path id="db.classpath">
    <fileset dir="${db.root}/lib">
      <include name="*.jar"/>
    </fileset>
  </path>

  <target name="create-db" depends="init"
     description="Create database tables and populate database." >

     <sql driver="${db.driver}"
          url="${db.url}"
          userid="${db.user}"
          password="${db.password}"
          classpathref="db.classpath"
          delimiter="${db.delimiter}"
          autocommit="false"
          onerror="abort" >
          
  </target>

You need to specify the SQL script that will create the database and modify the properties as needed.

If your entity bean uses container-managed persistence, you can specify the resource in the deploytool and create tables as follows:

  1. In the tree view, select the node for the entity bean.
  2. Click the Entity tab, then click CMP Database (Sun-specific).
  3. In the JNDI Name field of the dialog box, type the name of the JDBC resource, either the preconfigured one (jdbc/__default) or the one you created (jdbc/resource_name). For all other settings, the bean will use the default values.
  4. Click Create Database Mappings.
  5. In the dialog box, verify that Automatically Generate Necessary Tables is selected. Select the Datasource Vendor (Derby), then click OK.
  6. Click Table Generation Settings.
  7. Verify that Create Tables on Deploy and Delete Tables on Undeploy are both checked, then click OK.
  8. Click Close.
  9. Choose Save from the File menu to save the modified application.

For more information on using container-managed persistence for entity beans, see the Sun Java System Application Server Platform Edition 8.2 Developer's Guide.

Deploying the Application Suite

Next, deploy the application suite on the instrumented Application Server. In the deploytool, select each application or module and choose Tools->Deploy.

If you are new to the Application Server, you can learn how to create, package, and deploy an application by following the instructions in the Getting Started chapter of the J2EE 1.4 Tutorial.

Creating an Exclude List for Component Libraries

The Java AVK for the Enterprise reporting tool by default processes all deployed EAR files and standalone modules, assuming that they are part of the same application suite. Normally, you should undeploy any modules that are not part of the application suite that you are verifying.

Often, however, an application suite includes component libraries that are used by the application but are not part of it. Such libraries generally come from another vendor and have already been verified. You can configure the Java AVK for the Enterprise to exclude these libraries, or modules within them, from the runtime verification process.

For example, suppose that vendor Wombat has developed an application named WombatApp that it wants to verify. WombatApp depends on another application, KangarooApp (a component library) in order to be functional. KangarooApp is supplied by vendor Kangaroo, which has already verified it. Vendor Wombat wants to verify only WombatApp and not KangarooApp.

To exclude some or all of an application from verification, you edit the file <JAVKE_HOME>/config/appVerification/AppExcludeList.xml to indicate which application or component of the application must be excluded.

Suppose that WombatApp.ear contains the following modules:

ejb1.jar 
ejb2.jar 
web1.war 
web2.war

And suppose that KangarooApp.ear contains the following modules:

ejb3.jar 
ejb4.jar 
web3.war 
web4.war

To exclude all of KangarooApp from the verification process, you would specify the following:

<exclude-list>
     <j2ee-app>
         <name>KangarooApp</name>
     </j2ee-app>
</exclude-list>

To exclude only two components of KangarooApp, ejb3.jar and web4.war, you would specify the following:

<exclude-list>
     <j2ee-app>
         <name>KangarooApp</name>
         <ejb-bundle>
             <name>ejb3.jar</name>
         </ejb-bundle>
         <web-bundle>
             <name>web4.war</name>
         </web-bundle>
     </j2ee-app>
</exclude-list>

You use the j2ee-app element to specify an application EAR file. Use the ejb-app or web-app tag to specify a standalone EJB JAR file or web WAR file. For example:

    <ejb-app>
        <name>EjbModule</name>
    </ejb-app>
    <web-app>
        <name>WebModule</name>
    </web-app>

For more details, you can find the DTD for for AppExcludeList.xml in the file <JAVKE_HOME>/dtds/application-verification-app-exclude_1_4.dtd.

When you make entries in the AppExcludeList.xml file, do not provide a file extension for standalone module names (EAR files, EJB JAR files, or WAR files). For example, you would not provide a .ear extension for KangarooApp. (This instruction assumes that you observe the convention that the root name of the file is the name of the module. If the names are not the same, use the module name, not the root name of the file.)

Provide a .jar or .war file extension for an EJB JAR or web WAR file contained within an application.

After you edit AppExcludeList.xml, you can perform runtime verification on your application. The applications and components specified in the file will not be included in the verification reports.

The file AppExcludeList.xml contains some fictitious entries that illustrate how to use it. You can leave these entries in the file, remove them, or comment them out.

Executing the Application Suite

After you deploy the application suite, you must run it so as to invoke as much of its functionality as possible. In this step, you either manually or automatically invoke the JSP pages, servlets, and public EJB methods.

Stopping the Instrumented J2EE Server

When you have finished the execution step, stop the server using the following command:

UNIX: <JAVKE_HOME>/appserver/bin/asadmin stop-domain
Windows: <JAVKE_HOME>\appserver\bin\asadmin stop-domain

Do not undeploy the application.

This command does several things as the server shuts down. First, it writes all data collected during the test execution of the application suite to disk. In addition, the server performs introspection on the deployed application suite and generates the list of J2EE public APIs (including EJB methods and web components).

Running the Reporting Tool

To use the reporting tool to produce results after the run, use the following command:

<JAVKE_HOME>/bin/reporttool -result

This command generates HTML pages describing all relevant information found during the testing and server shutdown processes.

The HTML pages are generated in the reporttool directory with the top-level page <JAVKE_HOME>/reporttool/results/suiteSummary.html. The results generated by the reporting tool are described in Interpreting the Results.

To remove the results and reports generated by the instrumentation code from the <JAVKE_HOME>/reporttool/results directory, run the reporting tool with the -clear_results option:

<JAVKE_HOME>/bin/reporttool -clear_results

Use this option if an exception was thrown during dynamic checking and you have fixed the problem. In order to remove the exception from the results, you must clear all the results.

Interpreting the Results

The Java AVK for the Enterprise reporting tool compares introspection and instrumentation results and produces reports from that comparison. From the comparison of the results, the reporting tool generates a set of HTML files and displays the URL of the top-level summary report.

The reporting tool provides a status of Pass or Fail when summarizing the results. These numbers are based on the criteria mentioned in Coverage.

The summary page of the generated reports contains pointers to the results of the static archive tests, a summary of the EJB method coverage for each module, and a summary of the web component coverage.

The two kinds of coverage reports are described in the following sections:

EJB Method Coverage Reports

EJB method coverage is reported by EAR file or module. The guideline is that at least 80% of the EJB methods within each module must be covered.

The EJB Method Coverage page expands the EAR file or module contents and lists the JAR files and beans in each file, with the coverage. The Methods Called column shows the number of methods called versus the total number of methods for each bean. Clicking on the bean name brings up the EJB Method Coverage Detail page, which displays the status of each method within that bean. The first table contains the methods that were not called successfully. Either those methods were not called at all, or an exception was thrown during the call. The next table shows all methods that were called successfully. This information can be used to determine which methods need to be invoked to increase the coverage to meet the guidelines if the guidelines were not met.

Web Component Coverage Reports

Web component coverage is reported by context. The guideline is that 100% of the JSP pages and servlets must be called with no exceptions generated.

The table on the summary page reports the percentage of the web components that were called. Clicking on either Passed or Failed brings up the Web Component Coverage page, which lists each component by the context root, whether or not it was called, and if so, whether there was an exception. This information can be used to determine which web components must be called to increase the coverage to meet the guidelines.

The coverage reports do not list JSP pages that are included by other JSP pages using an include directive. Instead, the reports list only the JSP pages that contain the include directives for these pages. JSP pages included with an include action, however, are listed in the coverage reports.

How the Tools Produce Results

This section describes how the tools collect dynamic data and generate metrics using two primary mechanisms: introspection and instrumentation. It covers the following topics:

Introspection

The introspection process generates the list of required EJB methods to be invoked. The list contains all public methods in the bean's remote and local interfaces, the onMessage method for message-driven beans, and all create methods for session and entity beans. It excludes the methods that are on the Exclude List (the file <JAVKE_HOME>/config/appVerification/ExcludeList.xml, not to be confused with AppExcludeList.xml). A list of excluded methods is provided as input to the introspection process, and in addition, other methods are excluded when the tool is dynamically generating the final required list. For example, all CMP and CMR fields supporting set and get methods are excluded from the final list, and all remove methods, finder methods, and the create methods for message-driven beans are excluded as well.

The list of required web components contains all servlets and JSP pages that have entries in the web.xml file and all files ending with .jsp.

This combination of the EJB and web component lists is the master list that determines which EJB methods and web components must be called. This information is used in calculating the percentage numbers.

Instrumentation

The instrumented Application Server has been modified to log all invocations during execution. For EJB components, that means all invocations of public business methods, of the ejbCreate method for session and entity beans, and of the ejbRemove method. In addition, the server records any system exceptions that were thrown while a method was executed. Each web component that is invoked is also recorded. The combination of these two lists is the total list of invoked entities. This total list is used when comparing against what was generated from introspection.

Additional Notes

Each time the reporting tool runs, it compares the instrumentation and introspection results and produces the results.

You may start the server again and call additional J2EE public API methods. Instrumentation results from this run will be merged with existing instrumentation results.

Introspection is run each time the Application Server is shut down. This increases the time required to shut down the server.

Obtaining Support for the Java AVK for the Enterprise

Technical support from Sun is available. For details, go to the Java AVK for the Enterprise web page:

http://java.sun.com/j2ee/verified/avk_enterprise.html

Further Information

For more information about the Java programming language, the J2EE platform, and portability, refer to the following:


Related Links
 


Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.