Access the samples
Many samples also provide instructions for deployment and coding examples.
The product provides samples in two ways:
- Plants By WebSphere sample installed with the product
- If we select to install samples when installing the product and when creating an application server profile, the Plants By WebSphere application is included with the product. The application demonstrates several Java EE functions, using an online store that specializes in plant and garden tool sales.
See Installing the Plants By WebSphere sample.
- Samples downloadable from the Samples, v8.5 information center
- The product provides component-specific samples that we can download at any time from a download site.
Install the Plants By WebSphere sample
To install the Plants By WebSphere sample, perform the following steps.
- Install the product.
(dist) When specifying installation or profile options, select to install the sample applications.
(zos) See "Configuring the WAS for z/OS product after installation" in this information center.
(zos) The Plants By WebSphere sample application is part of the optional features of the WAS for z/OS product and is installed using the IBM Installation Manager. After running the Installation Manager, the Plants by WebSphere sample application is located at:
For more information, see specific instructions in "Adding and removing optional features on z/OS" in the information center.
Plants By WebSphere sample is installed in the app_server_root/samples directory. A Plants By WebSphere pre-built enterprise archive named pbw-ear.ear is in the /samples/PlantsByWebSphere/pbw-ear/target directory.
Installation instructions are in the /samples/PlantsByWebSphere/docs directory.
We can build or modify the sample source code to support the project. The source code is in a src directory.
- To run the sample in a distributed WebSphere Application Server Network Deployment environment, install and configure the samples in a stand-alone application server profile installation, and then add the stand-alone application server profile as a managed node of the deployment manager cell.
We can use a dmgr console or wsadmin addNode command to make an application server a managed node of a deployment manager. For the wsadmin addNode command, use the dmgr_host argument with the -includeapps and -includebuses options.
(dist)(zos) For example:
addNode.sh/bat dmgr_hostname -includeapps -includebuses
(iseries) For example:
addNode dmgr_hostname -includeapps -includebuses
where dmgr_hostname is name of the computer that hosts the dmgr profile.
- Start the application server.
Samples that we can download include, for example, the following materials:
- (dist)(zos) Service Component Architecture (SCA) samples
- The SCA samples support SCA specifications. SCA services are packaged in JAR files that you import as assets to the product repository and then add as composition units to business-level applications.
Download SCA.zip, or individual sample files, to a directory on the workstation. You might create the /samples/sca directory path on the workstation and download SCA sample files to that directory path.
We must deploy SCA sample files as assets of a business-level application to a Version 8.0 or later server or cluster or to a Version 7.0 target that is enabled for the Feature Pack for SCA. The SCA/installableApps directory of SCA.zip contains prebuilt archives we can deploy as assets. The other directories contain sample-specific source files, scripts, and instructions for building deployable archives.
- Communications Enabled Applications (CEA) samples
- The CEA sample applications provide two main services, telephony access and multi-modal web interaction. Use this collection of sample applications to explore the services and to use as a starting point when developing our own communication enabled applications.
- OSGi samples
- The OSGi samples help you develop and deploy modular applications that use both Java EE and OSGi technologies.
- XML samples
- The XML samples demonstrate use of the XML API and supported specifications.
- Internationalization service sample
- The Internationalization service sample demonstrates how to use the internationalization service in Java EE applications, specifically within servlets and enterprise beans.
- Web services samples
These samples demonstrate both JAX-RPC and JAX-WS web services that use Java EE beans and JavaBeans components.
The JAX-WS web service samples demonstrate the implementation of one-way and two-way web services that highlight the use of web services standards such as WS-Addressing(WS-A) , WS-Reliable Messaging (WS-RM), and WS-Secure Conversation (WS-SC) and the SOAP Message Transmission Optimization Mechanism (MTOM) technology.
- 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.
We can download samples from the Samples, v8.5 information center.
- Go to the Samples, v8.5 information center.
- Determine which samples to download.
- On the Downloads tab for the samples you want, click a Download Sample link.
- In the authentication window, click OK.
- Download the compressed file, or individual sample files, to a directory on the workstation.
You might create the /samples/sample_type directory path on the workstation and download the sample files to that directory path.
Many sample compressed files have an /installableApps directory containing deployable prebuilt archives. Other directories contain files such as sample-specific source archives, scripts, and instructions for building deployable archives.
(dist)(zos) To deploy them to the application server, we can use the console or use the install script in the app_server_root/samples/bin directory.
Limitations of the samples
- The samples are for demonstration purposes only.
The code 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 administrative security.
- Many of the samples connect to an Apache Derby database using the embedded framework of Apache Derby. The embedded framework of Apache Derby has a limitation that only one JVM can access a given database instance. As a result, in a clustered application server 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 Apache Derby instance, use the Apache Derby networkServer framework.
Additional samples and examples
- Samples on developerWorks
- Additional product samples are available on WebSphere developerWorks
- Samples in tutorials
- Many product tutorials rely on sample code. To find tutorials that demonstrate specific technologies, browse the links in Tutorials.
- Examples in the product documentation
- The product documentation contains many code snippets and examples. To locate these examples easily, see the developer examples in the Reference section of the information center navigation for the product edition that you are using.
- (iseries) IBM Telephone Directory
- The IBM Telephone Directory business application is shipped separately from the product. For information about obtaining and using the IBM Telephone Directory application, see IBM Telephone Directory V5.2 in the topic on e-business and web serving in the IBM i information center.
Samples, v8.5 information center Install enterprise application files Querying the application state Adding, managing, and removing nodes Example: Install a web services sample with the console