Samples and applications
Several example applications are available for WebSphere Application Server. You can use these samples to familiarize yourself with the product and to help you develop your own applications.
- The Samples Gallery
- Install and access the Samples Gallery
- Troubleshooting the Samples Gallery
- Additional sample applications
- Limitations of the samples
The WebSphere Application Server samples gallery provides a set of small, generic samples that show how to perform common enterprise application tasks. The samples demonstrate the use of session and entity enterprise beans, JDBC access, connection pooling, Java Mail, message driven beans, and other Web techniques and reusable componentry. The samples are installed in the profile_root/samples/src directory, where profile_root is the path specified for the profilePath option when the profile was created. The default value for profilePath is /QIBM/UserData/WebSphere/AppServer/V6/edition/profiles/profile_name.
Note: You can build or modify the samples' source code to support your project.
The Samples Gallery includes the following materials:
- Plants by WebSphere application
This application demonstrates several Java 2 Platform, Enterprise Edition (J2EE) functions, using an online store that specializes in plant and garden tool sales. The Greenhouse by WebSphere application can be used with this application to process its back orders. Note that you do not need to deploy the PlantsByWebSphere.ear file onto the application server, because it is installed by default when you create the application server profile.- WebSphere Bank application
This application demonstrates multiple J2EE 1.4 technologies in a banking scenario.- Greenhouse by WebSphere application
This application demonstrates multiple J2EE 1.4 technologies in a business-to-business (B2B) supplier scenario. It can process back orders from the Plants by WebSphere application.- Technology Samples
These samples demonstrate enterprise beans, servlets, JavaServer Pages technology, J2EE application client, security, and message-driven beans.- Web Services Samples
These samples demonstrate J2EE beans and JavaBeans components that are available as Web services.- Service Data Objects (SDO) Sample
This sample demonstrates data access to a relational database through Service Data Objects (SDO) and Java DataBase Connectivity (JDBC) Mediator technologies.- BeenThere workload management Sample
This sample demonstrates the workload management and clustering capabilities of the product, and is the only sample that is supported in a multi-server, clustered environment.- Java Adventure Builder application
This application demonstrates J2EE 1.4 technology using an online travel shopping store.- JACL scripts
These scripts enable you to configure resources and install the sample applications.- Programming model extensions samples in the Samples Gallery
These samples demonstrate WebSphere programming model extension features such as dynamic query service, work area service, internationalization service, ActivitySessions service, application profiling, Java Transaction API (JTA) extensions, asynchronous beans, and scheduler.
Install and access the Samples Gallery
Follow these steps to install the samples in the WebSphere Application Server samples gallery that are included with the WebSphere Application Server on your iSeries server.
- Create a standalone application server profile, as described in wasprofile command, or use the default application server profile.
By default, only the Samples Gallery and the Plants by WebSphere application are installed on the application server. They are installed in the /QIBM/UserData/WebSphere/AppServer/V6/edition/profiles/profile_name/installedApps/cell_name directory, where edition is Base for WebSphere Application Server Express and WebSphere Application Server, and ND for WebSphere Application Server Network Deployment; profile_name is the name of your application server profile; and cell_name is the name of your WebSphere Application Server cell.Note: If you are using WebSphere Application Server-Express, the default profile does not have the samples installed. In addition, if you use a unique template to create a profile that does not include SamplesGallery, the samples application is not installed. For information on installing the WebSphere Application Server 6.0 Samples Gallery, refer to the Samples TechNote.
- (Network Deployment only) To run the samples in a distributed WebSphere Application Server Network Deployment environment, install and configure the samples in a standalone application server profile installation, and then use the addNode script to federate the node into the deployment manager cell. When you run the addNode script, use the dmgr_host argument, and -includeapps and -includebuses options:
addNode dmgr_hostname -includeapps -includebuseswhere dmgr_hostname is the name of the machine that hosts your deployment manager profile. For more information about the addNode script, see The addNode command.
- Start the application server.
- Access the samples gallery at this URL:
http://your.server.name:port/WSsampleswhere your.server.name is the name of your iSeries server and port is the port number for the application server's internal HTTP transport.
- (Optional) Install additional samples.
Additional samples are initially listed as installable samples in the Samples Gallery. For further instructions on installing each sample, refer to the Installable Samples section of the Samples Gallery in your Web browser, from Step 4.Note: To installing additional samples on non-default profiles, specify the -server myServer parameter. Additional information about -server parameter and other script values can be found in Installable Samples, Samples install help section.
Troubleshooting the Samples Gallery
If you are unable to access the Samples Gallery, verify the following items:
- Verify that the application server is running. On the CL command line, run this command:
WRKACTJOB SBS(QWAS6)and look for the name of your application server profile.
- Verify that the samples are installed. In the administrative console, expand Applications and click Enterprise applications. Confirm that the Samples Gallery is listed as an installed application.
- Verify the port number. The default port for the default application server profile is 9080. To verify or change the port number, follow these steps:
- In the administrative console navigation frame, expand Servers and click Application servers.
- Click the name of the application server. For the default application server profile, the server name is server1.
- Click Ports.
- Verify the WC_defaulthost port number.
- If you need to change the port number, click WC_defaulthost.
- Type the new port number in the Port field.
- Click OK.
- To save the configuration changes, click Save.
- Click Save.
For more information about this port number setting, see HTTP transport channel settings of the application server.
Additional samples applications
- DB2 Web Services Samples
Included with WebSphere Application Server is the DB2 Web Services Samples application. It contains samples for accessing DB2 using the Web Services Object Runtime Framework (WORF). These samples demonstrate how to develop Web Services that access iSeries DB2 data.For WebSphere Application Server for OS/400, use the administrative console to install the DB2WebServicesSamples.ear from the directory /QIBM/ProdData/WebSphere/AppServer/V6/edition/samples/lib/DB2WebServicesSamples
/DB2WebServicesSamples.ear, where edition is Base for WebSphere Application Server Express and WebSphere Application Server, and ND for WebSphere Application Server Network Deployment.After deploying the application, start the application server to start the application so you can work with the DB2 Web Services samples. The application's URL is http://your.server.name:port/services. The application uses either your external or internal HTTP port.
- IBM Telephone Directory
The IBM Telephone Directory business application is shipped separately from WebSphere Application Server. For information about obtaining and using the IBM Telephone Directory application, see
IBM Telephone Directory V5.2 in the e-business and Web serving topic of the iSeries Information Center.- Samples on developerWorks
Additional WebSphere Application Server samples are available on WebSphere developerWorks.- Samples for Technology for Developers Version 6
The tutorials on developerWorks for WebSphere Application Server Technology for Developers Version 6 include sample code.- Examples in the product documentation
The product documentation contains code snippets and examples. Most of the examples are located in Developing and deploying applications and Securing applications and their environments.- Java Samples on the Sun Microsystems Web site
Although they do not showcase the capabilities added by purchasing WebSphere Application Server, the samples on the java.sun.com Web site demonstrate the basic functionality of various technologies.
- The samples are for demonstration purposes only.
- The code that is provided is not intended to run in a secured production environment. The samples support Java 2 Security, therefore the samples implement policy-based access control that checks for permissions on protected system resources, such as file I/O. The samples also support global security.
- The BeenThere workload management sample is the only sample that is supported in a multi-server, clustered environment. For information on the BeenThere sample, see the readme_BeenThere.html file in the samples directory.
- Many of the WebSphere Application Server samples connect to a Cloudscape database using the Cloudscape-embedded framework. The Cloudscape-embedded framework has a limitation that only one Java virtual machine (JVM) can access a given database instance. As a result, in a clustered WebSphere environment, the second server in the node fails to start the sample applications, because the first server (JVM) already holds a connection to that database instance.
- For applications that require multiple Java virtual machines to access the same Cloudscape instance, use the Cloudscape networkServer framework.