Run the MDB Sample with TIBCO EMS


This section demonstrates the procedure for using the sample MDB with EMS.

Configure Application Server

In a web browser, access Sun’s Java System Administration Tool at http://host:admin_port

  1. In the left frame, navigate the tree to the folder AppServer Instances->server1
  2. In the right frame, click the JVM Settings tab, then the Path Settings link.
  3. In the Classpath Suffix box, enter the filename C:\tibco\ems\clients\java\tibjms.jar
  4. Click the Save button.
  5. To propagate these modifications to the server, click the General tab, then the Apply Changes button. Then stop and restart the server instance.

Register JMS Resources with Application Server

  1. Change directory to install_dir\bin, and run these commands:
  2.  
    asadmin multimode 
     
    asadmin>export AS_ADMIN_USER=admin AS_ADMIN_PASSWORD=password AS_ADMIN_HOST=hostname 
    AS_ADMIN_PORT=port AS_ADMIN_INSTANCE=server 
     
    asadmin>create-jndi-resource --jndilookupname QueueConnectionFactory --resourcetype 
    javax.jms.QueueConnectionFactory --factoryclass 
    com.tibco.tibjms.naming.TibjmsInitialContextFactory --enabled=true --property 
    java.naming.provider.url=tibjmsnaming\://localhost\:7222 jms/MyQcf 
     
    asadmin>create-jndi-resource --jndilookupname queue.sample --resourcetype 
    javax.jms.Queue --factoryclass com.tibco.tibjms.naming.TibjmsInitialContextFactory 
    --enabled=true --property java.naming.provider.url=tibjmsnaming\://localhost\:7222 
    jms/MyQueue 
     
    asadmin>reconfig server1 
    

Run the Sample

  1. Ensure that the EMS server is running with the default configuration.
  2. Change directory to install_dir\bin. Modify appclient.bat by adding C:\tibco\ems\clients\java\tibjms.jar to JVM_CLASSPATH.
  3. Change directory to install_dir\samples\ejb\mdb\simple\src, then build and deploy the sample using the following commands:

Build

asant 

Deploy

asant deploy 
 

The server log should indicate that the MDB is successfully deployed.

Run

  1. Change directory to install_dir\domains\domain1\server1\applications\j2ee-apps\mdb-simple_1, and run this command:
  2.  
    appclient -client mdb-simpleClient.jar -name SimpleMessageClient 
    -textauth 
     

    The console should display these lines:

    Sending message: This is message 1 Sending message: This is message 2 Sending message: This is message 3

    The server log should display these lines:

    MESSAGE BEAN: Message received: This is message 1 MESSAGE BEAN: Message received: This is message 2 MESSAGE BEAN: Message received: This is message 3

Clean Up

  1. Clean up the build and undeploy the sample MDB.
  2. Change directory to install_dir\samples\ejb\mdb\simple\src, and run these commands:

     
    asant clean 
    asant undeploy 
    
  3. Remove the directory: install_dir\domains\domain1\server1\applications\j2ee-apps\mdb-simple_1
  4. Undeploy JNDI resources:
  5.  
    asadmin>delete-jndi-resource jms/MyQcf 
    asadmin>delete-jndi-resource jms/MyQueue 
    asadmin>reconfig server1 
    

TIBCO Enterprise Message Service™ Application Integration Guide
Software Release 4.3, February 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com