4 - Reusing DOS Application in a Webserver Context
Running a Client Application from within a Browser and Webserver
In this suite of applications, you will get a web application to reuse already existing functionality (the Simple CORBA Time Client). Browser are by their very nature dumb... Web servers by their nature are also dumb, serving up static content. In order to allow them to serve up dynamic content extensions have been added to the web servers, in some cases the extensions have become a permanent addition. In order for you to see what's going on under hood, we use Apache Tomcat, this should already be available on the VM (version 5.5.26 zip file: apache-tomcat-5.5.26 located in c:\software\java).
- Ensure the SimpleCORBATimeServer is still running, if it is not, run it before step 9 as the webapplication will not be able to bind to your service...
- Be sure that your service is exposed to the outside world
- Select /wiki/spaces/CSDOMA/pages/58032149 of how to start the server
- If it is not already set, set a new environment variable JACORB_HOME=d:\java\jacorb-3.6.1 (if you did not unzip jacorb to d:\java, you will need to point it to where you did unzip it)
- Unzip (if it has not already been done) Apache Tomcat to d:\java (you can find apache tomcat in your VM software folder, it must be version 5.5.26, 6.0.18+ or 7+ (the applications have been tested with these versions).
- You should have previously downloaded jacorb 3.6.1. If you want to look at and run the web app from within the netbeans IDE you will need to add the jacorb libraries to netbeans but this is not necessary for this lab (instructor will tell you how to do this).
- Download the application CORBA Date and Time Web Application, unzip it to d:\work\netbeans
- If you wish to tinker with the code, then load the project into netbeans, otherwise do nothing with the unzipped files for the moment
- Tomcat doesn't know anything about naming servers, and so it shouldn't... But our time service is registered with the CORBA naming server, so we need to make slight modifications to the bootstrapping file for tomcat
- via delicious download the file Catalina.bat for Apache Tomcat 7+ Jacorb 3.6.1 (this file is a modified version of the tomcat bootstrapping file so that the naming service is detected by tomcat)
- copy the downloaded catalina.bat file to the bin folder where you unzipped tomcat. Delete the current catalina.bat and rename the file catalina_for_jacorb_3_6_1.bat to catalina.bat
- Within the tomcat bin folder you will find a file called startup.bat, run it (before you run this file check if Tomcat is already running, if so stop it by running the file shutdown - can be found in same directory as startup)
- If all is well at this point, you can go to your browser and type localhost:8090, you should get the tomcat server page...
- Locate the unzipped files for the CORBA Date and Time Web Application (should be under c:\work\netbeans)
- go to the dist folder
- copy the file CORBADateAndTimeWebApp.war to the tomcat folder webapps folder, tomcat will automatically unarchive the file and create a folder called CORBADateAndTimeWebApp, in this folder is file call index.jsp, edit it: locate the instruction client.getService("TimeService") and change it to client.getService("TimeServer"). You need to do this so that the web application can get the correct service out of the naming server...
- from your browser type localhost:8090/CORBADateAndTimeWebApp
- At this point you should have a web application, reusing a client application, that is making use of a server application...
- if step 11 above works, you should be able to get the time from another machine (the service has been registered as "GlobalTimeServer").
Resultant Architecture
Detailed architecture
If you complete the above steps, you might want to try and getting the time of one of the delegates machines if their timer service is running.
If you encounter problems getting the time of your own machine, run the Simple CORBA Time Client application. If this fails then it could be that you don't have the time server running or the naming service isn't running!!!
Related articles