This section describes the deployment of the Message Driven Beans (MDBs) on the IPlanet Application Server (now known as SunOne Application Server) through the integration of FioranoMQ with the IPlanet Application Server. The steps required to integrate FioranoMQ with SunOne Application Server 7 are explained in this section.
29.12.1 Installing and Setting up the Iplanet Application Server 7
Follow the steps below to install the IPlanet Application Server 7:
- Expand or unzip the installation bundle and save to a temporary directory.
- Navigate to the directory in which the files are saved and double-click the setup.exe file.
- Read the Welcome screen and click Next.
- Enter the path to the installation directory or click the ellipsis (...) to browse for a directory.
- In the Server Configuration Information dialog box, enter the information given below:
- Admin User: Name of the User who administers the Server.
- Administration User's Password: Password to access the Administration Server. Minimum number of characters is 8. Re-enter the password in the text box to confirm the password.
- Administration Server Port: Port number to access the Administration Server. A default port number will be displayed (for example 4848). Change this default port number, if necessary Click Next. The installation program checks port numbers for validity and availability.
- HTTP Server Port: Port number to access the initial Server instance.
- When the installation process is complete, the Installation Complete screen will be displayed. Review the content of this screen and click Finish to exit the installer.
- Set the PATH environment variable: Add the value of the <install_dir>/bin to the front of the PATH value. For example, add \Sun\AppServer7\bin; to the front of the variable value through the Control Panel.
Troubleshooting Environment Settings
The following result is obtained upon execution of the asadmin command:
C:\>asadmin
Use "exit" to exit and "help" for online help
asadmin>
This indicates that the environment settings have been configured successfully.
Starting Administrative Server and Application Server
SunOne Application Server 7 introduces a feature named Administrative Domains that enables defining multiple, disparate Application Server runtime configurations that reuse the same installation image.
Each Administrative Domain is represented by an Administrative Server, which in turn controls one or more application Server instances. The configuration of an Administrative Domain can reside anywhere on the machine.
Use the following command to start both the Administrative Server and the Application Server instances:
In the above command, domain1 is the name of the Administrative Domain defined by default during the installation of the IPlanet Application Server.
The following result is obtained after the command is executed:
29.12.2 Configuring FioranoMQ Server for IPlanet Integration
Below are the steps required to configure the FioranoMQ Server for IPlanet integration:
- Start the FioranoMQ Server (Start > Programs > Fiorano > FioranoMQ > FioranoMQ Server).
- Create JMS_MYQCF as a QueueConnectionFactory on FioranoMQ.
- Create JMS_MYQUEUE as a Queue on the FioranoMQ Server.
29.12.3 Configuring IPlanet Application Server 7 for the FioranoMQ Server
Below are the steps required to configure IPlanet Application Server 7 for the FioranoMQ Server:
- Using the web browser access the SunOne Administration Tool at http://<host>:<admin_port>. (The <host> is the machine on which the application server is installed and the <admin_port> is the server administration port (4848 by default).
- From the left frame click AppServer Instances > server1.
- From the right frame select JVM Settings tab.
- Click on Path Settings.
- Enter the following files in the CLASSPATH text box:
On Windows:
(Where fiorano_install_dir is the directory in which the FioranoMQ Server is installed.)
- In the Native Library Path Suffix text box, type: <fiorano_install_dir>/fmq/lib
- Click Save.
To transfer the above modifications to the Server, follow the steps below:
- Select the General tab and click on Apply Changes.
- Stop and re-start the Server instance.
- Navigate to the folder <appserver_install_dir>\samples\ejb\mdb\simple\src. In the file sun-application-client.xml, change the tag value of tags <resref-name> and <jndi-name> under tag <resource-ref>to jms_MyQcf.
- Change the value of tags <resource-env-ref-name> and <jndiname> under tag <resource-env-ref> to jms_MyQueue. FioranoMQ has a file based data store and creates folders based on the name of Queue. Folders cannot have names containing characters '/', '\'. '*', '?', '<', '>', '|'. Similarly, in the file sun-ejb-jar.xml, the value of tag <jndi-name>, under the tag <ejb> must be changed to jms_MyQueue and the value of tag <jndi-name>, under the tag <mdb-connection-factory> must be changed to jms_MyQcf.
- In the file applicationclient.xml, change the value of tag <res-ref-name>, under tag <resourceref> to jms_MyQcf and the value of tag <resource-env-ref-name>, under tag <resource-env-ref> to jms_MyQueue.
- Navigate to the folder <appserver_install_dir>\samples\ejb\mdb\simple\ src\samples\ejb\mdb\simple\client. In the file SimpleMessageClient.java, change the lookup names to jms_MyQcf instead of java:comp/env/jms/MyQcf and jms_MyQueue instead of java:comp/env/jms/MyQueue.
29.12.4 Registering JMS Resources with IPlanet Application Server 7
To register the JMS Resources with IPlanet Application Server 7 follow the steps below:
- Run the asadmin utility in multimode. For example: <AS_HOME>/bin/asadmin multimode. (Where <AS_HOME> is the SunOne Application Server installation home.)
Set global parameters so that you do not have to enter them for every sub command. For example:
In the above code:
<admin_username> is the Application Server administration User name.
<admin_password> is the administration password.
<host> is the machine on which the application Server is installed.
<adminserver_port> is the administration Server port of the Application Server.
<instance_name> is the Application Server instance name (example, server1).
3.Create external jndi external resources.
For the MDB sample application, create one external jndi resource with the resource type of javax.jms.QueueConnectionFactory and one external resource with the resource type of javax.jms.Queue. Refer to the code below:
In the above code,
- <qcf_jndi_lookup-name> and <qcf_jndi_name> should be replaced by jms_MyQcf.
- <q_jndi_lookup-name> and <q_jndi_name> should be replaced by jms_MyQueue
- <directory_path> is the providerURL i.e. http\://localhost\:1856 for the FioranoMQ Server.
The escape ({}) character has been used in front of the colon (:) in the directory path.
4. List the external jndi resources to verify the resources created. For example:
asadmin>list-jndi-resources –-user <admin_username e.g. admin> --password
<admin_password> --host <where appserver is running e.g. localhost> –-port 4848
<server_instance_name e.g. server1>
5. Reconfigure the Server instance to make sure that the changes made have been transferred to the Server. For example:
asadmin>reconfig instance_name
29.12.5 Compiling and Deploying the Sample mdb-simple.ear
Remove guest from <name> element and <password> element and leave these elements blank <appserver_install_dir>\samples\ejb\mdb\simple\src\sunapplication-client.xml. appserver_install_dir is the directory in which IPlanet Application Server 7 (SunOne AppServer) has been installed.
- In the command prompt, navigate to the src directory of the sample. For example: <appserver_install_dir>\samples\ejb\mdb\simple\src
- Execute the asant command. It recompiles the mdb and recreates the ear file mdb-simple.ear.
- Execute the asant deploy command. It causes the mdb-simple.ear to deploy on the SunOne AppServer.
29.12.6 Running the Sample Application
- Navigate to the <appserver_install-dir>/bin directory and edit the file appclient.bat. Add <fiorano_install_dir>\fmq\lib\fmq-rtl.jar;<fiorano_install_dir>\fmq\lib; to JVM_CLASSPATH.
For example,
Add c:\Progra~1\Fiorano\Fioran~1\fmq\lib\fmq-rtl.jar;\Progra~1\Fiorano\Fioran~1\fmq\lib;
To
JVM_CLASSPATH. Add <fiorano_install_dir>\fmq\lib
For example,
Add C:\Progra~1\Fiorano\Fioran~1\fmq\lib;
To
LD_LIBRARY_PATH
cd <appserver_ install_dir>/domains/domain1/server1/applications/j2ee-apps/mdb-simple_1
2. Execute the command > appclient -client mdb-simpleClient.jar -name Simple-MessageClient - textauth
The following output is displayed:
Sending message: This is message 1
Sending message: This is message 2
Sending message: This is message 3
The Message Bean receives the messages and they are printed in the log file (<appServer_install_dir>\domains\domain1\server1\logs server.log):
MESSAGE BEAN: Message received: This is message 1
MESSAGE BEAN: Message received: This is message 2
MESSAGE BEAN: Message receive: This is message 3