PlantsByWebSphere on WebSphere Application Server 7.0
Configure the Database for PlantsByWebSphere
The PlantsByWebSphere application uses the Derby database which is provided
by WebSphere Application Server. The PlantsByWebSphere.ear file contains a set of embedded Derby database tables that are used
by the application. Configuring the database connection involves creating a Derby Java Database Connectivity (JDBC) XA-provider,
if one has not already been created, and defining a data source to the application.
Define the Derby XA Provider
- Start WebSphere Application Server and log into the administrative console to define a Derby JDBC XA provider, if one is not
already defined.
- Select Resources --> JDBC --> JDBC Providers in the left menu. The JDBC provider encapsulates the implementation class
for the specific database provider.
- Select the scope, for example Node=<Node Name>,server=<Server Name>.
- Select New button.
- For the Database type select Derby.
- For the Provider type select Derby JDBC Provider.
- For Implementation type select XA Data source.
- For Name type: "Derby Provider for PlantsByWebSphereAjax (XA)".
- Click Next.
- Click Finish.
- Select Save to save directly to the master configuration.
The provider is configured. Next you create and associate the PlantsByWebSphere data source with the
new provider.
Define and associate the Data source for the PlantsByWebSphere application
- Click Resources --> JDBC --> Data sources in the left menu.
- Select the scope, for example Node=<Node Name>,server=<Server Name>.
- Click New to create a new data source.
- For the Data source name enter PLANTSDB.
- For the JNDI name enter jdbc/PlantsByWebSphereAjaxDataSource.
- Click Next.
- Select Select an existing JDBC Provider radio button.
- Select Derby Provider for PlantsByWebSphereAjax (XA) which you defined earlier.
- Click Next.
- For the Database name enter ${APP_INSTALL_ROOT}/${CELL}/PlantsByWebSphereAjax.ear/Database/PLANTSDB
The ${APP_INSTALL_ROOT}/${CELL} is a WebSphere environment variable and should be entered as written.
- Mark the check box 'Use this data source in container managed persitence (CMP)'. The check box may already be
selected by default.
- Click Next.
- Click Finish.
- Click save to save to the master configuration.
Database Considerations and Node Federation
If the federation state of your nodes changes you may need to redo the above steps. For example
if you configure the database for a standalone node and then later federate that node you may need to
delete and recreate the resouces defined above at the proper scope.
Installing the PlantsByWebSphere application on WebSphere Applications Server 7.0
Before you begin:
Locate the PlantsByWebSphere Enterprise
Application Archive (EAR) file that was provided with this
documentation.
- Find the PlantsByWebSphere.ear file at the following location:
UNIX-based or z/OS: <WAS_HOME>/feature_packs/cea/samples/plantsbywebsphere/PlantsByWebSphere.ear |
Linux: <WAS_HOME>/feature_packs/cea/samples/plantsbywebsphere/PlantsByWebSphere.ear |
Windows: <WAS_HOME>\feature_packs\cea\samples\plantsbywebsphere\PlantsByWebSphere.ear
|
The PlantsByWebSphere application is an undeployed Java Enterprise Archive file (EAR). This means that the deployment bindings between the
Enterprise Java Beans (EJB) and the application server are not generated yet. To generate the bindings, run the deployment
tool that is provided with WebSphere Application Server. The deployment tool generates an EAR file that contains generated binding
code. The newly generated EAR file can then be installed to WebSphere Application Server.
Open a command window for your platform and type the following command. This assumes the Windows platform, but the method is the
same on other platforms.
ejbdeploy.[bat|sh] PlantsByWebSphere.ear <working directory> PlantsByWebSphere_deployed.ear -dbvendor DERBY_V10
The ejbdeploy tool is located in the bin directory of where you installed WebSphere Application Server 7.0
The <working directory> is a temporary location that the ejbdeploy tool can use for storage. As an example, on Windows a
temporary location could be the c:/temp directory.
|
- Start the WebSphere Application Server, go to the administrative console and log in with your user ID and password.
Click Applications --> New Application in the left menu.
- Select New Enterprise Application
- For the path to the new application, click Browse and locate the PlantsByWebSphere_deployed.ear file. You created this
file in the previous step.
- Click Next (Preparing for the application installation. Accept the default: Fastpath).
- Proceed through the install accepting the defaults.
- Click Finsh.
- Click save to save to the master configuration after the application is installed.
- To start the application afer installation, Select Applications --> Application Types --> WebSphere enterprise applications in the
left menu.
- Select the PlantsByWebSphereAjax application checkbox, followed by clicking Start.
Accessing PlantsByWebSphere : AJAX Edition
The URL for the application is http://localhost:9080/PlantsByWebSphereAjax
This information assumes that the internal HTTP server is running on port 9080. The port can be different depending
on how you installed the application server. You can locate the HTTP port by clicking Servers --> Server Types --> WebSphere application servers
in the left menu. Select the application server from the list. On the Application Servers property window, click
ports to see a list of currently configured ports for the server. The HTTP port is the WC_defaulthost entry.