PlantsByWebSphere Ajax on WebSphere® Application Server 6.1
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 JavaTM
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. The scope is 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 source in the
left menu.
- Select the scope. The scope is 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.
Installing the PlantsByWebSphere application on WebSphere Applications Server 6.1
Before
you begin:
Locate the PlantsByWebSphere
Enterprise Application Archive (EAR) file that was provided with this
documentation.
- If you installed the IBM WebSphere Application Server Feature
Pack for Web 2.0 and Mobile using the installer, then you will find the PlantsByWebSphere.ear
file at the following location:
UNIX-based: <WAS_HOME>/web2mobilefep_1.1/samples/PlantsByWebSphere/PlantsByWebSphere.ear |
Linux or z/OS: <WAS_HOME>/web2mobilefep_1.1/samples/PlantsByWebSphere/PlantsByWebSphere.ear |
Windows: <WAS_HOME>\web2mobilefep_1.1\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 6.1
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
--> Install New Application in the left menu.
- 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 install.
- 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
--> 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
--> 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.