HP Integrity NonStop J-Series User Manual

Open Source Java Frameworks on NonStop User's Guide (Spring 3.1.0, Hibernate
4.1.1, MyFaces 2.0.2, Axis2/Java 1.5.2)
HP Part Number: 698927-002 Published: December 2012 Edition: J06.11 and subsequent J-series RVUs and H06.22 and subsequent H-series RVUs.
© Copyright 2012 Hewlett-Packard Development Company, L.P.
Legal Notice
The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.
Export of the information contained in this publication may require authorization from the U.S. Department of Commerce.
Microsoft, Windows, and Windows NT are U.S. registered trademarks of Microsoft Corporation.
Intel, Pentium, and Celeron are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
Java is a registered trademark of Oracle and/or its affiliates.
Motif, OSF/1, UNIX, X/Open, and the "X" device are registered trademarks, and IT DialTone and The Open Group are trademarks of The Open Group in the U.S. and other countries.
Open Software Foundation, OSF, the OSF logo, OSF/1, OSF/Motif, and Motif are trademarks of the Open Software Foundation, Inc. OSF MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THE OSF MATERIAL PROVIDED HEREIN, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. OSF shall not be liable for errors contained herein or for incidental consequential damages in connection with the furnishing, performance, or use of this material.
JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.
Spring Framework is an open source project and is a trademark of Interface 21.
© 1990, 1991, 1992, 1993 Open Software Foundation, Inc. The OSF documentation and the OSF software to which it relates are derived in part from materials supplied by the following:© 1987, 1988, 1989 Carnegie-Mellon University. © 1989, 1990, 1991 Digital Equipment Corporation. © 1985, 1988, 1989, 1990 Encore Computer Corporation. © 1988 Free Software Foundation, Inc. © 1987, 1988, 1989, 1990, 1991 Hewlett-Packard Company. © 1985, 1987, 1988, 1989, 1990, 1991, 1992 International Business Machines Corporation. © 1988, 1989 Massachusetts Institute of Technology. © 1988, 1989, 1990 Mentat Inc. © 1988 Microsoft Corporation. © 1987, 1988, 1989, 1990, 1991, 1992 SecureWare, Inc. © 1990, 1991 Siemens Nixdorf Informationssysteme AG. © 1986, 1989, 1996, 1997 Sun Microsystems, Inc. © 1989, 1990, 1991 Transarc Corporation.OSF software and documentation are based in part on the Fourth Berkeley Software Distribution under license from The Regents of the University of California. OSF acknowledges the following individuals and institutions for their role in its development: Kenneth C.R.C. Arnold, Gregory S. Couch, Conrad C. Huang, Ed James, Symmetric Computer Systems, Robert Elz. © 1980, 1981, 1982, 1983, 1985, 1986, 1987, 1988, 1989 Regents of the University of California.

Contents

About This Document.....................................................................................6
Supported Release Version Updates (RVUs)..................................................................................6
Intended Audience....................................................................................................................6
New and Changed Information in This Edition..............................................................................6
Document Organization............................................................................................................7
Notation Conventions................................................................................................................8
General Syntax Notation......................................................................................................8
Notation for Messages.......................................................................................................10
Notation for Management Programming Interfaces.................................................................11
General Syntax Notation....................................................................................................12
Related Information.................................................................................................................13
Publishing History...................................................................................................................13
HP Encourages Your Comments................................................................................................13
1 Introduction.............................................................................................14
2 Spring Framework....................................................................................16
Spring Overview....................................................................................................................16
Spring Projects..................................................................................................................16
Spring Applications on NonStop..........................................................................................17
Installing the Spring Framework................................................................................................18
Prerequisites......................................................................................................................18
Installing Spring Framework Libraries on a NonStop System.....................................................18
Setting up Sample Spring Applications on NonStop...............................................................20
Integrating Spring with Transaction Management Facility (TMF)....................................................27
What is Spring TMF Adapter?.............................................................................................27
Setting up the Sample SpringTMFAdapter on NonStop...........................................................28
Configuring Spring Applications on NonStop Systems.................................................................34
Spring Framework Configurations.........................................................................................34
Getting Started with Spring......................................................................................................38
Prerequisites......................................................................................................................39
Overview of EmpInfo..........................................................................................................39
3 Hibernate Framework................................................................................90
Hibernate Overview................................................................................................................90
Hibernate Projects..............................................................................................................90
Hibernate Applications on NonStop.....................................................................................91
Installing the Hibernate Framework...........................................................................................92
Prerequisites......................................................................................................................92
Installing Hibernate Framework Libraries on NonStop.............................................................92
Customizing the Hibernate Dialect for NonStop.....................................................................95
Setting up Sample Hibernate Applications on NonStop...........................................................98
Configuring Hibernate Applications on NonStop Systems...........................................................106
Hibernate Framework Configurations for NonStop Systems....................................................106
Enabling Browse Access...................................................................................................115
Getting Started with Hibernate...............................................................................................120
Prerequisites....................................................................................................................120
Overview of EmpIoyeeInfo................................................................................................120
4 MyFaces Framework...............................................................................145
MyFaces Overview...............................................................................................................145
MyFaces Projects.............................................................................................................145
MyFaces Application on NonStop......................................................................................146
Contents 3
Installing MyFaces Framework................................................................................................146
Prerequisites....................................................................................................................147
Downloading MyFaces Framework Libraries on Windows......................................................147
Deploying and Running Sample MyFaces Application on NonStop........................................148
Configuring MyFaces Applications on NonStop Systems............................................................150
Getting Started with MyFaces.................................................................................................150
Prerequisites....................................................................................................................150
Overview of SkinSelector..................................................................................................151
5 Axis2/Java Framework...........................................................................181
Axis2/Java Overview............................................................................................................181
Apache Axis2/Java Project...............................................................................................181
Axis2/Java Framework.....................................................................................................181
Axis2/Java Modules........................................................................................................181
Axis2/Java Applications on NonStop.................................................................................181
Installing Axis2/Java Framework............................................................................................183
Prerequisites....................................................................................................................183
Installing Axis2/Java on NonStop......................................................................................184
Installing the Sandesha2 Module.......................................................................................186
Installing the Rampart Module...........................................................................................188
Deploying and Running Axis2/Java Sample Applications on NonStop....................................189
Configuring Axis2/Java Applications on NonStop Systems........................................................195
Axis2/Java Framework Configurations for NonStop Systems..................................................195
Getting Started with Axis2/Java.............................................................................................196
Prerequisites....................................................................................................................196
Overview of TemperatureConverter.....................................................................................196
6 Integrating Frameworks...........................................................................222
Using Spring Transaction Manager.........................................................................................222
Why Transaction Management is required..........................................................................222
Spring Transaction Management........................................................................................222
Example of Using Spring Transaction Manager....................................................................222
Integrating Hibernate into Spring............................................................................................237
Why Integrate Hibernate into Spring..................................................................................237
Example of Integrating Hibernate into Spring.......................................................................238
Developing Spring JPA Applications Using Hibernate................................................................248
Example of Developing Spring JPA Applications Using Hibernate...........................................248
Integrating Axis2/Java into Spring..........................................................................................259
Why Integrate Axis2/Java into Spring................................................................................259
Example of Integrating Axis2/Java with Spring....................................................................259
Integrating MyFaces into Spring.............................................................................................281
Why Integrate MyFaces into Spring....................................................................................281
Example of Integrating MyFaces into Spring........................................................................282
A EmpInfo Database Script.........................................................................319
B NonStop Specific Configurations..............................................................320
NonStop Platform Configurations............................................................................................320
Determining the Application Parameters..............................................................................320
Determining the Maximum Capacity of NSJSP Instance.........................................................320
Configuring iTP WebServer for Spring, Hibernate, MyFaces, and Axis2/Java Applications........321
Configuring NSJSP for Spring, Hibernate, MyFaces, and Axis2/Java Applications...................325
Module File Caching Configurations.......................................................................................330
Recommendations............................................................................................................330
Configuring NonStop SQL/MX DataSource for MFC............................................................330
4 Contents
C Deploying Sample Applications on NonStop.............................................331
D Sample JDBC Configuration for Spring......................................................334
E Installing Spring Web Flow......................................................................336
Downloading Spring Web Flow Distribution on Windows..........................................................336
Copying Spring Web Flow Runtime Libraries from Windows to NonStop......................................336
F Sample JDBC Configuration for Hibernate..................................................338
G Hibernate Environment Setup Script..........................................................339
H Installing MyFaces Trinidad/Tomahawk Framework Libraries on NonStop......340
Downloading MyFaces Trinidad/Tomahawk Distribution............................................................340
Copying MyFaces Trinidad Runtime Libraries from Windows to NonStop......................................340
I Frequently Asked Questions......................................................................341
Glossary..................................................................................................344
Index.......................................................................................................347
Contents 5

About This Document

This manual provides information on how Spring, Hibernate, MyFaces, and Axis2/Java frameworks, referred to as SASH, can be used to develop applications that can run on the HP NonStop™
system. The relevant sections contain information on:
Installing and configuring these frameworks on NonStop
Developing sample web applications using these frameworks
Integrating Spring with Hibernate, MyFaces, and Axis2/Java frameworks
For detailed information about a framework, see the links to online and public resources provided in the relevant sections.
NOTE:
This manual does not explain the frameworks in detail; however, it provides information to
get you familiarized with these frameworks. The frameworks have not been modified or customized for use on NonStop.
This manual includes code snippets and code for sample applications for all frameworks. HP
recommends that you copy the code to a text editor so that unwanted special and ASCII characters are not copied along with the code you want to use to build and test your applications.

Supported Release Version Updates (RVUs)

This manual supports J06.11 and all subsequent J-series RVUs, and H06.22 and all subsequent H-series RVUs, until otherwise indicated by its replacement publications.

Intended Audience

This manual is intended for application programmers who want to develop Java-based web applications using Spring, Hibernate, MyFaces, or Axis2/Java frameworks.

New and Changed Information in This Edition

Changes to 698927–002 Manual:
Updated the supported RVU information on the cover page and in the “Supported Release
Version Updates (RVUs)” (page 6) section.
Changes to 698927–001 Manual:
Updated the Prerequisites in the “Installing the Spring Framework” (page 18) section.
Updated the Spring distribution version in the “Downloading the Spring Distribution on
Windows” (page 19) section.
Added the Prerequisites for the Spring sample applications in the “Setting up Sample Spring
Applications on NonStop” (page 20) section.
Added the “Integrating Spring with Transaction Management Facility (TMF)” (page 27) section.
Updated “Configurations in the applicationContext.xml File” (page 35) under “Spring
Framework Configurations” (page 34).
Added “Configuring TmfTransactionManager” (page 36).
Added a note in “Hibernate Overview” (page 90).
Updated the Prerequisites in the “Installing the Hibernate Framework” (page 92) section.
6
Updated the Hibernate distribution version in the “Downloading the Hibernate Distribution on
Windows” (page 93) section.
Added the “Downloading Hibernate Dependency JAR Files using Gradle” (page 93) section.
Added the “Customizing the Hibernate Dialect for NonStop” (page 95) section.
Added a note and the Prerequisites for the Hibernate sample applications in the “Setting up
Sample Hibernate Applications on NonStop” (page 98) section.
Updated “Connection Pooling” (page 112).
Added recommendations under “Module File Caching Configurations” (page 330).

Document Organization

This manual is organized as follows:
Chapter 1: Introduction
This chapter provides an overview of Java frameworks on NonStop systems.
This chapter describes the following topics:Chapter 2: Spring Framework
An overview of Spring
Installing and configuring Spring Framework
Developing sample Java applications using Spring
Integrating Spring with TMF
This chapter describes the following topics:Chapter 3: Hibernate Framework
An overview of Hibernate
Installing and configuring Hibernate on NonStop
Developing sample Java applications using Hibernate
Customizing Hibernate dialect for NonStop
This chapter describes the following topics:Chapter 4: MyFaces Framework
An overview of MyFaces
Installing and configuring MyFaces on a NonStop
system
Developing sample Java applications using MyFaces
This chapter describes the following topics:Chapter 5: Axis2/Java Framework
An overview of Axis2/Java
Installing and configuring Axis2/Java on NonStop
Developing sample Java applications using Axis2/Java
Appendix B: NonStop Specific Configurations
Appendix C: Deploying Sample Applications on NonStop
This chapter provides you information on how to:Chapter 6: Integrating Frameworks
Use the Spring Transaction Manager
Integrate Spring into Hibernate
Develop Spring JPA applications using Hibernate
Integrate Axis2/Java into Spring
Integrate MyFaces into Spring
This appendix contains the EmpInfo database script.Appendix A: EmpInfo Database Script
This appendix provides information on the common NonStop configuration requirements for the frameworks.
This appendix describes how to deploy sample applications on NonStop systems.
Document Organization 7
Appendix D: Sample JDBC Configuration for Spring
This appendix describes the JDBC configuration for the Spring framework using NonStop JDBC Type 2 and JDBC Type 4 drivers.
Appendix E: Installing Spring Web Flow
Appendix F: Sample JDBC Configuration for Hibernate
Appendix H: Installing MyFaces Trinidad/Tomahawk Framework Libraries on NonStop
Appendix I: Frequently Asked Questions

Notation Conventions

General Syntax Notation

This list summarizes the notation conventions for syntax presentation in this manual. UPPERCASE LETTERS
Uppercase letters indicate keywords and reserved words. Type these items exactly as shown. Items not enclosed in brackets are required. For example:
MAXATTACH
Italic Letters
Italic letters, regardless of font, indicate variable items that you supply. Items not enclosed in brackets are required. For example:
file-name
This appendix describes the steps required to install Spring Web Flow on your NonStop system.
This appendix describes the JDBC configuration for the Hibernate framework using NonStop JDBC Type 2 and JDBC Type 4 drivers.
This appendix contains the ei_setenv script.Appendix G: Hibernate Environment Setup Script
This appendix describes the steps required to install MyFaces Trinidad and Tomahawk framework libraries on your NonStop system.
This appendix provides answers to some frequently asked questions.
Computer Type
Computer type letters indicate:
C and Open System Services (OSS) keywords, commands, and reserved words. Type these items exactly as shown. Items not enclosed in brackets are required. For example:
Use the cextdecs.h header file.
Text displayed by the computer. For example:
Last Logon: 14 May 2006, 08:02:23
A listing of computer code. For example
if (listen(sock, 1) < 0) { perror("Listen Error"); exit(-1); }
Bold Text
Bold text in an example indicates user input typed at the terminal. For example:
ENTER RUN CODE
?123 CODE RECEIVED: 123.00
The user must press the Return key after typing the input.
8
[ ] Brackets
Brackets enclose optional syntax items. For example:
TERM [\system-name.]$terminal-name
INT[ERRUPTS]
A group of items enclosed in brackets is a list from which you can choose one item or none. The items in the list can be arranged either vertically, with aligned brackets on each side of the list, or horizontally, enclosed in a pair of brackets and separated by vertical lines. For example:
FC [ num ] [ -num ] [ text ]
K [ X | D ] address
{ } Braces
A group of items enclosed in braces is a list from which you are required to choose one item. The items in the list can be arranged either vertically, with aligned braces on each side of the list, or horizontally, enclosed in a pair of braces and separated by vertical lines. For example:
LISTOPENS PROCESS { $appl-mgr-name } { $process-name }
ALLOWSU { ON | OFF }
| Vertical Line
A vertical line separates alternatives in a horizontal list that is enclosed in brackets or braces. For example:
INSPECT { OFF | ON | SAVEABEND }
… Ellipsis
An ellipsis immediately following a pair of brackets or braces indicates that you can repeat the enclosed sequence of syntax items any number of times. For example:
M address [ , new-value ]
- ] {0|1|2|3|4|5|6|7|8|9}
An ellipsis immediately following a single syntax item indicates that you can repeat that syntax item any number of times. For example:
"s-char"
Punctuation
Parentheses, commas, semicolons, and other symbols not previously described must be typed as shown. For example:
error := NEXTFILENAME ( file-name ) ;
LISTOPENS SU $process-name.#su-name
Quotation marks around a symbol such as a bracket or brace indicate the symbol is a required character that you must type as shown. For example:
"[" repetition-constant-list "]"
Item Spacing
Spaces shown between items are required unless one of the items is a punctuation symbol such as a parenthesis or a comma. For example:
CALL STEPMOM ( process-id ) ;
If there is no space between two items, spaces are not permitted. In this example, no spaces are permitted between the period and any other items:
$process-name.#su-name
Notation Conventions 9
Line Spacing
If the syntax of a command is too long to fit on a single line, each continuation line is indented three spaces and is separated from the preceding line by a blank line. This spacing distinguishes items in a continuation line from items in a vertical list of selections. For example:
ALTER [ / OUT file-spec / ] LINE
[ , attribute-spec ]
!i and !o
In procedure calls, the !i notation follows an input parameter (one that passes data to the called procedure); the !o notation follows an output parameter (one that returns data to the calling program). For example:
CALL CHECKRESIZESEGMENT ( segment-id !i , error ) ; !o
!i,o
In procedure calls, the !i,o notation follows an input/output parameter (one that both passes data to the called procedure and returns data to the calling program). For example:
error := COMPRESSEDIT ( filenum ) ; !i,o
!i:i
In procedure calls, the !i:i notation follows an input string parameter that has a corresponding parameter specifying the length of the string in bytes. For example:
error := FILENAME_COMPARE_ ( filename1:length !i:i , filename2:length ) ; !i:i
!o:i
In procedure calls, the !o:i notation follows an output buffer parameter that has a corresponding input parameter specifying the maximum length of the output buffer in bytes. For example:
error := FILE_GETINFO_ ( filenum !i , [ filename:maxlen ] ) ; !o:i

Notation for Messages

This list summarizes the notation conventions for the presentation of displayed messages in this manual.
Bold Text
Bold text in an example indicates user input typed at the terminal. For example:
ENTER RUN CODE
?123 CODE RECEIVED: 123.00
The user must press the Return key after typing the input.
Nonitalic Text
Nonitalic letters, numbers, and punctuation indicate text that is displayed or returned exactly as shown. For example:
Backup Up.
Italic Text
Italic text indicates variable items whose values are displayed or returned. For example:
p-register
process-name
[ ] Brackets
Brackets enclose items that are sometimes, but not always, displayed. For example:
Event number = number [ Subject = first-subject-value ]
10
A group of items enclosed in brackets is a list of all possible items that can be displayed, of which one or none might actually be displayed. The items in the list can be arranged either vertically, with aligned brackets on each side of the list, or horizontally, enclosed in a pair of brackets and separated by vertical lines. For example:
proc-name trapped [ in SQL | in SQL file system ]
{ } Braces
A group of items enclosed in braces is a list of all possible items that can be displayed, of which one is actually displayed. The items in the list can be arranged either vertically, with aligned braces on each side of the list, or horizontally, enclosed in a pair of braces and separated by vertical lines. For example:
obj-type obj-name state changed to state, caused by { Object | Operator | Service }
process-name State changed from old-objstate to objstate { Operator Request. } { Unknown. }
| Vertical Line
A vertical line separates alternatives in a horizontal list that is enclosed in brackets or braces. For example:
Transfer status: { OK | Failed }
% Percent Sign
A percent sign precedes a number that is not in decimal notation. The % notation precedes an octal number. The %B notation precedes a binary number. The %H notation precedes a hexadecimal number. For example:
%005400
%B101111
%H2F
P=%p-register E=%e-register

Notation for Management Programming Interfaces

This list summarizes the notation conventions used in the boxed descriptions of programmatic commands, event messages, and error lists in this manual.
UPPERCASE LETTERS
Uppercase letters indicate names from definition files. Type these names exactly as shown. For example:
ZCOM-TKN-SUBJ-SERV
lowercase letters
Words in lowercase letters are words that are part of the notation, including Data Definition Language (DDL) keywords. For example:
token-type
!r
The !r notation following a token or field name indicates that the token or field is required. For example:
ZCOM-TKN-OBJNAME token-type ZSPI-TYP-STRING. !r
!o
The !o notation following a token or field name indicates that the token or field is optional. For example:
ZSPI-TKN-MANAGER token-type ZSPI-TYP-FNAME32. !o
Notation Conventions 11

General Syntax Notation

This list summarizes the notation conventions for syntax presentation in this manual. UPPERCASE LETTERS
Uppercase letters indicate keywords and reserved words. Type these items exactly as shown. Items not enclosed in brackets are required. For example:
SELECT
Italic Letters
Italic letters, regardless of font, indicate variable items that you supply. Items not enclosed in brackets are required. For example:
file-name
Computer Type
Computer type letters within text indicate case-sensitive keywords and reserved words. Type these items exactly as shown. Items not enclosed in brackets are required. For example:
myfile.sh
Bold Text
Bold text in an example indicates user input typed at the terminal. For example:
ENTER RUN CODE
?123 CODE RECEIVED: 123.00
The user must press the Return key after typing the input.
[ ] Brackets
Brackets enclose optional syntax items. For example:
DATETIME [start-field TO] end-field
A group of items enclosed in brackets is a list from which you can choose one item or none. The items in the list can be arranged either vertically, with aligned brackets on each side of the list, or horizontally, enclosed in a pair of brackets and separated by vertical lines. For example:
DROP SCHEMA schema [CASCADE] [RESTRICT]
DROP SCHEMA schema [ CASCADE | RESTRICT ]
{ } Braces
Braces enclose required syntax items. For example:
FROM { grantee[, grantee]...}
A group of items enclosed in braces is a list from which you are required to choose one item. The items in the list can be arranged either vertically, with aligned braces on each side of the list, or horizontally, enclosed in a pair of braces and separated by vertical lines. For example:
INTERVAL { start-field TO end-field } { single-field }
INTERVAL { start-field TO end-field | single-field }
| Vertical Line
A vertical line separates alternatives in a horizontal list that is enclosed in brackets or braces. For example:
{expression | NULL}
… Ellipsis
An ellipsis immediately following a pair of brackets or braces indicates that you can repeat the enclosed sequence of syntax items any number of times. For example:
ATTRIBUTE[S] attribute [, attribute]...
12
{, sql-expression}...
An ellipsis immediately following a single syntax item indicates that you can repeat that syntax item any number of times. For example:
expression-n
Punctuation
Parentheses, commas, semicolons, and other symbols not previously described must be typed as shown. For example:
DAY (datetime-expression) @script-file
Quotation marks around a symbol such as a bracket or brace indicate the symbol is a required character that you must type as shown. For example:
"{" module-name [, module-name]... "}"
Item Spacing
Spaces shown between items are required unless one of the items is a punctuation symbol such as a parenthesis or a comma. For example:
DAY (datetime-expression) DAY(datetime-expression)
If there is no space between two items, spaces are not permitted. In this example, no spaces are permitted between the period and any other items:
myfile.sh
Line Spacing
If the syntax of a command is too long to fit on a single line, each continuation line is indented three spaces and is separated from the preceding line by a blank line. This spacing distinguishes items in a continuation line from items in a vertical list of selections. For example:
match-value [NOT] LIKE pattern
[ESCAPE esc-char-expression]

Related Information

For a better understanding of the frameworks, see the following websites:
http://www.springsource.org
http://www.hibernate.org
http://myfaces.apache.org/
http://axis.apache.org/axis2/java/core/

Publishing History

HP Encourages Your Comments

HP encourages your comments concerning this document. We are committed to providing documentation that meets your needs. Send any errors found, suggestions for improvement, or compliments to docsfeedback@hp.com.
Include the document title, part number, and any comment, error found, or suggestion for improvement you have concerning this document.
Publication DateProduct VersionPart Number
November 2012698927-001
December 2012698927-002
Related Information 13

1 Introduction

Java-based web application development has been inundated by frameworks of every kind. There is a framework available for almost every application development requirement.
The effort for developing an application using the framework approach is significantly less as compared to developing an application afresh. The efficiency of Java-based Web development can be increased by using the appropriate framework.
OpenSource Java frameworks on NonStop systems offer a Java environment on NonStop systems that enable the development of Enterprise Java applications using standards-based, open source technologies that are architecturally compatible with NonStop systems.
HP certifies Spring, Hibernate, Apache MyFaces, and Apache Axis2/Java frameworks for use on NonStop systems.
Some of the advantages of these frameworks are:
Spring - provides a lightweight framework to implement the business logic.
Spring has a layered architecture and also provides an abstraction layer to integrate with other frameworks, such as Hibernate. It also provides lightweight remote support.
Hibernate - is an Object Relational Mapping (ORM) tool for database access.
Hibernate scales well in any environment and is highly extensible and customizable. It also supports lazy initialization, fetching strategies, and optimistic locking with automatic versioning and time stamping.
MyFaces - is a Java Server Faces (JSF) implementation used to design the user interface for
an application. MyFaces is a component-oriented, event-based framework, which also supports validation of
user inputs. It also provides useful features, such as support for Tiles, use of converters, etc.
Axis2/Java - is a web services SOAP and WSDL engine.
Axis2/Java is a high speed, flexible framework to develop web services. It provides features such as hot deployment, scalability, and WSDL support.
Axis2/Java can plug into servlet engines as a server and provides extensive support for the Web Service Description Language (WSDL). It also includes tools that can be used to create Java classes from the WSDL and back.
The frameworks are not restricted to these roles and can be customized for specific development requirements. The following versions of the frameworks are currently certified for use on NonStop:
Spring 3.0.2 and Spring 3.1.0
Hibernate 3.2.6, Hibernate 3.5.1, Hibernate 3.6.8, and Hibernate 4.1.1
MyFaces 1.2.5 and MyFaces 2.0.2
Axis2/Java 1.4.1 and Axis2/Java 1.5.2
NOTE: The steps to download the frameworks, and build sample applications, are explained
using the Microsoft Windows platform.
Advantages of developing applications using Java frameworks on NonStop
14 Introduction
NonStop provides a highly scalable servlet/JSP container to host the web applications developed using the frameworks. Because the applications are deployed on NSJSP, the Java frameworks can leverage the following advantages of NonStop:
Scalability
Scalability in NSJSP refers to its ability to increase its capacity to process a large number of requests simultaneously, by adding resources, such as additional processes and logical processors, to a system. Because applications developed using the frameworks are deployed as a servlet under NSJSP, the applications are able to leverage features of NSJSP. This means that when the application is heavily loaded and all the static servers are busy, a dynamic server is created to cater to the excess load. Thus, scalability also promotes need-based allocation of the system resources.
Availability
High-availability guarantees continuous availability of services even during a failure of some system resources, such as processors. The Java frameworks, deployed under NSJSP, use NonStop TS/MP to ensure high availability and scalability, which enables you to run, as a server class, several instances of the same process. If any of the application server processes fail, TS/MP restarts the server process and maintains a minimum number of server application processes running on the system.
Load Balancing
With NSJSP, load balancing is achieved through the use of multiple NonStop subsystems, including NonStop TCP/IPv6, TS/MP, iTP Secure WebServer, and NSJSP. Using NonStop TCP/IPv6 ensures that the incoming HTTP requests are distributed equally across the HTTPD processes running on all the processors. Also, because HTTPD communicates with NSJSP using server class send calls, TS/MP link management can help ensure that HTTPD requests for NSJSP services are balanced across all the available server class processes of NSJSP.
15

2 Spring Framework

Spring Overview

Spring is an open source framework that you can use to develop enterprise applications. Its features and functions are packaged in different modules. It includes a lightweight container that provides a centralized, automated configuration and wiring of your application objects.
NOTE: Throughout this document, Spring refers to Spring version 3.1.0.
Spring includes the following:
A flexible MVC web application framework, built on core Spring functionality. This framework
is highly configurable using strategy interfaces, and accommodates multiple view technologies, such as JSF.
Integration with other frameworks, such as Hibernate, with lots of IoC convenience features,
addressing many typical Hibernate integration issues.
A JDBC abstraction layer that supports exception hierarchy, simplifies error handling, and
reduces the effort in generating code.
Support for application testability and scalability by allowing software components to be first
developed and tested in isolation, then scaled up for deployment in any environment.
The NonStop system provides a platform comprising the Java Virtual Machine (JVM) and a servlet container ― NSJSP. On NonStop systems, Java applications (created using Spring libraries) can be run/deployed as:
Standalone applications on the JVM
Web applications under NSJSP

Spring Projects

The Spring community maintains several projects such as Spring Web Flow, Spring framework, Spring Web Services, and Spring Security. Among these projects, only the Spring framework and the Spring Web Flow is presently certified for use on the NonStop platform.
Spring Framework
The Spring framework is a layered development platform for developing Java applications in different environments. Because the framework provides abstraction layers and modules, you can use the Spring modules selectively based on your requirement.
The basic Spring framework consists of:
Core Container
Data Access/Integration layer (For examples on the Data Access/Integration layer, see
“Integrating Frameworks” (page 222).)
Web layer (For examples on the Web layer, see “Getting Started with Spring” (page 38).)
AOP and Instrumentation module (For examples on the AOP and Instrumentation layer, see
“Integrating Spring with Transaction Management Facility (TMF)” (page 27).
Test module
For more information about Spring frameworks, see http://static.springsource.org/spring/docs/
3.1.x/spring-framework-reference/html.
For information on how to use the Spring framework to develop a web application for a NonStop platform, see “Getting Started with Spring” (page 38).
16 Spring Framework
Spring Web Flow
At times, web applications need to execute the same sequence of steps in different contexts. The Spring Web Flow can be used to implement such repetitive steps or flows because it integrates with the Spring Web Model View Control (MVC) platform to provide a flow definition language.
For information about downloading and installing the Spring Web Flow, see Appendix E: Installing
Spring Web Flow.

Spring Applications on NonStop

Spring web applications, when deployed on NonStop, can leverage features provided by the NonStop platform.
Figure 1 shows how a Spring application can interface with other NonStop products.
NOTE: In Figure 1, the Spring applications are deployed on NSJSP. The same holds true when
running the Spring applications as a standalone application too.
Figure 1 Spring Web Applications
The combinations displayed in Figure 1 are as follows:
1. Spring web applications accessing RMI services (using Spring Remoting).
The Spring framework includes integration classes for remoting support using various technologies (RMI, http invoker, hessian, burlap, jax-spc, jax-ws, JMS). Using Spring and RMI, you can expose services through the RMI infrastructure. You must use NonStop TCP/IPv6 or NonStop IP-CIP as the TCP/IP transport provider because the default RMI implementation uses TCP/IP as it underlying transport layer.
There can be multiple RMI server instances listening on the same port. When an RMI client invokes an RMI server, the TCP/IP provider distributes the requests across the RMI server instances listening on the port in a round-robin manner. If the RMI servers are distributed across all the processors, RMI calls are distributed across all the processors.
Spring Overview 17
NOTE: NonStop TCP/IPv6 limits one process per processor to listen on any given port, while
IP-CIP does not have any such restriction. However, in the RMI Service Exporter configuration the following property must be defined:
<property name="alwaysCreateRegistry" value="true" />
2. Spring applications accessing an SQL/MX database.
Spring web applications can be configured to access an SQL/MX database through the JDBC drivers (JDBC Type 2 or JDBC Type 4 drivers).
3. Spring web applications accessing TS/MP applications.
The Spring framework can be integrated with the JToolkit library to expose legacy TS/MP applications as web applications without major changes to the application.
4. Spring applications accessing SOAP services.
Spring web applications can be configured to access SOAP services hosted on a NonStop platform or any other platform.

Installing the Spring Framework

This section describes the procedure to install Spring framework libraries on a Nonstop system.
Prerequisites
Before getting started, make sure that you have the following software installed on the NonStop and Windows systems:
NonStop System
Table 1 Softwares to be installed on the NonStop system
For more information:Software
NSJ version 6.0
For information on installing NSJ on a NonStop system, see the NonStop Server for Java 6.0 Programmer's Reference.
Windows System
Table 2 Softwares to be installed on the Windows system
DownloadSoftware
JDK version 1.6
Download from http://www.oracle.com/technetwork/java/javase/downloads/index.html and set the PATH and JAVA_HOME environment variables.

Installing Spring Framework Libraries on a NonStop System

Installing Spring framework libraries on a NonStop system requires the following actions:
18 Spring Framework
1. “Downloading the Spring Distribution on Windows” (page 19)
2. “Copying Spring Runtime Libraries from Windows to NonStop” (page 19)
NOTE: Throughout the section, references are made to the following directories:
<Spring Home>: The directory on the Windows system where the Spring distribution
files are extracted.
<NonStop Spring Home>: The OSS directory on the NonStop system where the Spring
runtime JAR files are located.
<My SASH Home>: The directory on the Windows system where the contents of the
SAMPLES.zip file (distributed as a part of the NonStop Samples for Java frameworks ­T0874 and available for download in Scout) is extracted.
<NSJSP Deployment Directory>: The location of the iTP WebServer deployment
directory (on the NonStop system) in which NSJSP is setup.
Downloading the Spring Distribution on Windows
To download the Spring distribution on the Windows system, complete the following steps:
1. Go to http://www.springsource.com/download/community?project=Spring%20Framework .
The Spring Community Downloads web page appears.
2. Do one of the following:
1. Register yourself.
2. Click I'd rather not fill in the form. Just take me to the download page. The Spring frameworks available for download appear.
3. Select 3.1.0.RELEASE and download the spring-framework–3.1.0.RELEASE.zip file.
NOTE: The spring-framework–3.1.0.RELEASE.zip file does not include the Spring
sample applications, the Spring framework libraries, and dependency JAR files that are required to build the sample applications.
4. Extract the spring-framework–3.1.0.RELEASE.zip file into a directory on the Windows system.
This directory will be referred as <Spring Home>.
Copying Spring Runtime Libraries from Windows to NonStop
1. Create JAR files in the <Spring Home> directory on the Windows system:
command prompt> cd <Spring Home> command prompt> jar -cvf spring_dist.jar dist
For example:
command prompt> cd C:\spring-framework-3.1.0.RELEASE command prompt> jar -cvf spring_dist.jar dist
2. Create the <NonStop Spring Home> directory in the OSS environment on the NonStop system:
OSS> mkdir -p <NonStop Spring Home>
For example, create a directory structure /usr/tandem/sash/spring_3.1.0.
OSS> mkdir -p /usr/tandem/sash/spring_3.1.0
3. Transfer the spring_dist.jar file from <Spring Home> to <NonStop Spring Home> and extract it:
OSS> cd <NonStop Spring Home>
Installing the Spring Framework 19
OSS> jar -xvf spring_dist.jar
NOTE: The sub-directories on the NonStop system must contain the same list of files as those in
the <Spring Home>\dist directory on the Windows system.
The Spring runtime libraries are installed on the NonStop system. You can use these libraries to develop and run Spring applications on a NonStop system.

Setting up Sample Spring Applications on NonStop

The sample Spring applications (PetClinic and JPetStore) are included in the SAMPLES.zip file. This file contains the modifications made to PetClinic and JPetStore to make them compatible with NonStop systems.
NOTE: The SAMPLES.zip file is distributed as a part of the NonStop Samples for Java frameworks
- T0874. SAMPLES.zip is present in the T0874AAB.BIN file in Scout. For information on how to install
the T0874AAB.BIN file from Scout, see https://h20453.www2.hp.com/scout/download_help.htm. Before you deploy the sample applications, complete the following steps:
1. Download the SAMPLES file from Scout.
2. Add the .zip extension to it.
The file is renamed as SAMPLES.zip.
3. Extract the SAMPLES.zip file to a location on the Windows system.
This section describes the steps to build, set up, deploy, and run the PetClinic and JPetStore sample applications on NonStop systems.
Prerequisites
For NonStop system:
The NS-Samples-for-Java-Frameworks folder appears.
NOTE: The absolute path of the NS-Samples-for-Java-Frameworks folder is referred
as <My SASH Home>.
Table 3 Softwares to be installed on the NonStop system
For more information:Software
NonStop iTP WebServer version
7.x or later
NSJSP version 6.1
NonStop SQL/MX version 2.3
For information on installing and setting up iTP WebServer (secure and non-secure) on a NonStop system, see the iTP Secure WebServer System Administrator's Guide.
For information on installing and setting up NSJSP on a NonStop system, see the NonStop Servlets for JavaServer Pages (NSJSP) 6.1 System Administrator's Guide.
For information on installing SQL/MX on a NonStop system, see the SQL/MX Installation and Upgrade Guide.
JDBC Type 2 driver or JDBC Type 4 driver for the installed SQL/MX version
NSJ version 6.0
20 Spring Framework
For information on installing JDBC Type 2 driver and JDBC Type 4 driver on a NonStop system, see JDBC Type 2 Driver Programmer's Reference for SQL/MX and JDBC Type 4 Driver Programmer's Reference for SQL/MX.
For information on installing NSJ on a NonStop system, see the NonStop Server for Java 6.0 Programmer's Reference manual.
For Windows system:
Table 4 Softwares to be installed on the Windows system
DownloadSoftware
PetClinic
JDK version 1.6
Maven version
2.2.1
JDBC Type 4 driver
Download from http://www.oracle.com/technetwork/java/javase/downloads/index.html and set the PATH and JAVA_HOME environment variables.
Download from http://maven.apache.org/download.html and set the PATH and MAVEN_HOME environment variables.
For information on installing JDBC Type 4 driver on a Windows system, see JDBC Type 4 Driver Programmer's Reference for SQL/MX.
The PetClinic sample application is an information system that is accessible using a web browser. The intended users of the application are employees of the clinic who need to view and manage information regarding veterinarians, clients, and their pets.
NOTE: The PetClinic sample application described here uses Spring 3.0.2 version.
To use PetClinic, complete the following steps:
“Building PetClinic on Windows” (page 21)
“Setting up PetClinic Database on NonStop” (page 22)
“Deploying PetClinic on NonStop” (page 23)
“Running PetClinic on NonStop” (page 23)
Building PetClinic on Windows
1. Go to the <My SASH Home>\spring\samples\petclinic directory on the Windows system.
2. Configure the JDBC driver settings for the NonStop SQL/MX database.
1. Go to the <My SASH Home>\spring\samples\petclinic\src\main\resources
directory on the Windows system.
2. Modify the jdbc.properties file to update the JDBC configuration. You can use either
the JDBC Type 2 driver or the JDBC Type 4 driver by setting their SQL/MX settings as follows:
For JDBC Type 2 driver, uncomment the SQL/MX settings for the JDBC Type 2 driver,
so that it appears as:
# Properties that control the population of schema and data for a new data source
# SQL/MX Settings for JDBC Type 2 Driver jdbc.driverClassName=com.tandem.sqlmx.SQLMXDriver jdbc.url=jdbc:sqlmx:// jdbc.username= jdbc.password= jdbc.catalog=petcliniccat jdbc.schema=petclinicsch hibernate.dialect=org.hibernate.dialect.SqlmxDialect
NOTE: Because the JDBC Type 2 driver is located on the NonStop system, you
need not specify the values for jdbc.username and jdbc.password fields.
For JDBC Type 4 driver, uncomment the SQL/MX settings for the JDBC Type 4 driver
, and enter the values for the JDBC URL (NonStop system IP Address and port number of the JDBC data source), NonStop system username, and password so that it appears as:
Installing the Spring Framework 21
#------------------------------------------------------------­# Properties that control the population of schema and data for a new data source
# SQL/MX Settings for JDBC Type 4 Driver jdbc.driverClassName= com.tandem.t4jdbc.SQLMXDriver jdbc.url= jdbc:t4sqlmx://<HP NonStop System IP Address>:<Port No.> jdbc.username=<HP NonStop Username> jdbc.password=<HP NonStop Password> jdbc.catalog=petcliniccat jdbc.schema=petclinicsch hibernate.dialect=org.hibernate.dialect.SqlmxDialect
3. Build the PetClinic web application archive (WAR)file (petclinic.war).
1. Go to the <My SASH Home>\spring\samples\petclinic directory:
command prompt> cd <My SASH Home>\spring\samples\petclinic
2. Build the PetClinic web archive using JDBC Type 2 driver or JDBC Type 4 driver.
1. Enter the following command:
command prompt> mvn clean package
The application WAR file (petclinic.war) is created in the <My SASH Home>\spring\samples\petclinic\target directory.
2. Create the WEB-INF\lib folder in the <My SASH Home>\spring\samples\petclinic\target directory and copy the SQL/MX
hibernate dialect JAR file (hibernate35sqlmx.jar) to this directory.
3. Go to <My SASH Home>\spring\samples\petclinic\target and run the following commands:
command prompt> cd <My SASH Home>\spring\samples\petclinic\target command prompt> jar uf petclinic.war WEB-INF\lib\hibernate35sqlmx.jar
The hibernate35sqlmx.jar is copied to the <My SASH Home>\spring\samples\petclinic\target\petclinic.war\WEB-INF\lib
directory.
NOTE: If you are using the JDBC Type 4 driver:
In step 2, copy the t4sqlmx.jar file also to the \WEB-INF\lib directory in
addition to the hibernate35sqlmx.jar file.
In step 3, run this jar command:
jar uf petclinic.war WEB-INF\lib\hibernate35sqlmx.jar WEB-INF\lib\t4sqlmx.jar
Setting up PetClinic Database on NonStop
1. Edit the <My SASH Home>\spring\samples\petclinic\src\main\resources\db\ mxci\petclinic_tables_script.sql file to include the following:
<$datavol>: specify the Guardian volume for the primary partition of the table. For
example: $data01
<user>: specify the owner of the schema. For example: super.sashusr
<node.$vol>: specify the location of the metadata tables for the catalog. For example:
\NSK01.$data01
<subvol reference>: specify the designated subvolume name for the schema. For
example: SASH1
NOTE: The subvolume name is always prefixed by ZSD and must have eight characters
(including ZSD).
2. Create a directory in OSS to place the database script files, using the command:
22 Spring Framework
OSS> mkdir -p <NonStop SASH Home>/spring/samples/petclinic/dbconfig
For example:
OSS> mkdir -p /home/sash_usr/sash/spring/samples/petclinic/dbconfig
NOTE: <NonStop SASH Home> can be any working directory. It is suggested that you
create spring/samples/petclinic/dbconfig directory structure in <NonStop SASH Home>.
3. Copy the following scripts from the <My SASH Home>\spring\samples\petclinic\src\main\resources\db\mxci\ Windows
directory to the OSS directory created in Step 2:
petclinic_tables_script.sql
petclinic_dataload_script.sql
NOTE:
The petclinic_tables_script.sql script creates the SQL/MX database catalog,
schema, and tables for PetClinic.
The petclinic_dataload_script.sql script loads the database with sample data.
4. Go to the OSS directory where the petclinic_tables_script.sql and petclinic_dataload_script.sql files are copied, and create the PetClinic database
catalog, schema, and tables, using the SQL/MX command:
OSS> obey petclinic_tables_script.sql;
NOTE: By default, the petclinic_tables_script.sql file creates the database catalog
name as petcliniccat and schema name as petclinicsch. If these names conflict with any of the existing catalog and schema names, modify the database catalog and schema names in the petclinic_tables_script.sql script file.
If you modify the database catalog and schema names, edit the jdbc.properties file present in the <My SASH Home>\spring\samples\petclinic\src\main\resources directory, present in the SAMPLES.zip file.
5. Load the sample data in the PetClinic sample application database tables using the SQL/MX command:
OSS> obey petclinic_dataload_script.sql;
The PetClinic database is setup on your NonStop system.
Deploying PetClinic on NonStop
For information on how to deploy PetClinic on the NonStop system, see Appendix C: Deploying
Sample Applications on NonStop.
Running PetClinic on NonStop
To run PetClinic on the NonStop system, in the NSJSP Web Application Manager screen, under Applications, click /<servlet directory>/petclinic.
You can now perform the following actions using PetClinic:
View a list of veterinarians and their specialties
View and update information of a pet owner
Add a new pet owner to the system
View and update information of a pet
Installing the Spring Framework 23
JPetStore
Add a new pet to the system
View information about the pet's visit to the clinic
The intended users of the JPetStore sample application are Visitors and Shoppers. A Visitor is anyone who visits the site. A Shopper is an authenticated visitor who is signed in to the site. Visitors can browse the site for items of their interest. Shoppers can purchase items of their interest.
NOTE: The JPetStore sample application described here uses Spring 3.0.2 version.
To use JPetStore, complete the following steps:
“Building JPetStore on Windows” (page 24)
“Setting up JPetStore Database on NonStop” (page 25)
“Deploying JPetStore on NonStop” (page 26)
“Running JPetStore on NonStop” (page 26)
Building JPetStore on Windows
1. Go to the <My SASH Home>\spring\samples\jpetstore directory on the Windows system.
2. Configure the JDBC driver settings for the NonStop SQL/MX database.
1. Go to the <My SASH
Home>\spring\samples\jpetstore\src\main\webapp\WEB-INF directory on the Windows system.
2. Modify the jdbc.properties file to update the JDBC configuration. You can use either
the JDBC Type 2 driver or the JDBC Type 4 driver by setting their SQL/MX settings as follows:
For JDBC Type 2 driver, uncomment the SQL/MX settings for the JDBC Type 2 driver,
so that it appears as:
#------------------------------------------------------------­# SQL/MX Settings for JDBC Type 2 Driver jdbc.driverClassName=com.tandem.sqlmx.SQLMXDriver jdbc.url=jdbc:sqlmx:// jdbc.username= jdbc.password= jdbc.catalog=jpetstorecat jdbc.schema=jpetstoresch
NOTE: Because the JDBC Type 2 driver is located on the NonStop system, you
need not specify the values for jdbc.username and jdbc.password fields.
For JDBC Type 4 driver, uncomment the SQL/MX settings for the JDBC Type 4 driver
, and enter the values for the JDBC URL (NonStop system IP Address and port number of the JDBC data source), NonStop system username, and password so that it appears as:
#------------------------------------------------------------­# SQL/MX Settings for JDBC Type 4 Driver jdbc.driverClassName= com.tandem.t4jdbc.SQLMXDriver jdbc.url= jdbc:t4sqlmx://<HP NonStop System IP Address>:<Port No.> jdbc.username=<HP NonStop Username> jdbc.password=<HP NonStop Password> jdbc.catalog=jpetstorecat jdbc.schema=jpetstoresch
24 Spring Framework
NOTE: <HP NonStop Username> must have access to the schema created for
JPetstore.
3. Build the JPetStore WAR file (org.springframework.samples.jpetstore-1.0.0-SNAPSHOT.war).
1. Go to the <My SASH Home>\spring\samples\jpetstore directory:
command prompt> cd <My SASH Home>\spring\samples\jpetstore
2. Build the JPetStore web archive using the JDBC Type 2 driver or JDBC Type 4 driver.
1. Enter the following command:
command prompt> mvn clean package
The application WAR file (org.springframework.samples.jpetstore-1.0.0-SNAPSHOT.war) is created in the <My SASH Home>\spring\samples\jpetstore\target directory.
2. Create the WEB-INF\lib folder in the <My SASH Home>\spring\samples\jpetstore\target directory.
If you are using JDBC Type 4 driver, proceed with Step 3.
3. Copy the JDBC Type 4 driver file (t4sqlmx.jar) to the <My SASH Home>\spring\samples\jpetstore\target directory.
4. Go to <My SASH Home>\spring\samples\jpetstore\target and run the following commands:
command prompt> cd <My SASH Home>\spring\samples\jpetstore\target command prompt> jar uf org.springframework.samples.jpetstore-1.0.0-SNAPSHOT.war WEB-INF\lib\t4sqlmx.jar
The t4sqlmx.jar file is copied to the <My SASH Home>\Home>\spring\samples\jpetstore\target\
org.springframework.samples.jpetstore-1.0.0-SNAPSHOT.war\WEB-INF\lib
directory.
Setting up JPetStore Database on NonStop
1. Edit the <My SASH
Home>\spring\samples\jpetstore\db\mxci\jpetstore_tables_script.sql
file to add the following:
<$datavol>: specify the Guardian volume for the primary partition of the table. For
example: $data01.
<user>: specify the owner of the schema. For example: super.sashusr.
<node.$vol>: specify the location of the metadata tables for the catalog. For example:
\NSK01.$data01.
<subvol reference>: specify the designated subvolume name for the schema. For
example: SASH2.
NOTE: The subvolume name is always prefixed by ZSD and must have eight characters
(including ZSD).
2. Create a directory in OSS to place the database script files:
OSS> mkdir -p <NonStop SASH Home>/spring/samples/jpetstore/dbconfig
For example:
OSS> mkdir -p /home/sash_usr/sash/spring/samples/jpetstore/dbconfig
NOTE: <NonStop SASH Home> can be any working directory. It is suggested that you
create the spring/samples/jpetstore/dbconfig directory structure in <NonStop SASH Home>.
Installing the Spring Framework 25
3. Copy the following scripts from the <My SASH Home>\spring\samples\jpetstore\db\mxci Windows directory to the OSS directory created in Step 2:
jpetstore_tables_script.sql
jpetstore_dataload_script.sql
NOTE:
The jpetstore_tables_script.sql script creates the SQL/MX database catalog,
schema, and tables for JPetStore.
The jpetstore_dataload_script.sql script loads the database with sample data.
4. Go to the OSS directory where the jpetstore_tables_script.sql and jpetstore_dataload_script.sql files are copied, and create the JPetStore database
catalog, schema, and tables, using the SQL/MX command:
OSS> obey jpetstore_tables_script.sql;
NOTE: By default, the jpetstore_tables_script.sql file creates the database catalog
name as jpetstorecat and schema name as jpetstoresch. If these names conflict with the existing catalog and schema names, modify the database catalog and schema names in the jpetstore_tables_script.sql script file.
If you modify the database catalog and schema names, the new names must be updated in the jdbc.properties file located in the <My SASH Home>\spring\samples\jpetstore\src\main\webapp\WEB-INF directory, included in the SAMPLES.zip file.
5. Load the sample data in the JPetStore database tables:
OSS> obey jpetstore_dataload_script.sql;
The JPetStore database is setup on the NonStop system.
Deploying JPetStore on NonStop
For information on how to deploy JPetStore on the NonStop system, see Appendix C: Deploying
Sample Applications on NonStop.
Running JPetStore on NonStop
To run JPetStore on the NonStop system, in the NSJSP Web Application Manager screen, under
Applications, click /<servlet directory>/org.springframework.samples.jpetstore-1.0.0-SNAPSHOT.
As a visitor, you can now perform the following activities:
Select a Product Category labeled with words or icons, view the item detail, or access the
MenuBar features.
Search by entering a keyword or phrase to locate items.
Add an item to a Cart, either from a summary list or from a detail view.
Collect items for later purchase.
Increase or decrease the quantity for any item in a Cart, up to available inventory, or remove
the item from the Cart by changing the quantity to zero.
Complete an online form to create an Account.
26 Spring Framework
As a shopper, you can perform the following activities (including those performed by a visitor):
Enter a username and password to access your account.
Store shipping information and preferences for your use at future sessions.
Purchase the items collected in a Cart.
Provide payment information.

Integrating Spring with Transaction Management Facility (TMF)

The NonStop Transaction Management Facility (TMF) provides transaction protection, database consistency, and database recovery, which are critical in high-volume transaction processing.
TMF protects databases in a wide variety of environments such as online transaction processing (OLTP), online query processing (OLQP), batch processing, and decision support systems.
TMF protects databases by managing database transactions, monitoring database activity through the use of audit trails, and providing database recovery methods while sustaining high performance in a high-volume, distributed application environment.
For more information, see the TMF Introduction manual and the TMF Reference Manual. This section describes how to use a TMF Adapter in Spring application.
What is Spring TMF Adapter?
Spring provides the AbstractPlatformTransactionManager, which can be used to develop a TMF adapter for Spring. Integration of NonStop TMF with Spring applications is provided by implementing Spring's AbstractPlatformTransactionManager. The class used for this implementation is called TmfTransactionManager. When TmfTransactionManager is used in a Spring application, a transaction is started by using the Spring TMF adapter and creates a TMF transaction on Nonstop.
TmfTransactionManager exposes the following methods to Spring applications:
getTransaction
commit
rollback
NOTE: For the actual signature of the methods mentioned above, see the Spring documentation
at http://static.springsource.org/spring/docs/3.1.0.RELEASE/api/org/springframework/
transaction/PlatformTransactionManager.html.
For information about TmfTransactionManager configuration, see “Integrating Spring with
Transaction Management Facility (TMF)” (page 27).
The getTransaction method may be invoked with or without TMF transaction context. The behavior of TmfTransaction will be based on the transaction propagation attribute set on it. The following are the Propagation behaviors:
1. PROPAGATION_REQUIRED: This is the default setting of a transaction definition, and typically
defines a transaction synchronization scope. If a transaction exists, it supports the current transaction; otherwise, it creates a new one.
2. PROPAGATION_SUPPORTS: Supports a current transaction; executes non-transactionally if no
transaction exists.
3. PROPAGATION_MANDATORY: Supports a current transaction; if no transaction exists, throws
an exception.
4. PROPAGATION_REQUIRES_NEW: Creates a new transaction; suspends the current transaction
if one exists.
5. PROPAGATION_NOT_SUPPORTED: Does not support a current transaction; always executes
non-transactionally.
Integrating Spring with Transaction Management Facility (TMF) 27
6. PROPAGATION_NEVER: Does not support a current transaction; throws an exception if a
current transaction exists.
7. PROPAGATION_NESTED: If a current transaction exists, it executes within a nested transaction:
otherwise, the behavior is similar to PROPAGATION_REQUIRED. This behavior is not supported on NonStop.

Setting up the Sample SpringTMFAdapter on NonStop

The sample SpringTMFAdapter is included along with the Spring application. springtmf.jar is the SpringTMFAdapter, which is used by the Spring application to create tmf transactions.
The SpringTMFAdapter is available via the SAMPLES.zip file, which is distributed as a part of T0937.
To obtain the springtmf.jar and the samples, complete the following steps:
1. Create a directory on your Windows system. This directory is referred as <TMF Adapter Home>.
For example, C:\TMF
2. Download the ADAPTER and SAMPLES file from Scout. For information on how to download from Scout, see https://h20453.www2.hp.com/scout/download_help.htm.
3. Add the .zip extensions to both the files. The files will be renamed ADAPTER.zip and SAMPLES.zip.
4. Extract the ADAPTER.zip file to <TMF Adapter Home>.
5. Extract the SAMPLES.zip file to <TMF Adapter Home> to get the sample application. The
You can now use springtmf.jar in a Spring application to create TMF transactions. After obtaining the springtmf.jar and samples, you can build, set up, deploy, and run the
sample SpringTMFAdapter application on a NonStop system. The following sections describe how to build, set up, deploy, and run the application.
Prerequisites
Before getting started, make sure that you have the following software installed on the NonStop and Windows systems:
NonStop System
The SpringTMFAdapter folder containing the springtmf.jar file appears. For example, C:\TMF\SpringTMFAdapter\springtmf.jar
sample application can be found at C:\TMF\Samples
Table 5 Softwares to be installed on the NonStop system
For more information:Software
NonStop SQL/MX version 3.2
JDBC Type 2 driver or JDBC Type 4 driver for the installed SQL/MX version
For information on installing SQL/MX on a NonStop system, see the SQL/MX Installation and Upgrade Guide.
For information on installing JDBC Type 2 driver and JDBC Type 4 driver on a NonStop system, see JDBC Type 2 Driver Programmer's Reference for SQL/MX and JDBC Type 4 Driver Programmer's Reference for SQL/MX.
NSJ version 6.0
Windows System
28 Spring Framework
For information on installing NSJ on a NonStop system, see the NonStop Server for Java 6.0 Programmer's Reference manual.
Table 6 Softwares to be installed on the Windows system
DownloadSoftware
JDK version 1.6
JDBC Type 4 driver version
Ant 1.8.2
Download from http://www.oracle.com/technetwork/java/javase/downloads/index.html and set the PATH and JAVA_HOME environment variables.
For information on installing JDBC Type 4 driver on a Windows system, see JDBC Type 4 Driver Programmer's Reference for SQL/MX.
Download from http://archive.apache.org/dist/ant/binaries/ and set the PATH and ANT_HOME environment variables.
Setting up an SQL/MX Database on NonStop
1. Edit the <TMF Adapter Home >\Samples\TMF_Adapter_Sample\dbconfig\student_script.sql file to include the following:
<$datavol>: specify the Guardian volume for the primary partition of the table. For
example: $data01
<user>: specify the owner of the schema. For example: super.sashusr
<node.$vol>: specify the location of the metadata tables for the catalog. For example:
\NSK01.$data01
<subvol reference>: specify the designated subvolume name for the schema. For
example: SASH1
NOTE: The subvolume name is always prefixed by ZSD and must have eight characters
(including ZSD).
2. Create a directory in OSS to place the database script files, using the command:
OSS> mkdir -p <NonStop TMF Adapter Home>/spring/samples/TMFAdapter/dbconfig
For example:
OSS> mkdir -p /home/sash_usr/sash/spring/samples/TMFAdapter/dbconfig
NOTE: HP recommends that you create /spring/samples/TMFAdapter/dbconfig
directory structure under <NonStop TMF Adapter Home>.
3. Copy the student_script.sql from the<TMF Adapter Home >\Samples\TMF_Adapter_Sample\dbconfig\ Windows directory to the OSS directory created in Step 2.
4. Go to the OSS directory where the student_script.sql file is copied, and create the database catalog and schema, using the SQL/MX command:
OSS> obey student_script.sql;
NOTE: By default, the student_script.sql file creates the database catalog name as
simplecat and schema name as simplesch. If these names conflict with any of the existing
catalog and schema names, modify the database catalog and schema names in the student_script.sql script file.
If you modify the database catalog and schema names, update the
application.properties file present in SAMPLES.zip, available in the <TMF Adapter Home>\Samples\TMF_Adapter_Sample\src directory.
The SQL/MX database is setup on your NonStop system.
Integrating Spring with Transaction Management Facility (TMF) 29
Dependent Libraries for the Sample TMFAdapter
Before executing the sample TMFAdapter application, get the following libraries to the <TMF Adapter Home>\Samples\TMF_Adapter_Sample\lib directory on Windows. Then transfer these files (via FTP) to the <NonStop TMF Adapter Home >/spring/samples/TMFAdapter/lib/ directory on the NonStop system.
Table 7 TMFAdapter Dependent Libraries
Source LocationDependency JAR Files
<Hibernate_3.6.8_Home>\lib\requiredantlr-2.7.6.jar
com.springsource.org.aopalliance-1.0. 0.jar
com.springsource.org.objectweb.asm-3.1.0.jar
com.springsource.org.apache.commons.logging-1.1.1. jar
com.springsource.org.junit-4.10.0.jar
com.springsource.org.apache.log4j-1.2.16.jar
com.springsource.org.aspectj.weaver-1.5.4.jar
org.springframework.asm-3.1.0.RELEASE.jar
org.springframework.aspects-3.1.0.RELEASE.jar
org.springframework.beans-3.1.0.RELEASE.jar
org.springframework.context-3.1.0.RELEASE.jar
org.springframework.context.support-3.1.0.RELEASE. jar
org.springframework.core-3.1.0.RELEASE.jar
org.springframework.expression-3.1.0.RELEASE.jar
org.springframework.instrument-3.1.0.RELEASE.jar
org.springframework.instrument.tomcat-3.1.0.RELEASE .jar
org.springframework.jdbc-3.1.0.RELEASE.jar
org.springframework.jms-3.1.0.RELEASE.jar
org.springframework.orm-3.1.0.RELEASE.jar
org.springframework.oxm-3.1.0.RELEASE.jar
org.springframework.test-3.1.0.RELEASE.jar
org.springframework.transaction-3.1.0.RELEASE.jar
org.springframework.web-3.1.0.RELEASE.jar
org.springframework.web.portlet-3.1.0.RELEASE.jar
org.springframework.web.servlet-3.1.0.RELEASE.jar
org.springframework.web.struts-3.1.0.RELEASE.jar
http://ebr.springsource.com/repository/ app/
<Hibernate_3.6.8_Home>\lib\bytecode\cglibcglib-2.2.jar
<Hibernate_3.6.8_Home>\lib\requiredcommons-collections-3.1.jar
<Hibernate_3.6.8_Home>\lib\requireddom4j-1.6.1.jar
<Hibernate_3.6.8_Home>\lib\jpahibernate-jpa-2.0-api-1.0.1.Final.jar
<Hibernate_3.6.8_Home>hibernate3.jar
<Hibernate_3.6.8_Home>\libhibernate36sqlmx.jar
<Hibernate_3.6.8_Home>\lib\requiredjavassist-3.12.0.GA.jar
<Hibernate_3.6.8_Home>\lib\requiredjta-1.1.jar
<Spring Home>\distorg.springframework.aop-3.1.0.RELEASE.jar
30 Spring Framework
Loading...
+ 321 hidden pages