RMI Client Issue

Hello,
Here is my client side RMI program:
import java.rmi.*;
public class MyRemoteClient {
public static void main(String args[]) {
     MyRemoteClient mm = new MyRemoteClient();
     mm.go();
public void go(){
     try{
          MyRemote service2 = (MyRemote) Naming.lookup("rmi://xxx.xxx.xx.xx/Hello");
          String s = service2.sayHello();
          System.out.println(s);
     } catch(Exception ex){ex.printStackTrace();}
Having started RMI Registry and Service Implementor code on the server, if I try to run the above code on the client it fire the following error:
java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
     java.net.ConnectException: Connection refused: connect
     at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
     at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
     at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
     at sun.rmi.server.UnicastRef.invoke(Unknown Source)
     at MyRemoteImpl_Stub.sayHello(Unknown Source)
     at MyRemoteClient.go(MyRemoteClient.java:11)
     at MyRemoteClient.main(MyRemoteClient.java:6)
Caused by: java.net.ConnectException: Connection refused: connect
     at java.net.PlainSocketImpl.socketConnect(Native Method)
     at java.net.PlainSocketImpl.doConnect(Unknown Source)
     at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
     at java.net.PlainSocketImpl.connect(Unknown Source)
     at java.net.SocksSocketImpl.connect(Unknown Source)
     at java.net.Socket.connect(Unknown Source)
     at java.net.Socket.connect(Unknown Source)
     at java.net.Socket.<init>(Unknown Source)
     at java.net.Socket.<init>(Unknown Source)
     at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
     at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
     ... 7 more
I am wondering as to why is it trying to connect to a local host 127.0.1.1 instead of the IP Address specified at by"xxx.xx.xx.xx" in the program?
I have the stub class and the service interface classes on my client-side.
Thanks.

Crossposted and answered in the RMI forum.

Similar Messages

  • RMI Client on Linux issue.

    I am facing Java RMI problem on Suse Linux.
    RMI server running on solaris and RMI client running on Solaris ---> works fine
    RMI server running on solaris and RMI client running on Linux ---> gives error
    Pls note that RMI server running fine. When invoking remote method from RMI client on Suse Linux, I get following error.
    Java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: RemoteVtskImpl_Stub
    Any help/pointers will be useful.

    Even we tried setting the CLASSPATH to point to those jar files. But still the problem persist.
    At run time is there any way to see what all the _stub files are downloaded in the JVM at the client machine (linux machine in our case) from the server machine (solaris machine in our case).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • RMI | Firewall  issue revisited

    Hi all,
    I have searched through these forums for a suitable answer to my problem, but have not gotten any.
    My RMI client-server app was working perfectly well on a Windows 2000 Advanced Server (with its firewall restrictions), until my company decided to buy another firewall appliance. My RMI server used to run on the Advanced server machine with a static IP and I ran my server with the following command :
    java -Djava.security.policy=server.polocy -Djava.rmi.server.hostname=209.XXX.XXX.XXX Server
    (209.XXX.XXX.XXX being the static IP used by the advanced server)
    Now, with the addition of the firewall appliance and after having opened up 2 ports for RMI communication and forwarding them to the Host machine, my application had stopped functioning across the internet.
    The host machine has an internal IP address of say 129.128.***.***
    When an external client tries to establish contact with the my RMI server using 209.XXX.XXX.XXX (the external IP), I get a
    "Connection refused: Unable to connect with 129.128.***.***"
    This makes me believe that even though the client is able to initially establish connection with the RMI server, the RMI server sends back a reply to the client, asking it to find the server at the INTERNAL ip address.
    Is there a way to avoid this ? Where am I going wrong ? How can I resolve this issue ?

    The error is happening because the client is finding and connecting to the RMI registry OK, it is getting the Remote reference OK but when it tries to send a message to the Remote reference it is sending to your internal IP address and hence getting the unable to connect error.
    The IP address in the Remote reference returned by the RMI registry is the one that the server object is bound to. No amount of port forwarding will change that.
    You have two options in my experience:
    1. You can try to force your server to believe it is 209.x.x.x when you bind the Remote instance. You can do this on Linux, but I have no idea how to do it on W2K.
    2. The server.rmi.hostname works for fully qualified domain names, not IP addresses. If you only have one RMI server running, or if you use different ports for different RMI servers, you should be fine by setting the hostname value to your fully qualified domain name and then use NAT to forward to the Internal IP address. If you have more than one server running on the same port number, you'll need to register different FQDN's for each. Then all you need to do is update your internal DNS to point to the internal IP address and the external clients will use their existing DNS in the normal manner.

  • RMI security issue

    Hi, there!
    This is cross-post from "NetWeaver AS, Java" forum.
    I have a security issue when I try to run RMI client code in the web application on the Web AS 2004s. There is
    lookup statement in JSP or servlet code:
    Naming.lookup("//server/RemoteClass")
    which throws
    java.io.AccessControlException: access denied (java.io.FilePermission
    D:\usr\sap\AS1\JC00\j2ee\cluster\server0\apps\sap.com\MyEntApp\servlet_jsp\MyWebApp\work\com\mycompany\packagename\RemoteClassImpl_Stub.class read)
    I have investigated where "java.security.policy" parameter is setup, there has value "./java.policy". This file is
    regenerated each time when web AS is started, thus I created another policy file, granted file permission for
    above path and set it as -Djava.security.policy in server start parameter. It doesn't resolve problem, I have
    investigated this parameter doesn't correlate with real application run-time permissions. Has anybody ideas?
    Thanks
    P.S. This code works fine as a standalone application.

    File Name : policy.txt
    grant     {
         permission java.security.AllPermission;
    };Run ur program as follows:
    java -Djava.security.policy=policy.txt <Java Client >

  • Several RMI (easy) issues

    Hi,
    Developping a small RMI application, I face the following issues:
    I can run several RMI servers on a machine (launched with 1 or more userId (root, guest, foo)) but how can RMI clients be notified of how many RMI servers have been launched (and their port number). How to specify the server we want to log in ? Is it possible to have from a client the list of all RMI servers running on a machine ?
    I would like that clients use login/passwd to connect the RMI server. In fact, If the client authentifies itself with root/passroot it automatically runs on the root RMI server launched. How can I do that ?
    Thanks.
    If it is not clear enought I will explain my problems differently.

    Here are my replies:
    1) the issue is that the server can execute system commands (kill ,renice, performance command...). So, I don't want, if a server has been started as root, that every body accessing this server can run a kill on a process. So every user would have to launch its own server and then only access to services it can perform normally when logging on this machine. Moreover the RMI server has to retrieve a lot of infomation in less than 1sec (do some sys calls and internally retrive the state of all processes running on the server machine) so I think is better do launch several servers.
    Note: the client MUST have a direct access to the server machine. It is a pre-requiered.
    2) Thanks.
    3) So the client can send the login/passwd info tho the server, which look in the unix account on the system, register the client with the good server and that accept the connection.
    A lot of messages talking aboiut RMI security gives some idea on how implmenting a secured connection between client/server but I cannot find any pseudo-code or code sample.
    Do you have sme pointers ?
    Thanks

  • Serlet acting as RMI client

    hi all
    i have a servlet acting as a RMI client, the container of choice is Oracle Application Server or Tomcat
    how to set the security / persmision settings ?

    * Withdrawer.java
    * This is a non-thread-safe subclass ofAccountHolder that implements the run method
    * in such a way as to iterate a fixed number of times, making
    * a fixed withdrawal on its (shared) Account object.
    * @author Chad Salinas
    * @version 12/15/03
    * sources credited: Chad Salinas
    * Chad Salinas Open issues:
    Chad Salinas package cscie160.hw6;
    public class Withdrawer extends AccountHolder
    public static final float AMOUNT = 200;
    // Chad Salinas default constructor that won't be used
    public Withdrawer()
    // Chad Salinas the one-arg constructor requiring taking an Account object
    Chad Salinas public Withdrawer(Account oneAccount)
    Chad Salinas {
    Chad Salinas theAccount = oneAccount;     
    Chad Salinas }     
    public void run()
         for(int i = 0; i < 10; i++)
         Chad Salinas boolean finished = false;
         Chad Salinas while(!finished)
              Chad Salinas if(theAccount.getBalance() >= AMOUNT)
         Chad Salinas theAccount.withdraw(AMOUNT);
         Chad Salinas finished = true;
              else
              try
              Chad Salinas Thread.sleep(100);
              Chad Salinas catch(Exception e)
    Chad Salinas sample source
    Chad Salinas factory design pattern

  • RMI Clients behind firewall

    When the RMI client behind firewall tries to access the server the following error is thrown up:
    java.rmi.ConnectIOException: Exception creating connection to: 10.130.12.128; ne
    sted exception is:
    java.net.NoRouteToHostException: Operation timed out: no further informa
    tion
    java.net.NoRouteToHostException: Operation timed out: no further information
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
    ource)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
    ource)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at RMIFaxServer_Stub.getResult(Unknown Source)
    at FaxTest.main(FaxTest.java:51)

    your client is behind the firewall but the server you're trying to access has an address 10.x.x.x which says that it too is behind a firewall and not on the Internet, or is the server in a DMZ. It sounds more like a networking issue than a java problem at this point. If the server is on some side of a firewall, you may need a some sort of "permit established" config setting added to the firewall. Just a thought.

  • RMI client-side - how to encrypt,decrypt  in client-side

    I write javacard RMI style. My problem is...
    Source code below is work when it write in applet (card - side)
    but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. Did I misunderstand?
    if it make for use in applet only, how is possible to do like this " card use privatekey to sign message and send to reader , reader use card's publickey to verify that card sign this signature or not."
    or
    "card use reader's publickey to encrypt message and send to reader, then reader use privatekey to decrypt message (reader authencate itself) "
    because I can't do any of cipher , keybuilder in RMI-client side(reader)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    it will throw nullPointerException
    and if (change false to true)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
    throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    after that I swap this line with
    pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
    since it will do this first (i swap the line already) it also throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    also be the same result with swap
    kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
    to a first line
    it throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    Please help me
    RSAPrivateKey pri_key;
    RSAPublicKey pub_key;
    KeyPair kp;
    Cipher RSAcipher;
    RSAcipher = Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
    pub_key =(RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,KeyBuilder.LENGTH_RSA_512, false);
    kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
    kp.genKeyPair();
              pri_key = (RSAPrivateKey) kp.getPrivate();
              pub_key = (RSAPublicKey) kp.getPublic();
    //ENCRYPT
    RSAcipher.init(pri_key, Cipher.MODE_ENCRYPT);
    t_cipherLengthRSA = RSAcipher.doFinal(plaintxt,(short)0, (short)plaintxt.length, t_cipherText, (short)0);
    //DECRYPT
    RSAcipher.init(pub_key, Cipher.MODE_DECRYPT);
    RSAcipher.doFinal(ciphertxt,(short)0,(short) t_cipherLengthRSA, temp1, (short)0);

    I write javacard RMI style. My problem is...
    Source code below is work when it write in applet (card - side)
    but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw
    exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHMYou can not share code between card and client. On the card use the classes of javacardx.crypto and on the client side those of javax.crypto and java.security.
    It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. That is right.
    if it make for use in applet only, how is possible to
    do like this " card use privatekey to sign message
    and send to reader , reader use card's publickey to
    verify that card sign this signature or not." or
    "card use reader's publickey to encrypt message and
    send to reader, then reader use privatekey to decrypt
    message (reader authencate itself) "On each platform you have classes that provide the same cryptographic operations but the interface of these classes is different (because of the limitations of the java card platform).
    because I can't do any of cipher , keybuilder in
    RMI-client side(reader)Use the java.security.KeyFactory instead.
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    it will throw nullPointerException
    and if (change false to true)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
    throw exception 0x3 -
    javacard.security.CryptoException.NO_SUCH_ALGORITHMCryptographic support on java cards is optional. Not every card supports every algorithm. Try to use another algo.
    Jan

  • How do I make a RMI client running in Bea find a remote, non Bea, RMI server?

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

  • Running applet as RMI client from remote computer

    Hi,
    I am doing this project that requires that i run an applet (which is an RMI client) from a computer different than the one that has the RMI server running.
    Right now, i can run my server and applet on the same computer and it all works fine. But i don't know how to make the applet communicate with an RMI server that resides on another computer. Does this has anything to do with TOMCAT.
    I was wondering if this is possible.
    Thank you in advance.

    Do This
    RemoteInterfaceName server = (RemoteInterfaceName) Namin.lookup("rmi://yourserver/server/YourServerName");
    server.methodName(args);
    suppose you have your server in the dir path
    c:\prj\server
    then set your webserver's root dir to c:\prj\server how this is done will be in the web server's documentation
    Try It otherwise we'll see it again
    Bye !!!

  • Rmi client throws Connection Refused exception

    My Rmi client throws a Connection Refused exception when i try to run it on remote machine (in this case i run it on my virtualbox macine).
    The virtualbox machine network is in NAT mode (host machine ip should be 10.0.2.2).
    When rmi client starts get registry instance and print in standar output:
    RegistryImpl_Stub[UnicastRef2 [liveRef: [endpoint:[//10.0.2.2/:1099,util,RmiInstances$1@1275d39](remote),objId:[0:0:0, 0]]]]But when rmi client trys to use any of remote methods it throws Connection Refused, but it's to strange because the Connection Refused has 127.0.1.1 as ip.
    java.rmi.ConnectException: Connection refused to host: 127.0.1.1; ....In client RmiInstances code (this class contains all remote implementations) is:
    public class RmiInstances {
        private static RmiInstances instance;
        private IUserManage userManage;
        private IAnalysis analysis;
        private IPacientManage pacientManage;
        private IInsuranceManage insuranceManage;
        private Config config;
        private RmiInstances()
                throws RemoteException, NotBoundException, IOException {
            this.config = Config.getInstance();
            Registry registry = LocateRegistry.getRegistry(config.getServerUrl()+"/",
                    1099, new RMIClientSocketFactory() {
                @Override
                public Socket createSocket(String host, int port) throws IOException {
                    try {
                        URI uri = new URI(config.getServerUrl()+
                                ":"+config.getServerPort());
                        return new Socket(uri.getHost(), uri.getPort());
                    } catch (URISyntaxException ex) {
                        ex.printStackTrace();
                        return null;
            System.out.println(registry);
            userManage = (IUserManage)registry.lookup("RUserManage");
            analysis = (IAnalysis)registry.lookup("RAnalysis");
            pacientManage = (IPacientManage)registry.lookup("RPacientManage");
            insuranceManage = (IInsuranceManage)registry.lookup("RInsuranceManage");
    ...And server code is the next:
    public static void main(String[] args) {
         System.out.println("GNULab Server " + VERSION + " starting...");
         System.setProperty("java.rmi.server.codebase",
              "file:/home/zarovich/workspace/labserver/bin");
         try {
             // Loading config
             System.out.println("Loading config...");
             Config config = Config.getInstance();
             // inicializando rmi registry
             Registry registry;
             if (config.isSsl()) {
              registry = LocateRegistry.createRegistry(
                   config.getServerPort(), new RmiSSLClient(),
                   new RmiSSLServer());
             } else
              registry = LocateRegistry
                   .createRegistry(config.getServerPort());
             // instanciando implementaciones
             RAnalysis rAnalysis = new RAnalysis();
             RInsuranceManage rInsuranceManage = new RInsuranceManage();
             RPacientManage rPacientManage = new RPacientManage();
             RUserManage rUserManage = new RUserManage();
             // registrando interfaz rmi
             registry.rebind("RAnalysis", (IAnalysis) UnicastRemoteObject.exportObject(rAnalysis, 0));
             registry.rebind("RInsuranceManage", (IInsuranceManage) UnicastRemoteObject.exportObject(rInsuranceManage, 0));
             registry.rebind("RPacientManage", (IPacientManage) UnicastRemoteObject.exportObject(rPacientManage, 0));
             registry.rebind("RUserManage", (IUserManage) UnicastRemoteObject.exportObject(rUserManage, 0));
             System.out.println("GNULab Server " + VERSION + " listening ...");
             System.out.println("Registry instance: " + registry.toString());
         } catch (RemoteException e) {
             e.printStackTrace();
            * catch (MalformedURLException e) { e.printStackTrace(); }
            */catch (IOException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         } catch (JDOMException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
    ...

    I'm solved my problem.
    I just need run my server with -Djava.rmi.serverhost=10.0.2.2 and my client running on my virtualbox machine works!

  • Rmi client and jApplet

    Hi,
    I am trying to use a jApplet as an rmi client. However, either creating a new instance of the class i created, that extends jApplet, in the rmi client class i created or creating a new instance of the rmi client in the class that extends jApplet results in error.
    What is the correct way to go about doing this? I developed the jApplet thinking it could be simply used with the rmi client.
    instanciating the rmi client in the jApplet class gives :
    java.lang.OutOfMemory Error
    instanciating the jApplet class in the rmi client class gives other errors I am unable to reproduce at the moment :(
    thanks for any help
    -Paulo Murphy de Freitas

    Hi,
    I am trying to use a jApplet as an rmi client. However, either creating a new instance of the class i created, that extends jApplet, in the rmi client class i created or creating a new instance of the rmi client in the class that extends jApplet results in error.
    What is the correct way to go about doing this? I developed the jApplet thinking it could be simply used with the rmi client.
    instanciating the rmi client in the jApplet class gives :
    java.lang.OutOfMemory Error
    instanciating the jApplet class in the rmi client class gives other errors I am unable to reproduce at the moment :(
    thanks for any help
    -Paulo Murphy de Freitas

  • 10.1.3.1 and standalone RMI client

    I'm migrating our J2EE applications from 10.1.2.0.1 to 10.1.3.1.0. I also have a custom JAAS login module that is used by our applications. I have the login module working successfully and web applications that can call EJBs.
    But I am unable to get a simple RMI client to call the EJBs. I can see from the server logs that the JAAS module executes successfully, but then I get a ClassNotFoundException (seems to be from the server) when the client tries to access the JNDI tree (see stack below on the client; I can't find any log relating to this event on the server).
    I had real problems with RMI access in 10.1.2, seems that Oracle AS isn't really thought through with respect to simple RMI client access. In the system-jazn-data.xml file I have granted my custom principals the RMI login permission. I tried to raise a TAR but it's been rejected because 10.1.3.1.0 is a "preview" version. (Don't you guys want to know about bugs before a release goes into production?)
    Any ideas?
    27-Sep-2006 14:50:46 oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_R
    EMOTE_SERVER
    WARNING: Exception returned by remote server: {0}
    java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObjectInfo
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at com.evermind.io.ClassLoaderObjectInputStream.resolveClass(ClassLoader
    ObjectInputStream.java:33)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:153
    8)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
    693)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
    at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1628)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1293)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
    at java.util.HashMap.readObject(HashMap.java:1013)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
    713)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
    at com.evermind.server.rmi.RMIClientConnection.handleListContextResponse
    (RMIClientConnection.java:768)
    at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse
    (RMIClientConnection.java:242)
    at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClien
    tConnection.java:205)
    at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RM
    IClientConnection.java:187)
    at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.jav
    a:152)
    at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnec
    tion.java:127)
    at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
    utor.java:814)
    at java.lang.Thread.run(Thread.java:595)
    javax.naming.NamingException: com/evermind/server/ejb/EJBHomeObjectInfo [Root ex
    ception is java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObje
    ctInfo]
    at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:1
    00)
    at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMICl
    ientConnection.java:334)
    at com.evermind.server.rmi.RMIClientConnection.list(RMIClientConnection.
    java:293)
    at com.evermind.server.rmi.RMIClient.list(RMIClient.java:392)
    at com.evermind.server.rmi.RMIClientContext.getListValues(RMIClientConte
    xt.java:95)
    at com.evermind.server.rmi.RMIContext.listBindings(RMIContext.java:444)
    at com.evermind.naming.FilterContext.listBindings(FilterContext.java:91)
    at com.evermind.server.ApplicationClientContext.listBindings(Application
    ClientContext.java:127)
    at javax.naming.InitialContext.listBindings(InitialContext.java:406)
    at com.axiomsystems.common.tools.test.APITester.getEJBs(APITester.java:2
    06)
    at com.axiomsystems.common.tools.test.APITester.<init>(APITester.java:17
    3)
    at com.axiomsystems.common.tools.test.APITester.main(APITester.java:68)
    Caused by: java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObje
    ctInfo
    at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_
    SERVER(RMICall.java:109)
    at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:9
    1)
    ... 11 more

    Hi Debu,
    I have found the problem and a workaround in my code.
    I obtained the initial context ctx with the following properties set:
    Context.INITIAL_CONTEXT_FACTORY (= oracle.j2ee.naming.ApplicationClientInitialContextFactory)
    Context.PROVIDER_URL (= opmn:ormi://myHost:myPort:myOC4J/myApp)
    Context.SECURITY_PRINCIPAL (= my username)
    Context.SECURITY_CREDENTIAL (= my password)
    then I did
    NamingEnumeration en = ctx.listBindings("ejb/myJndiName")
    which resulted in the exception.
    Changing this to
    Context ctx2 = (Context)ctx.lookup("ejb/myJndiName");
    NamingEnumeration en = ctx2.listBindings("");
    has resolved the problem. I'm not sure why this behaves differently, I suppose it may have something to do with the fact that ctx2 is not an InitialContext object. It is an adequate workaround for my application.
    Once I have an EJB reference, invoking methods over RMI works as expected.
    Thanks,
    Keith

  • Quartz schedular problem accessing thru RMI client

    Hi,
    I am trying to access Quartz scheduler through RMI client/server.
    Quartz scheduler RMI is starting up properly.
    When I run the RMI client I am receiving the following error.
    =================================================================
    org.quartz.SchedulerException: Error communicating with remote scheduler. [See nested exception: java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
         java.io.InvalidClassException: oracle.classloader.util.AnnotatedNoClassDefFoundError; local class incompatible: stream classdesc serialVersionUID = -4364152148004017014, local class serialVersionUID = -687990861161016914]
         at org.quartz.impl.RemoteScheduler.invalidateHandleCreateException(RemoteScheduler.java:135)
         at org.quartz.impl.RemoteScheduler.scheduleJob(RemoteScheduler.java:335)
         at net.nighttale.scheduling.rmi.QuartzClient.main(QuartzClient.java:17)
    * Nested Exception (Underlying Cause) ---------------
    java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
         java.io.InvalidClassException: oracle.classloader.util.AnnotatedNoClassDefFoundError; local class incompatible: stream classdesc serialVersionUID = -4364152148004017014, local class serialVersionUID = -687990861161016914
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:217)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
         at org.quartz.core.QuartzScheduler_Stub.scheduleJob(Unknown Source)
         at org.quartz.impl.RemoteScheduler.scheduleJob(RemoteScheduler.java:332)
         at net.nighttale.scheduling.rmi.QuartzClient.main(QuartzClient.java:17)
    Caused by: java.io.InvalidClassException: oracle.classloader.util.AnnotatedNoClassDefFoundError; local class incompatible: stream classdesc serialVersionUID = -4364152148004017014, local class serialVersionUID = -687990861161016914
         at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
         at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836
    =============================================================
    My client and server quartz properties are as follows.
    Client properties
    org.quartz.scheduler.instanceName = DefaultQuartzScheduler
    org.quartz.scheduler.rmi.proxy = true
    org.quartz.scheduler.rmi.registryHost = 127.0.0.1
    org.quartz.scheduler.rmi.registryPort = 1098
    Server properties
    # Default Properties file for use by StdSchedulerFactory
    # to create a Quartz Scheduler Instance, if a different
    # properties file is not explicitly specified.
    org.quartz.scheduler.instanceName = DefaultQuartzScheduler
    #org.quartz.scheduler.instanceName = Sched1
    org.quartz.scheduler.rmi.export = true
    #org.quartz.scheduler.rmi.proxy = false
    org.quartz.scheduler.rmi.registryHost = 127.0.0.1
    org.quartz.scheduler.rmi.registryPort = 1098
    org.quartz.scheduler.rmi.createRegistry = true
    org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
    org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount = 10
    org.quartz.threadPool.threadPriority = 5
    org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
    org.quartz.jobStore.misfireThreshold = 5000
    #org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
    org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
    org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
    org.quartz.jobStore.useProperties = false
    org.quartz.jobStore.dataSource = demoDS
    org.quartz.jobStore.tablePrefix = QRTZ_
    org.quartz.jobStore.isClustered = false
    #============================================================================
    # Configure Datasources
    #============================================================================
    org.quartz.dataSource.demoDS.driver = oracle.jdbc.driver.OracleDriver
    org.quartz.dataSource.demoDS.URL = jdbc:oracle:thin:@demou.abc.com:1521:orcl
    org.quartz.dataSource.demoDS.user = demo
    org.quartz.dataSource.demoDS.password = oracle
    org.quartz.dataSource.demoDS.maxConnections = 5
    org.quartz.dataSource.demoDS.validationQuery=select 0 from dual
    #org.quartz.dataSource.demoDS.validationQuery=select lock_name from qrtz_locks where lock_name = 'TRIGGER_ACCESS'
    #============================================================================
    # Configure Plugins
    #============================================================================
    # Uncomment the following to get logging of job execution events...
    #org.quartz.plugin.jobHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin
    # Uncomment the following to get logging of trigger firing events...
    #org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin
    #============================================================================
    # Configure Listeners
    #============================================================================
    #org.quartz.jobListener.dummy.class = org.quartz.examples.DumbJobListener
    Appreciate your quick response.
    Regards,
    Nishi

    What I did today is that we connected the client PC directly with the server through a switch. So keep in mind please, that for the following informations there is no firewall involved whatsoever.
    I've just checked the communication log on the server with the microsoft network monitor. the communication proceedes in the following manner:
    1) the client calls the server from a random source port(src) onto the specified destination port(dst) 1088.
    2) the server application replies from (src)1088 to (dst)1052.
    3) now comes two client calls again from (src)1052 to (dst)1088.
    4) and then the server sends something two times from 1088 to 1052
    and that's it! end of communication. of course then it comes the above mentioned error.
    What the most amazes me is that although I explicitly specify for the client as well, that the rmi registry should be available on the remote port 1088, still it uses a random port (in this case 1052). Could this be alright? After all, what port the client uses to reach for the remote registry could be random I guess...
    What I see on the client side with the trace prints is that during the client initialization first a connection will be made on a local machine with port # -1 and just after that calls the remote server. But in that case I don't get it why it prints the 1088 if under the hood is a 1052 or other random port...
    Meanwhile, on the server side I get a trace message from the custom security manager that an accept on the random port (1052) has been successful. but after that no more printouts.
    Oh, and one more thing... did I mentioned that I implemented a pure socket client/server thingy and it works just fine? with or without firewall.

  • RMI Client on Web browsers

    Hello All,
    I have a basic question about RMI. Usually we run RMI client like:
    java -dcodebase=http://mysite.com -djava.securit.policy=mypolicy.policy client
    Is it possible to run RMI client on web browsers, say, through Java servlet, Tomcat is installed?
    If possible, how to configure Tomcat and the client, may be servlet? I don't think RMI server need change.
    Thanks
    Chen

    Tomcat is for servers. Why would that change the
    client?Thanks for the reply. I want to put RMI client in Tomcat, the RMI client connect to RMI server (not in the Web server, some other place). The questionis :
    Every RMI client need start like this:
    java -Djava.rmi.security=my.policy myclient
    But in Tomcat, we only have classes. The servlet call the class(es) to finish the request and return response. In fact my question is how to provide security policy to these classes?
    Merry Xmas!
    CL

Maybe you are looking for