Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help -- RMI in Applet

Status
Not open for further replies.

tejaspillai

Programmer
Dec 17, 2000
4
US
hi ,

i have some doubts on applet using rmi.

this is the rmi applet code :
-----------------
interface:
import java.rmi.*;

public interface AppletMess extends Remote
{
public String appletMessage() throws RemoteException;
}
----------------------
implementation class:
import java.rmi.*;
import java.rmi.server.*;

public class AppletMessImp extends UnicastRemoteObject implements AppletMess
{
public AppletMessImp() throws RemoteException
{
super();
}

public String appletMessage() throws RemoteException
{
return "Hello, Object One Welcome's You";
}

}
----------------------------
Server :
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
public class AppletMessServer
{
public static void main(String args[])
{
//System.setSecurityManager(new RMISecurityManager());
try
{
AppletMess sobj= new AppletMessImp();
System.out.println("main");
Naming.bind("asit", sobj);
System.out.println("Remote Object bound in registry");
}
catch(Exception ee)
{
System.out.println("Implimentation error:"+ee.getMessage());
ee.printStackTrace();
}
}
}
------------------------
Client applet : this is giving problem while running in
ie 5.0
i have also downloaded plugin from sun site.
this code works fine with appletviewer .

import java.applet.*;
import java.awt.*;
import java.rmi.*;
public class AppClient extends Applet
{
// <Applet name =&quot;AppClient&quot; code=&quot;AppClient&quot; width=&quot;400&quot; height=&quot;400&quot;> </Applet>
String res=&quot;&quot;;
public void init()
{
System.out.println(&quot;lookup start&quot;);

//System.setSecurityManager(new RMISecurityManager());
try
{

AppletMess cobj = //(AppletMess)Naming.lookup(&quot;server&quot;);
(AppletMess)Naming.lookup(&quot;asit&quot;);
System.out.println(&quot;lookup over &quot;);
res=cobj.appletMessage();
repaint();
}
-------------------------------------------------
HTML client:

<html>
<body>
<applet code=&quot;AppClient&quot; name=&quot;AppClient&quot; width=&quot;400&quot; height=&quot;400&quot;>
</applet>
</body>
</html>

-----------------------------------------
pl guide me.
how should i use java.rmi.server.codebase property?
Also

should i go for embed tag?pl let me know when to use embed tag.

waiting for your mail

Tejas

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top