Professional Documents
Culture Documents
Assignmet-2
Advanced Java
Stub
TCP/IP
SERVER
-------------------------------------------------------
Remote
reference
Skeleton
----------------------------TCP/IP
Physical Network
1. Client Application:
This is the application running on the client system.
The client obtains a reference to the remote server.
Once reference is obtained, a method can be invoked on the remote
reference.
2. Stub:
4. Skeleton:
The skeleton is the client-side proxy on the server side.
It receives network data from the Stub.
It then un-Marshalls the data.
Un-Marshalling is the reverse process of marshalling.
The Stub once again Un-Marshalls it and return the result to the client
application.
Helloclient.java
Package
Import java.rmi.Naming;
Public class helloclient
{
Public static void main (String args [])
{
Try
{
HelloInterface
Hello= (Hello Interface) naming. Lookup (//local host/hello) ;
System.out.println (hello.say ());
}
Catch (Exception e)
{
System.out.println (helloclient exception:+e);
}
}
}
helloInterface.java
Package
Import java, rmi.*;
Public interface helloinetrface extends Remote
{
Public string say () throws RemoteException
}
Helloserver.java
Package
Import java.rmi.Naming;
Import java.rmi.registry.Registry;
Public class helloserver
{
Public static void main (String args [])
{
Try
{
Registry r= java.rmi.registry.LocateRegistry.CreateRegistry (1099);
OUTPUT
Server is connected and ready for operation
Arsenal Football Club, THFC forever in our Shadow.
b) Troubleshooting
If path is not set properly, i.e. java<java source file> say bad command or file
name
Go to Start->Setting->Control panel->system.
Go to Advanced tab and choose environment variables.
In the system variables or use variables section, choose path and
click Edit.
If path is not available, click on new and type path in the
variables name field.
E.g.:
Choose ok three times and close all windows
Close all command prompts and start them again
If any of to the application does not run properly, set the class path.
c) JavaBeans
d) JNDI
A Naming service is analogous to a telephone operator.
When you want to call up someone over the phone and you do not
know the persons phone number.
Metadata
Directory metadata defines the structure of your directory.
It defines the schema of how your directory is laid out.
Metadata supplies a set of rules about your directory, such as
restriction on tree branches, restrict on attributes, and more.
Overall, directories are not very different from databases.
You can think of a directory as a scaled-down, simplified database.
And each directory standard has a different protocol for accessing the
directory.
It also means you need to download a new library, learn a new API,
and test new code each time you use a different directory.
Person 1
People
Person 2
Printer 1
My
Company
Printers
Computer 1
Network
services
Computers
Fax
Machines
Computer 2
e) Servlets
Fax
Servlets
Generic
Servlet
Http Servlet
My Servlet
The servlet interface declares, but does not implement that manage the
servlet and its communication with client.
Servlet writers provide some or all of these methods when developing
a srevlet.