3-Tier Application Using RMI

Here I am providing a 3-tier client/server application using Oracle as the database, RMI remote object as application tier and a swing frame or a console application as the client.

This application is built with NetBeans IDE 5.5. You can download both server and client projects using the links below.

Server project (empserver) - empServer.zip
Client project (empclient)- empclient.zip

Steps related to empserver  (server ) project.

  1. First make sure you downloaded empserver.zip
  2. Unzip empserver into any directory. It will create a directory with the name empserver
  3. Start NetBeans IDE 5.5 and open the project by selecting empserver  as the folder
  4. This project needs to have Oracle JDBC driver, which is in OJDBC14.jar file. So include that in empserver project using libraries node in project window. This application is using  Oracle10g XE (Express Edition). In case you are using some other Oracle version, please change connection process accordingly in Database.java file.  In this case, you may also have to change the table name and column names in EmpImpl.java.
  5. Build the project.
  6. Class files related to .java files are placed in   build/classes directory of empserver project.
  7. Go to command prompt. Go to directory build/classes in empsever project directory.
  8. Run RMIC command as shown below from  build/classes directory
    RMIC  employee.EmpImpl
  9. Run RMIRegistry from the build/classes directory as follows
    RMIRegistry
  10. Come to NetBeans IDE 5.5 and  run EmpImpl.java. Make sure it is displaying a messaging saying "Employee Server Ready".
  11. The following are the files related to empserver project:

Steps related to client:

  1. First make sure you downloaded empclient.zip
  2. Unzip empclient into any directory. It will create a directory with the name empclient
  3. Open the project by selecting empclient  as the folder
  4. Go to libraries node in Project window and select  Add Jar/Folder option.
  5. From the dialog box, select   empserver/build/classes directory as the directory to be included in client project. This steps is required as some components required by client are placed in employee package which is in build/classes folder of empserver.
  6. Build the project.  
  7. Run EmpClient.java.  It should display details of  employee with id 100.
  8. Run EmpSwingClient.java  It provides textfield to enter employee id. Enter 100 and then click on Get Details button. Once details are obtained, change salary in second textfield and click on update button. You can check whether salary is changed or not by click on Get Details button to get details of employee id 100 again. 
  9. File related to empclient projects are :

Good Luck,

P.Srikanth.