kvorion
February 24th, 2006, 06:00 PM
Hi guys,
I am new to java programming. Today I was trying to do a simple implementation of RMI. I tried to run my Server.class today, and it threw exceptions at me, which dont make any sense to me. Kindly help me find out what the problem is.
This is the exception:
Server exceptionjava.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.UnsupportedClassVersionError: remoteInterface (Unsupported major.minor version 49.0)
the Server.java code is:
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class Server implements remoteInterface
{
// instance variables - replace the example below with your own
private int x;
/**
* Constructor for objects of class Server
*/
public Server()
{
// initialise instance variables
x = 0;
}
/**
* The implementation class Server implements the remote interface remoteInterface, providing an implementation for the remote method add.
*
* The main method of the server needs to create the remote object that provides the service.
* Additionally, the remote object must be exported to the Java RMI runtime so that it may receive incoming remote calls.
* The static method UnicastRemoteObject.exportObject exports the supplied remote object to receive incoming remote method invocations
* on an anonymous TCP port and returns the stub for the remote object to pass to clients.
*
* @param x first double parameter
* @param y second double parameter
* @return the sum of x and y
*/
public double add(double x,double y) throws RemoteException
{
return x + y;
}
public static void main(String args[])
{
try
{
Server obj1 = new Server();
//create a stub
remoteInterface stub = (remoteInterface) UnicastRemoteObject.exportObject(obj1,0);
//bind the remote object's stub in the registry to a name
Registry registry = LocateRegistry.getRegistry();
registry.bind("remoteobject",stub);
System.err.println("server ready");
}
catch(Exception e)
{
System.out.println("Server exception" + e.toString());
e.printStackTrace();
}
}
}
I am new to java programming. Today I was trying to do a simple implementation of RMI. I tried to run my Server.class today, and it threw exceptions at me, which dont make any sense to me. Kindly help me find out what the problem is.
This is the exception:
Server exceptionjava.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.UnsupportedClassVersionError: remoteInterface (Unsupported major.minor version 49.0)
the Server.java code is:
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class Server implements remoteInterface
{
// instance variables - replace the example below with your own
private int x;
/**
* Constructor for objects of class Server
*/
public Server()
{
// initialise instance variables
x = 0;
}
/**
* The implementation class Server implements the remote interface remoteInterface, providing an implementation for the remote method add.
*
* The main method of the server needs to create the remote object that provides the service.
* Additionally, the remote object must be exported to the Java RMI runtime so that it may receive incoming remote calls.
* The static method UnicastRemoteObject.exportObject exports the supplied remote object to receive incoming remote method invocations
* on an anonymous TCP port and returns the stub for the remote object to pass to clients.
*
* @param x first double parameter
* @param y second double parameter
* @return the sum of x and y
*/
public double add(double x,double y) throws RemoteException
{
return x + y;
}
public static void main(String args[])
{
try
{
Server obj1 = new Server();
//create a stub
remoteInterface stub = (remoteInterface) UnicastRemoteObject.exportObject(obj1,0);
//bind the remote object's stub in the registry to a name
Registry registry = LocateRegistry.getRegistry();
registry.bind("remoteobject",stub);
System.err.println("server ready");
}
catch(Exception e)
{
System.out.println("Server exception" + e.toString());
e.printStackTrace();
}
}
}