About Rmi

i m doing a project on "Loosely coupled architecture".It means 2 applications working independent of each other.
But they can notify changes to other applications if required using xml files.
Suppose 1st appl can send name,rno,class,div
2nd appl wants only name and rno
we have a broker in between them
broker has info abt all the appl,and ioaddress of the machine where the appl is running.
now 1st appl sends the xml file to broker .
Broker will make another xml file according to the fields required by 2nd appl
and transfer that file to that 2nd appl.
previously i hav written the code to transfer the files using socket programming.
but we did not think abt broker at that time.we just transfered file frm 1 appl to another.
now my prob is where to place the broker.as it shd not depend on any appl to keep running.even if 1 appl is down it shd b running so that other appl can use broker.
and if i use rmi is a proper way to do that?
can i transfer the file using rmi so that i wnt use socket programming then.

A book can. The O'Reilly book is very good. The Java Tutorial is a good place to start. The Horstman and Cornell Core Java series has a good section.
I can write a book or do private tutoring for $150/hr., but I get to keep the royalties. Overall, you'll save more money and learn more by bothering to read.

Similar Messages

  • I hava a question about RMI,please help me!

    Ladys and Gentleman,I hava a question about RMI.I wirte four little programs in java that is about RMI on my PC.
    import java.rmi.*;
    public interface AddServerIntf extends Remote{
    double add(double d1,double d2) throws RemoteException;
    import java.rmi.*;
    import java.rmi.server.*;
    public class AddServerImpl extends UnicastRemoteObject implements AddServerIntf{
    public AddServerImpl() throws RemoteException{
    public double add(double d1,double d2)throws RemoteException{
    return d1+d2;
    import java.net.*;
    import java.rmi.*;
    public class AddServer{
    public static void main(String args[]){
    try{
    AddServerImpl addServerImpl=new AddServerImpl();
    Naming.rebind("AddServer",addServerImpl);
    }catch(Exception e){
    e.printStackTrace();
    import java.rmi.*;
    public class AddClient
         public static void main(String args[]){
         try{
         String addServerURL="rmi://"+args[0]+"/AddServer";
         AddServerIntf addServerIntf=(AddServerIntf) Naming.lookup(addServerURL);
         System.out.println("The first number is: "+args[1]);
         double d1=Double.valueOf(args[1]).doubleValue();
         System.out.println("The second number is: "+args[2]);
         double d2=Double.valueOf(args[2]).doubleValue();
         System.out.print("The sum is: "+addServerIntf.add(d1,d2));
         }catch(Exception e){
         System.out.println("Exception: "+e);
    And I compiled these files,so I got 4 class files(AddServer.class,AddServerIntf.class,AddServerImpl.class,AddServerClient.class).Then I use "rmic AddServerImpl" got another two files(AddServerImpl_Skel.class and AddServerImpl_Stub.class).Then I input command:rmiregistry,in another window,I input command:java AddServer,I got some exceptions,I was confused by these exceptions.The exception is:
    D:\MyJava\rmi_3>java AddServer
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: AddServerImpl_Stub
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: AddServerImpl_Stub
    java.lang.ClassNotFoundException: AddServerImpl_Stub
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Unknown Source)
    at AddServer.main(AddServer.java:8)
    But some times this exception will not appeared.Who can give me answer or suggestion,thanks a lot.
    By the way,when I run shutdown.bat in tomcat_root\bin,I can get some exceptions:
    C:\Tomcat\bin>shutdown
    Using CATALINA_BASE: ..
    Using CATALINA_HOME: ..
    Using CATALINA_TMPDIR: ..\temp
    Using JAVA_HOME: C:\JDK
    Catalina.stop: java.net.ConnectException: Connection refused: connect
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
    at java.net.Socket.<init>(Socket.java:268)
    at java.net.Socket.<init>(Socket.java:95)
    at org.apache.catalina.startup.Catalina.stop(Catalina.java:579)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
    I use Windows server 2000+JDK 1.3.1_04+tomcat 4.1.7

    Maybe I am off base here but it seems to me the problem is the way in which you bind your server. The server must be bound to the same address and you are looking up from, i.e. "rmi://" host "/AddServer"
    so
    Naming.rebind("AddServer",addServerImpl);should be
    Naming.rebind("rmi://127.0.0.1/AddServer", addServerImpl);to match
    String addServerURL="rmi://"+args[0]+"/AddServer";
    AddServerIntf addServerIntf=(AddServerIntf)
    Naming.lookup(addServerURL);Hopefully this will solve your problem, if not it is a problem with your classpath. An easy way to make sure it can see your files is to set the java.rmi.server.codebase to point to where your classes are, e.g.
    java -Djava.rmi.server.codebase=file:"c:\\cygwin\\home\\tweak\\keck_folder\\cmsi401\\RMIGalaxySleuth\\classes\\" AddServer
    I had to set the codebas for my rmi stuff to work no matter how much I messed with the classpath.
    Hope this helps,
    Will

  • X-post: Puzzled about RMI

    Folks, yes I am cross posting this so try to keep the flames down :) I've also placed it on the RMI forum but no one there seems to want to help and I know everyone in the "Advanced" forum are very helpful (do you like the flattery???).
    Anyway, I'm just playing with RMI now and have followed the tutorial but I am a little puzzled about some behaviour I'm observing. This may be that I am missing a piece of information about RMI or how it works so if anyone can fill in the blanks then I would be most appreciative!!!
    So I've got the following Remote interface definition:import java.rmi.*;
    public interface RMIInterface extends Remote
        public int getValue () throws RemoteException;
        public void setValue (int val) throws RemoteException;
    }And I have some code that implements that interface. This code also contains a main method that performs some stuff with the RMI object. It is given below:import java.rmi.*;
    import java.io.*;
    public class RMIObject implements Remote, RMIInterface, Serializable
        private int value = 0;
        public int getValue ()
                             throws RemoteException
         return this.value;
        public void setValue (int    val)
                              throws RemoteException
         this.value = val;
        static public void main (String argv[])
         try
                 // Create the object.
             RMIObject o = new RMIObject ();
                 // Bind it in.
             Naming.rebind ("//localhost/RMIObject", o);
                 // Now get a reference to the object from the name server.
             o = (RMIObject) Naming.lookup ("//localhost/RMIObject");
                 // Set the value to 100.
                 o.setValue (100);
                 // Print out the value.
             System.out.println (o.getValue ());
                 // Get ANOTHER reference to the object.
             o = (RMIObject) Naming.lookup ("//localhost/RMIObject");          
                 // See what the value is.
             System.out.println (o.getValue ());
         } catch (Exception e) {
             e.printStackTrace ();
    }As you can see, I bind the object, then get a new reference to the object, set a value then get the reference again and see what the value is.
    The output I get from this code is:
    100
    0
    Which indicates that setValue is working when the reference is local but it's not updating the remote object. Now the question is, is this the way that RMI is supposed to work? i.e. should you NOT use RMI objects for holding state? If so what's the point because effectively the object would be isolated...can anyone shed any light on this?
    BTW, I am NOT a student and this is NOT related to any exam/coursework question!!!

    Easy folks...my reference to my potential student status was supposed to be "tongue-in-cheek", tis been a LONG time since I could get up when I want and pretend that I was really overworked and complain that I had too many assignments...
    Now of course I am overworked and have too many assignments...least I get paid now...
    Thanks for the help on this, I like to understand the mechanisms behind things, RMI from the outside has an appearance of "magic" that annoys me, I wasn't able to find out any description of how it actually works behind the scenes. I had to infer that it acts as a "broker", I presume that the RemoteObject object stores some information about where the JVM that actually holds the object is and then the Client uses this information (again behind the scenes) to get a connection.
    This tends to worry me a bit though, the implication is that each object that is exported also contains a ServerSocket on a particular port that listens for incoming requests. Now I would presume that when it gets the request it then creates a new thread to handle it to prevent IO blocking. Now in a highly utilized system this means a lot of threads and a lot of port access, which is o.k. but that's a big use of resources. Also, if I have 2 objects listening on the same port, how does the JVM distinguish between the 2 objects when the incoming connection is received. The OS will wake up the JVM and inform it of a new connection (at least that's how Unix does it), but does the JVM have some "magic" that allows it to send it to the correct ServerSocket? I suppose that you also need to take into account Thread concurrency issues as well since you are (by definition) creating objects that will be multi-threaded...
    Can anyone enlighten me on some of the above? Are there any books around that describe how RMI actually works...

  • Puzzled about RMI

    Folks,
    I'm just playing with RMI now and have followed the tutorial but I am a little puzzled about some behaviour I'm observing. This may be that I am missing a piece of information about RMI or how it works so if anyone can fill in the blanks then I would be most appreciative!!!
    So I've got the following Remote interface definition:
    import java.rmi.*;
    public interface RMIInterface extends Remote
        public int getValue () throws RemoteException;
        public void setValue (int val) throws RemoteException;
    }And I have some code that implements that interface. This code also contains a main method that performs some stuff with the RMI object. It is given below:
    import java.rmi.*;
    import java.io.*;
    public class RMIObject implements Remote, RMIInterface, Serializable
        private int value = 0;
        public int getValue ()
                             throws RemoteException
         return this.value;
        public void setValue (int    val)
                              throws RemoteException
         this.value = val;
        static public void main (String argv[])
         try
             RMIObject o = new RMIObject ();
             Naming.rebind ("//localhost/RMIObject", o);
             o = (RMIObject) Naming.lookup ("//localhost/RMIObject");
             o.setValue (100);
             System.out.println (o.getValue ());
             o = (RMIObject) Naming.lookup ("//localhost/RMIObject");
             System.out.println (o.getValue ());
         } catch (Exception e) {
             e.printStackTrace ();
    }As you can see, I bind the object, then get a new reference to the object, set a value then get the reference again and see what the value is.
    The output I get from this code is:
    100
    0
    Which indicates that setValue is working when the reference is local but it's not updating the remote object. Now the question is, is this the way that RMI is supposed to work? i.e. should you NOT use RMI objects for holding state? If so what's the point because effectively the object would be isolated...can anyone shed any light on this?
    BTW, I am NOT a student and this is NOT related to any exam/coursework question!!!

    Hi!
    Naming.lookup(..) actually returns a local reference to the server's stub object (which is locally present in the RMI client's machine). This stub takes care of the remote method invocations. Actually I don't understand how could you do the typecasting to the RMIObject but this is not really important right now!
    Let's see what happened in your example:
    First you registered your RMIObject in the registry.
    Then you retrieved a remote reference to it (a local stub, which implements the remote interface of the server object) and you set some variables of it.
    Then you retrieved again that stub (the java system probably instantiated an other stub object) and its variables were initialized also.
    This is not the way as the RMI should be used!
    The Naming.lookup(..) method always returns a Remote interface (if it can, or throws a RemoteException). This return value must be typecasted to the server object's Remote interface (in your example it's RMIInterface).
    Then you can use this object's (interface's) methods as you want to. (actually you use the stub object's methods which converts your calls to remote calls...)
    I hope it's clear now,
    Sany

  • Some basic questions about rmi registry  context  "bind" and "lookup"

    We have more processing to do than can be accomplished with a single computer. To solve the problem I've implemented a distributed computing solution using RMI. (The first time I saw RMI was about 2 weeks ago, so please bear with me!)
    The implementation is a proof of concept not a fully fleshed out system. I have one "Workunit Distributor" computer and any number of "Data Processor" computers all on the same lan segment. "Workunit Distributor" and "Data Processor" computers are both RMI client and server to each other. The "Data Processor" computers are given the ip address and name of the "Data Distributor" on the commandline when they start. They communicate their willingness to receive and process a workunit to the ""Workunit Distributor" via a RMI call. Work units are sent to available "DataProcessors" and results are eventually returned to the "WorkunitDistributor" (minutes or hours later). The model program works quite well, and appears to be capable of doing the processing we need to get done.
    But now that it seems viable, I've been asked to make it a little more scalable, flexible and self configuring. In particular, instead of one "Workunit Distributor", any number of "Workunit Distributors" should be allowed to show up or disappear from the lan at any time and the system should continue to function. I've worked out a good scheme for how this can be done, but I have a couple of questions about the RMI registry (registries?). I'm trying to keep from implementing some functionality that may already be available as a library or subsystem.
    With my current model design, each computer binds to its own registry with a unique name. For instance:
    CRDataProcessorImpl crdpi = new CRDataProcessorImpl(svr);
    Context crDataProcessingContext = new InitialContext();
    crDataProcessingContext.bind("rmi:"+hostName, crdpi);
    Currently the "Data Processors" get the info they need for a Context lookup() of the one and only "Workunit Distributor" from the commandline. And the info the "Workunit Distributor" needs to do a Context lookup() of a "DataProcessor" is passed to it from each "DataProcessor" via a RMI call.
    But in the newer (yet to be implemented) scheme where any and all "Workunit Distributors" show up and disappear whenever they feel like, the naming bootstrapping scheme described above won't work.
    I can imagine a few ways of solving this problem. For instance, having "Workunit Distributors" multicast their contact information on the lan and have a worker thread on each "Data Processor" keep track of the naming information that was multicast. Another alternative (more organized, but more complex) might be to have a dedicated host with a "well known" address and port that "Workunit Distributors" and "Data Processors" could all go to, to register or look up at an application level. Sort of a "domain name service" for RMI. But both these schemes look like a lot of work to implement , debug and maintain.
    The BEST thing would be if there was one plain vanilla RMI registry that was usable by all RMI enabled computers instead of having each computer have its own local name registry. In volume 2 of the Core Java2 book it says that every registry must be local. I'm only hoping there's been progress since the book was published and now a central rmi registry is available.
    If you have any ideas about this I'd like to hear what you know.
    Thanks in advance for any advice.
    Lenny Wintfeld
    ps - I don't believe web services, as full featured as it is, is a useful alternative. I'm moving 100's (in the future possibly 1000's) of megabytes back an forth for processing.

    The local bind/rebind/unbind restriction is still there and it will always be there.
    I would look at
    (a) RMI/IIOP, where you use COSNaming as a registry, which doesn't have that registriction, and which also has location-independent object identifiers
    (b) Jini.

  • General Question about RMI

    Okay here is what I am trying to do:
    I work for a small consulting firm and part of what we do is we process a tremendous amount of data using a suite of tools written in C/C++. We have a Java application which is really just a script (Written in standard Java) that makes a whole bunch of system calls, namely the commands in the suite of tools written in C. What we want to do is, is over our network, farm some of these system calls (or maybe even just CPU cycles) to multiple machines with the same suite of tools on them. Is this possible/plausible using RMI? Is there something that would be better for it? We have plenty of bandwidth across our network and most of the data is stored on a 15+ TB SAN.
    Also any books on the subject that you could recommend would be very helpful as well :)
    Any help would be very much appreciated.

    ofcourse passing over socket is always an option. Sure in that case you will have to serialize the object yourself or make a mini-protocol of some kind.
    In our project we also use XML to pass object between C++ and Java world, instead of using CORBA.

  • Need opinions about RMI tunneling over HTTP please

    My Tomcat Server wants to talk with a JBoss Server.
    This communication has to go through a firewall, and I want to use
    the HTTP tunneling function.
    Can anybody please tell me if the HTTP tunnel has any disadvantages?
    How big is the performanceloss?
    Can anybody please give me a link how to do this? What configurations
    do I have to do where?
    Thanks!

    you do not have to do anything special for this, if you do not want to.
    All yours questions are answered here :
    http://java.sun.com/j2se/1.3/docs/guide/rmi/spec/rmi-arch6.html

  • Help me about RMI

    i created all classes, inferfaces in client and server. But i compile these by use RMIC
    rmic myclass
    i get result a file :
    myclass_stub.class
    i don't see file :
    myclass_skel.class
    i hope the expert help me...
    Thanks!!

    but if you want it anyway for some reason (as said,
    modern JVMs don't need it and will silently ignore it
    if present), add the -v1.1 option to rmic.This is not quite right.
    (a) If you specify -v1.1, JVMs will not ignore it silently and in fact they will need it.
    (b) If you specify -vcompat you will get a skeleton which, in a server >= JDK 1.2, will be loaded if present but won't be treated as required, unless the client is using JDK 1.1.
    EJP

  • About java.rmi.server.UnicastRemoteObject

    Hi friends
    Just now I started studying about RMI. In Implementing Remote Interface class we extends java.rmi.server.UnicastRemoteObject class we also have java.server.RemoteObject also why we specifically extends UnicastRemoteObject what is the significance of it
    can anyone help me plz
    thank u

    UnicastRemoteObject is a base class that can make your object a remote object. (If you create an object that DOESN'T extend UnicastRemoteObject, then it's methods cannot be accessed remotely.

  • Several JVM s with RMI?

    Hi,
    As you can guess, my Java program needs more and more memory as users connections grow.
    We are of course trying to optimize the way it’s running but looks like we will anyway soon need to increase ressources of our JVM.
    We first thought to increase memory heap but there is a limit, on any 32 bit system 4Go seems the theoretical maximum ram size. And we have to keep a 32 bit JVM, can’t change this.
    Here is our next idea: we would like to run our program on several JVMs.
    Two options came then, and so here are my question: (maybe irrelevant for experts but I am a beginner regarding distributed architecture, so feel free to give me some reference to learn about it…)
    -First option: several 32 bit JVMs running together on one 64bits machine
    Is it possible to run several 32 bit JVM (jre 1.5) on a windows (or linux) 64 bits machine? So that we could ‘share’ the system (big) ram between each of them.
    Is there, in this case, a limit for the memory heap per JVM?
    What would be in this case the best way to communicate between jvms (I m thinking about RMI, but is it the only way to?)
    -Second option: run several 32bits JVM on several 32 bits machine.
    Questions are the same here:
    is it possible? I guess so, and would it be worse or better from a performance/learning time point of view, compare to option 1?
    Is RMI the best way here to make the several jvm communicate?
    Hope this is clear, english is not my first language so feel free to ask me any precision…
    Thank you very much for any help or reference.
    Jipe

    Multiple JVMs dont have any inherent special behavior on the same maching. However, you must consider the shared resources of that machine such as ports and files that may be contended for.
    The only advantage of multiple JVMs of single JVMs is an OS one. The JVMs are separate processes and as such if one crashes it will not bring the other down.
    If you want to transfer user sessions from one JVM to another, no matter if on the same computer or not, you will need an architecture to support this. That is where application servers come in. Some of them will allow you to do this. So if you design your product to run in an application server, you have a lot of room to expand. That is really the benefit of designing for an application server.
    The details of a shared session are likely very complicated. You will have to ask the application server folks about that. Maybe go over to the JBoss forums.

  • Rmi over ssl in jdk1.5.0

    hi,
    i am trying to connect a remote machine with rmi over ssl. but i got the following exceptions;
    java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
    Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
    Caused by: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/PKCS1Padding
    Caused by: java.lang.IllegalArgumentException: can't support mode ECB
    i am using jdk1.5.0. i have tried many samples but i have not run them successfully however they were running successfully in j2sdk1.4.2.
    also i downloaded the bouncycastle provider but it did not work.
    is there anybody who knows about a running sample about rmi and ssl in jdk1.5.0? please send me....
    email: [email protected]

    Hi!
    I know it's not the exactly right topic, but I've nearly the same problem with a https connection for a webService. I'm not using turkish locale, I'm using BouncyCastle and the "Unlimited Strength" policy files. I've no problems if i start my application with eclipse, starting it with jdk1.5.0_03\jre\bin\java or jre1.5.0_03\bin\java form commandline i get the same stacktrace:
    javax.net.ssl.SSLKeyException: RSA premaster secret error
    Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
    Caused by: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/PKCS1Padding
    Caused by: java.lang.IllegalArgumentException: can't support mode ECB
    if i try to get the cipher with
    Cipher c = Cipher.getInstance("RSA/ECB/PKCS1Padding");
    I'll get the same stacktrace, with
    Cipher c = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
    i works fine, but I've no idea how to run this code out of axis...
    Thanks & Regards
    Helmut

  • Basic RMI program works in windows but not Linux

    Hello,
    I'm trying to learn RMI for a program at work.
    I have the book "Core Java 2 - Volume 2 - Advanced Features". Chapter 5 of this book is about RMI.
    The most basic example program they use works fine in Windows. However, when I try to run this same program under linux it doesn't work.
    For now, I'm not even trying to run a client (in linux)...just the server.
    Here is the server code.
    public class ProductServer
    public static void main(String args[])
    try
    System.out.println
    ("Constructing server implementations...");
    ProductImpl p1
    = new ProductImpl("Blackwell Toaster");
    ProductImpl p2
    = new ProductImpl("ZapXpress Microwave Oven");
    System.out.println
    ("Binding server implementations to registry...");
    Naming.rebind("rmi://172.20.101.1/toaster", p1);
    Naming.rebind("rmi://172.20.101.1/microwave", p2);
    System.out.println
    ("Waiting for invocations from clients...");
    catch(Exception e)
    e.printStackTrace();
    What is very interesting is that this call works
    Naming.rebind("rmi://172.20.101.1/toaster", p1);
    But the very next line
    Naming.rebind("rmi://172.20.101.1/microwave", p2);
    Throws this error ::
    java.rmi.UnmarshalException: Error unmarshaling return header: java.io.EOFException
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:221)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:366)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(RegistryImpl_Stub.java:133)
    at java.rmi.Naming.rebind(Naming.java:172)
    at ProductServer.main(ProductServer.java:35)
    I would very much appreciate the help. Thank You.

    We solved the problem
    Apparently, on the linux machine we had both gcc and the jdk installed
    the regualar compile command hit the jdk
    the rmic command used the gcc version of rmic
    the rmiregistry used the gcc version of rmiregistry
    the regular run command hit the jdk
    using the rmic and rmiregistry in the jdk made everything work fine
    I knew it had to be a stupid answer.

  • How to include spaces in rmi codebase value url?

    I am writing an RMI application to run on a LAN, and for my codebase value I am using an URL with the format file:///d:\dir1\dir2\.xx.jar, where the path points to a directory on the server's hard drive. I need to accommodate the situation where dir1 or dir2 contains a space. When I simply use the space (e.g. d:\program files\dir2\xx.jar), I get a java.net.MalformedURLException. When I substitute %20 where the space is, (e.g. d:\program%20files\dir2\xx.jar), the URL is accepted but I get a java.lang.ClassNotFoundException. I know the java.lang.ClassNotFoundException is not due to a path problem (I tested with an identical directory structure, except that I used a path whose directories contained no spaces -- and everything worked). So I infer that the reason for the java.lang.ClassNotFoundException is that no directory with the name "program%20files" exists on the hard drive.
    Any advice would be most appreciated.

    This is not a bug that Java have to solve, it is the
    way URL's should be formed.Actually this is a very bad bug in Java. URL's are just absolute URI's (according to the RFC's, but in Java, URL has little to do with URI), which donot_ allow spaces: spaces must be encoded. When the original URL class was written the RFC's were ignored, and spaces were allowed. Now there is a URI class that works properly (not allowing spaces) which is contradictory to URL.
    Worst of all, creating a URL is ambiguous. In the URL
    "file:/tmp/foo%20bar.txt"
    is this the encoded version of a file with a space, or is it the unencoded version of a file with '%' '2' '0' characters in it? There are regression bug reports for places where this has changed behavior in the Java library (something about RMI for those interested).
    SUN refuses to fix URL because of all the legacy code that relies upon this bug. There are many bug reports, (search the Bug Database for "URL space") often marked simply "will not fix".
    http://developer.java.sun.com/developer/bugParade/bugs/4273532.html
    This is a nasty little problem, and I don't think it can be solved without making a new URL class which behaves correctly, and deprecating the old class. Well, you could also just fix URL and break legacy code :)

  • RMI Hello Example under Windows

    I'm trying out the Sun RMI Hello World example to find out more about RMI
    http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html
    I'm using JDK1.6, under WinXP.
    I've compiled the classes, then tried to run the Server using start java example.hello.Server (I've added a CLASSPATH env var pointing to the root of my class files.)
    When the Server starts I get
    Server exception: java.rmi.ConnectException: Connection refused to host: 192.168
    .1.5; nested exception is:
    java.net.ConnectException: Connection refused: connect
    java.rmi.ConnectException: Connection refused to host: 192.168.1.5; nested excep
    tion 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.newCall(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at example.hello.Server.main(Server.java:61)
    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 S
    ource)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
    ource)
    ... 6 more
    My ip address is 192.168.1.5
    I think this is some sort of networking security problem and I would be grateful for some pointers on solving this ?

    jtahlborn wrote:
    do you have an rmiregistry running? the server is trying (and failing) to connect to a registry. i believe those examples refer to starting the rmi registry before running the example code.I didn't do that. Thanks for the help.
    In a real application I assume you start the registry service in some way when the server is started if it isn't already running ?

  • RMI with SSH

    As I understand it, RMI listens on port 1099 and opens other ports upon a connection. This is why we have to open ports 1099 and >1023 on the server firewall. Which is great for all the users on the LAN.
    The site will only let us connect to this system through SSH (port 22). We might be able to use ssh to create a poor mans VPN to connect to RMI as in: ssh -L 1234:localhost:1099 user@remotehost. This fails to work because RMI uses more than just port 1099. If it were something like telnet, ssh -L 1234:localhost:23 user@remotehost it would just work.
    What I think I need is something running on the remote server which connects to port 1099 and listens on a port, for example, 1098. We could then connect with ssh -L 1234:localhost:1098 user@remotehost and packets would be passed to the appropriate RMI connection. Any ideas on how this could be done AND if it could work.
    **CRITICAL: I am not interested in changing the application running RMI at all. It works for everthing the end users need and don't fix it if it isn't broken. In any case, this isn't just about RMI, there are three non-RMI apps which do the same thing, so one solution would be used for all four of them.

    As I understand it, RMI listens on port 1099 and opens other ports upon a connection.No. The RMI Registry listens at port 1099 unless you tell it otherwise. Remote objects listen at system-chosen ports unless you specify a specific port when constructing/exporting them. You can use port 1099 for everything if:
    1. You create the Registry via LocateRegistry.createRegistry() in the same JVM that exports your remote objects.
    2. You cite port 1099 when constructing (super(1099)) or exporting (UnicastRemoteObject.exportObject(obj, 1099)) remote objects.
    Having done that, the only server-side port you need to be concerned with is 1099. That's a reserved IANA port number and it should be possible to get it opened in the firewall.
    And neither RMI nor TCP 'opens other ports' on inbound connections.

Maybe you are looking for

  • Why is iTunes11 against classical music?

    As someone involved in the international regulation of cyberspace and the standards that enable it to function, I have watched Apple recently make a number of mistakes that are increasingly isolating it from governments and the commercial, particular

  • Missing orders in SAP-Gap in number assignment

    Hi All,   We are facing a situation where there is a gap in assignment of order numbers. We do not have any trace of any failed updates in ST22,SM13 etc. Does this mean that we missed only a "number" and not an order? Is there any other transactions

  • Configure Subject Areas

    How do I configure multiple subject areas in OBIEE 11G? Thanks, Akshatha

  • Mobile Apps on iTunes stopped updating

    I'm running iTunes 11.1.3 and mobile apps no longer update.  I have 811 apps in my library and some are due for update, but when I check for updates I am told there are none available.  I know there are because I just updated a few apps today on my i

  • How to register PPE by Bapi or FMs

    I have created a program for registering PPE in the Batch input way. But it fails in background mode. Is there any other way such as Bapi or FM to do it ? Thanks