Remote shutdown using RMI ....
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ajay_kemparaj
Posted On:   Thursday, March 30, 2006 02:43 AM

Can any one help to execute the following code ...it has 4 parts ...got it from the web .... interface ,serverimpl,server,client ...but there is no compilation errors its is resylting in runtime exception like stubgeneration failed interface.java import java.rmi.*; import java.rmi.server.*; public interface intf extends Remote { public void shutdown() throws RemoteException; } Implementation Java file import java.util.*; import java.io.*; import java.rmi.*; import java.rmi.server.*; public class Serverimpl extends UnicastRemoteObject implements intf { public Serverimpl() throws RemoteException {} public voi   More>>

Can any one help to execute the following code ...it has 4 parts ...got it from the web .... interface ,serverimpl,server,client ...but there is no compilation errors its is resylting in runtime exception like stubgeneration failed


interface.java

import java.rmi.*;
import java.rmi.server.*;
public interface intf extends Remote
{
public void shutdown() throws RemoteException;
}

Implementation Java file

import java.util.*;
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
public class Serverimpl extends UnicastRemoteObject implements intf
{
public Serverimpl() throws RemoteException
{}
public void shutdown()
{
try
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("shutdown -l");
}
catch(Throwable t)
{
t.printStackTrace();
}
}
}

Server Java file

import java.rmi.*;
import java.rmi.server.*;
public class Server
{
public static void main(String arg[]) throws Exception
{
Serverimpl impl = new Serverimpl();
System.out.println("Initialising server.........");
Naming.rebind("rajesh",impl);
System.out.println("Registered");
}
}


Client java file

import java.rmi.*;
import java.rmi.server.*;
public class Client
{
public static void main(String args[]) throws Exception
{
String url = "rmi://192.0.0.100/rajesh";
intf intf1 = (intf)Naming.lookup(url);
intf1.shutdown();
}
}

   <<Less

Re: Remote shutdown using RMI ....

Posted By:   Edward_Harned  
Posted On:   Thursday, March 30, 2006 08:24 AM

No one can help you until you help us. Format your code so we can read it.

About | Sitemap | Contact