JMS Chat Sample Application

Table of Contents



Required Software

Back To Top
  • OC4J 9.0.4 or later (Developers Preview or Production) downloadable from here
  • Ant (Version 1.5 or higher) downloadable from here


Notations Used

Back To Top


Notation Description
<OC4J_HOME> Folder where OC4J is installed. For example, D:\oc4j
<SAMPLE_HOME> Folder where the JMS Chat sample will be unzipped. For example, D:\ChatSample


Extracting the source code

Back To Top

Use the following command to extract the source code.

> jar xvf JMSChatSample.jar
Click here to view the directory structure and description of sample files. 

 

Deploying and Running the application

Back To Top


1. Edit <OC4J_HOME>/j2ee/home/config/jms.xml in your favorite XML editor. Add the following lines under the <jms-server> tag. 
<queue-connection-factory name="MainQueueConnectionFactory" location="jms/MainQueueConnectionFactory"/>
<queue name="MainQueue" location="jms/MainQueue"/>

<topic-connection-factory name="ChatTopicConnectionFactory" location="jms/ChatTopicConnectionFactory"/>
<topic name="ChatTopic" location="jms/ChatTopic"/> 

2. Go to the directory <SAMPLE_HOME>/server on command prompt and type the following command
> ant
The script will ask you for the value of <OC4J_HOME>. This will create the ear file ChatServer.ear under the folder <SAMPLE_HOME>/server/build. 
3.  Go to the directory <OC4J_HOME>/j2ee/home on command prompt and type the following
> java -jar oc4j.jar
This will start the OC4J server.
4. Now, we will deploy the sample application onto OC4J. Open a command prompt and go to the folder <OC4J_HOME>/j2ee/home and type the following commands
> java -jar admin.jar ormi://<machine_name>:<admin_port> admin <admin_pwd> -deploy -file <SAMPLE_HOME>/server/build/ChatServer.ear -deploymentName Chat

> java -jar admin.jar ormi://<machine_name>:<admin_port> admin <admin_pwd> -bindWebApp Chat Chat_War http-web-site /chat

where,

<machine_name> Name of the machine where OC4J Server is running
<admin_port> Admin Port on which the OC4J server listens. This value by default is 23791 unless explicitly changed by the user
<admin_pwd> Adminstrator password to access OC4J
5. Now, we will build the Client Chat Application. Go to the directory <SAMPLE_HOME>/client on command prompt and type the following
> ant
This will create Chat.jar under the folder <SAMPLE_HOME>/client/Chat.
6. On Command prompt, go to the directory <SAMPLE_HOME>/client/Chat and type the following
> java -jar Chat.jar
This will start the Chat Client Application. Now, a window will open where the Chat Server parameters should be entered. On clicking the Login button, you will see the window for chatting.


Troubleshooting 

Back To Top
    While deploying the application in Step 4 , you see the following error on the OC4J console
    Error deploying file:/D:/oc4j/j2ee/home/applications/Chat/Chat_Jar.jar homes: No javax.jms.Destination found at the specified destination-location (jms/MainQueue) for MessageDrivenBean ListenerMDB
    This means that the queue and topic entries have not been entered properly in the jms.xml. Please follow Step 1 correctly.



E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy