Modifying this Example to Use SSL Communication


This section describes how to modify the above example to use SSL communications between the TIBCO Enterprise Message Service server, the WebLogic Server 8.1, and the client program. This section assumes you have already set up and run the example detailed in the previous sections.

Add the SSL JAR Files and New JNDI Properties File to the CLASSPATH

Modify the WebLogic Server 8.1 environment setup script, setExamplesEnv.cmd in the directory C:\bea\weblogic81\samples\domains\examples. This script is used to setup the environment to run the examples and the examples WebLogic server.

To add SSL JAR Files and New JNDI Properties File to the WLS 8.1 CLASSPATH:
  1. Open the file named setExamplesEnv.cmd.
  2. Add the following jar files to the end of the CLASSPATH and save the file.
  3.    C:\Tibco\ems\clients\java\jcert.jar;C:\Tibco\ems\clients\java\ 
       jnet.jar;C:\Tibco\ems\clients\java\jsse.jar;C:\Tibco\ems\ 
       clients\java\tibcrypt.jar; C:\Tibco\ems\clients\java 
    
  4. Create a new file named jndi.properties, add the following lines and save it to the directory C:\Tibco\EMS\clients\java.
  5.    com.tibco.tibjms.naming.security_protocol=ssl 
       com.tibco.tibjms.naming.ssl_enable_verify_host=false 
     

    These properties specify that the "SSL" protocol should be used for JNDI lookups and that host verification is turned off (the client will trust any host). JNDI reads this file automatically and adds the properties to the environment of the initial JNDI context.

Configure the TIBCO Enterprise Message Service Server for SSL

In C:\Tibco\EMS\bin\tibemsd.conf, add the following lines:

listen = ssl://localhost:7243 
ssl_server_identity = certs/server.cert.pem 
ssl_server_key = certs/server.key.pem 
ssl_password = password 
listen = tcp://localhost:7222 

These lines explicitly set the tcp and ssl listen ports and specify the three required server-side SSL parameters identity, private key, and password.

Save the file, then stop and restart the TIBCO Enterprise Message Service server. When the server restarts, you should see messages like the following in the console window confirming SSL is enabled:

2003-06-14 10:00:05 Secure Socket Layer is enabled, using openSSL <version> 
2003-06-14 10:00:05 Accepting connections on ssl://<machineName>:7243. 
2003-06-14 10:00:05 Accepting connections on tcp://<machineName>:7222. 

Modify the foreign JMSConnectionFactory in WebLogic to point to an SSLConnectionFactory

In the web browser load the page, http://<machineName>:7001/examplesWebApp/index.jsp. Click on the Administration Console link. Enter weblogic as the Username and Password and click Sign In.

  1. In the left pane, select examples->services->JMS->Foreign JMS Servers->TIBCO JMSServer.
  2. In the right pane, replace the contents of the JNDI Connection URL box with tibjmsnaming://localhost:7243. Click Apply.
  3. In the left pane, select examples->services->JMS->Foreign JMS Servers->TIBCO JMSServer->Foreign JMSConnectionFactories->TIBCO JMSTopicConnectionFactory.
  4. In the right pane, replace the contents of the Local JNDI Name box with TIBCO.tcf and the contents of the Remote JNDI Name box with SSLTopicConnectionFactory. Click Apply.

Modify the Example Client Program for SSL-Based Communication

The modifications necessary for the example client program are similar to those that were necessary for MDB:

  1. In Client.java, change the string TopicConnectionFactory to SSLTopicConnectionFactory.
  2. In build.xml, change the port number 7222 to 7243 for the URL.

Rebuilding and Redeploying the Example MDB

Restart the WebLogic Server Examples Server so that it picks up the SSL related changes to the environment.

From the example MDB source directory, enter the command:

> ant 

As the build completes, you should see messages in the WebLogic Server Examples Server window indicating that it is activating the "message" application.

Running the Example MDB Client with SSL

Create a new command prompt window and run the examples setup script, setExamplesEnv.cmd, so that the SSL related changes to the environment are picked up.

From the example MDB source directory, enter the command:

> ant run 

You should see the same messages sent by the client and received by the MDB in the WebLogic server window. You may notice that this example runs slightly slower than the non-SSL version. This is because of the SSL handshake that occurs before the messages are displayed.

To show that SSL communications are in fact occurring, you could remove the SSL settings you added to tibemsd.conf. Then restart the TIBCO Enterprise Message Service server and the WebLogic Server. If you check the WebLogic Server logs, you should see exceptions thrown indicating that it could not connect. If you now run the test program again, you should see that it throws an exception indicating that it could not connect to the server using the SSL protocol. Alternatively (or additionally), you could start the TIBCO Enterprise Message Service server from a command prompt window and turn SSL debug tracing on, as follows:

>tibemsd -ssl_debug_trace 

Then, if you re-start WebLogic Server and re-run the test program, you will see SSL debugging output on the tibemsd console window.


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