× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Java RMI Server/Registry error on AS/400
  • From: "Beau" <wwboater@xxxxxxxxxxxxx>
  • Date: Tue, 27 Jul 1999 15:08:22 -0400

I am having an issue (java.rmi.NoSuchObjectException: no
such object in table) running RMI on an AS/400 that I haven't seen
elsewhere.
I am going to include source code for a test server that I have been
running.

I am submitting the following two commands with a SBMJOB of a STRQSH
command:

rmiregistry

java -Djava.rmi.server.hostname=[ip address of firewall]
RMITestServer.RMIServer

The server works with no problems for a while, but then after an
indetermined amount of time/number of uses I get the following exception
when hitting it with my test client:  java.rmi.NoSuchObjectException: no
such object in table

I am guessing this is an AS/400 issue as I have never seen this, but I am
not sure.  The jobs have been set to a RUN PRIORITY of 20 so that they don't
get overrun by interactive jobs.

This is very troubling, I can't figure out what is going on here - please
assist if you can!

Here is the server code:

package RMIServerTest;

import java.rmi.*;

public interface RMIServerInterface extends Remote
{
 public TestReturnClassInterface getTestReturnClass(String version) throws
RemoteException;
 public String testServer(String incomingText) throws RemoteException;
}

package RMIServerTest;

import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.io.*;
import java.util.*;

public class RMIServer extends UnicastRemoteObject implements
RMIServerInterface
{
/**
 * RMIServer constructor comment.
 */
public RMIServer() throws RemoteException
{
 super();
}
 public TestReturnClassInterface getTestReturnClass(String version) throws
RemoteException
 {
  return new TestReturnClass();
 }
 public static void main(String arg[])
 {
  try
  {
   RMISocketFactory.setSocketFactory(new FirewallSocketFactory());
   System.setSecurityManager(new RMISecurityManager());
   System.out.println("Initializing Server...");

   RMIServer rmiServer = new RMIServer();
   Naming.rebind("RMIServer",rmiServer);
   System.out.println("Server Ready...");

   // Take out startup garbage now
   System.gc();
   System.runFinalization();
  }
  catch (Exception e)
  {
    System.out.println("Exception occured:  " + e.getMessage());
    e.printStackTrace();
    System.exit(0);
  }
   System.out.println("Server Ready...");
 }
 public String testServer(String incomingText) throws RemoteException
 {
  System.out.println("Client testServer() invocation:  "+incomingText);
  return "Text received from Server class:  "+incomingText;
 }
}

package RMIServerTest;

import java.net.*;
import java.io.*;
import java.rmi.server.*;

public class FirewallSocketFactory extends RMISocketFactory
{
/**
 * SSLSocketFactory constructor comment.
 */
public FirewallSocketFactory() {
 super();
}
 public ServerSocket createServerSocket(int port) throws IOException
   {
  if (port==0)
  {
                        file://Set static port for Firewall
     return new ServerSocket(1098);
  }
  else
  {
     return new ServerSocket(port);
  }
   }
 public Socket createSocket(String host, int port) throws IOException
   {
    return new Socket(host,port);
   }
}

package RMIServerTest;

import java.rmi.*;

public interface TestReturnClassInterface extends Remote
{
 public String testReturnClass(String incomingText) throws RemoteException;
}

package RMIServerTest;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class TestReturnClass extends UnicastRemoteObject implements
TestReturnClassInterface
{

public TestReturnClass() throws RemoteException
{
 super();
}
 public String testReturnClass(String incomingText) throws RemoteException
 {
  System.out.println("Client testReturnClass() invocation:  "+incomingText);
  return "Text received from Return class:  "+incomingText;
 }
}

And here is the client I am using:

package RMIServerClient;

import java.rmi.*;
import RMIServerTest.*;

public class RMIClient
{
public RMIClient()
{
 super();
}
 public static void main(String arg[])
 {
  try
  {
   RMIServerInterface
rmiServer=(RMIServerInterface)Naming.lookup("rmi://12.10.67.226/RMIServer");
   TestReturnClassInterface
testReturnClass=rmiServer.getTestReturnClass("1");
   System.out.println(rmiServer.testServer("test of Server class"));
    System.out.println(testReturnClass.testReturnClass("test of Return
class"));
  }
  catch (Exception e)
  {
    System.out.println("Exiting..." + e);
    System.exit(0);
  }
 }
}






As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.