RMI server behind fire wall

hi there,
i have a running application using RMI but the problem is..
It only run when the server and the client are in the same LAN,But
when installing the server side on a machine behind a fire wall it gives me this exception
Connection refused: connect.
So is there a special technique when dealing with server behind firewalls?
if exis what should i use????
Thanks for your time
Regards
Soha

yes and some of the techniques are
HTTP tunnelling
Direct forwarding over http
Indirect forwarding over http
rmi-cgi scripts etc

Similar Messages

  • RMI server behind firewall--must use host as name, not IP

    Server is running behind a firewall, which runs such that any machine behind the firewall cannot use the external IP to get back to itself.
    That is:
    - outside IP = 192.171.20.5 (port forwards 1099 to 192.168.1.5:1099)
    - inside IP = 192.168.1.5 (rmi server listens on 1099)
    from the machine inside (192.168.1.5), it is IMPOSSIBLE to create a socket to [outside ip](192.171.20.5), port 1099, and expect it to get back to the machine inside--the firewall prohibits this.
    I -can- use name-based lookups, such that I can edit the hosts file on the inside box to route (myhost.com to 192.168.1.5). So, if everyone's DNS resolves myhost.com -> 192.171.20.5, then clients anywhere can go to myhost.com:1099 and will be redirected to my internal machine (192.168.1.5:1099).
    The problem with this is that the names get translated to IPs and sent back to the client.
    Is there a way to keep the names as names, so that both client (using external real-world DNS entries) and server (using local hosts file) can both resolve to the proper IP addresses?
    I'm starting server, as follows:
    java -Djava.rmi.server.codebase=http://myhost.com/rmi/ -Djava.security.policy=/policypath/policy -Djava.rmi.server.hostname=myhost.com mypkg.myclass
    The client connects and gets this message (from a connection exception):
    java.rmi.ConnectException: Connection refused to host: 192.168.1.5;

    Server is running behind a firewall, which runs such
    that any machine behind the firewall cannot use the
    external IP to get back to itself.I dont really understand this statement.. Machines behind the firewall referring to the external ip would be going to the gateway, not themselves.. Or do you have an internal AND external ip on the machines behind the firewall? Or are we referring to the gateway machine as an internal machine as well as external?
    That is:
    - outside IP = 192.171.20.5 (port forwards 1099 to
    192.168.1.5:1099)
    - inside IP = 192.168.1.5 (rmi server listens on
    1099)looks good, what kinda OS/firewall? If we're talking linux/ipchains (or iptables) with ip masquerading, I may be of some use to you...
    from the machine inside (192.168.1.5), it is
    IMPOSSIBLE to create a socket to [outside
    ip](192.171.20.5), port 1099, and expect it to get
    back to the machine inside--the firewall prohibits
    this.If you're on the internal network, why can't you just go for the internal ip addr? If I'm understanding correctly, you want internal dns requests for myhost.com to resolve to 192.168.1.5, and external dns requests to resolve to 192.171.20.5? That should't be a problem...
    I -can- use name-based lookups, such that I can edit
    the hosts file on the inside box to route (myhost.com
    to 192.168.1.5). So, if everyone's DNS resolves
    myhost.com -> 192.171.20.5, then clients anywhere can
    go to myhost.com:1099 and will be redirected to my
    internal machine (192.168.1.5:1099).the hosts file has nothing to do with routing, it's simply a dns-type thing... If your dns is giving external users a 192.168 address as the ip for myhost.com, they will never get to it. 192.168 is not routable on the internet, i think most inet routes will drop packets from 192.168.x.x or 10.x.x.x.
    Is there a way to keep the names as names, so that
    both client (using external real-world DNS entries)
    and server (using local hosts file) can both resolve
    to the proper IP addresses?As long as your dns is working correctly, java doesn't care if you use ips or host names.. Hostnames are preferable, so when you change your network around, you wont affect your rmi server.
    I'm starting server, as follows:
    java -Djava.rmi.server.codebase=http://myhost.com/rmi/
    -Djava.security.policy=/policypath/policy
    -Djava.rmi.server.hostname=myhost.com mypkg.myclass
    The client connects and gets this message (from a
    connection exception):
    java.rmi.ConnectException: Connection refused to host:
    192.168.1.5;Is your server compiled with the 192.171 ip? That's not gonna work, you have to use the same IP the server is running on. I'm still not clear on your network layout, is 192.171.20.5 and 192.168.1.5 the 2 gateway ip's, or is 192.168.1.5 a physically different machine? I'd be willing to bet that your server is compiled with the external address, and if that's not the same machine, then there's no chance of that working....
    There's more than port forwarding going on.. IIRC, java rmi keeps track of its own ip's.. A client request to an external ip will not connect to a server running on the internal ip, even if you forward the port, rmi itself doesn't recognize the internal as the ip it's trying to get to (even if it is true), so it bombs out.. This can happen if you run the rmi server on a gateway, and compile the server with the external ip, and try to connect to the internal ip.. If you want external machines to connect, you MUST run the server on an external ip.
    Give a little more info, we'll getcha running... I'm also assuming you have full control of your network (ie, firewall/dns)
    doug

  • RMI Server behind Router: How to set the right IP?

    Hi, I am having trouble with the Server of an RMI application, the set up is this:
    1. The server is not always running on the same host: it may be a computer with a publicly visible and unique IP, or it may be under a computer behind a router.
    2 . The user that runs the server may not know how to get his IP in the router environment.
    3. The user that runs the server knows sh*t about rmiregistry or how to set a Property to the java interpreter (for example: -Djava.rmi.server.hostname=<host>).
    4. The Server code is this:
    * Represents the Server to the Domination app (including the chat plugin).
    public class Server {
         private static final int PORT_NUM = 1099;
         private static final String CHAT = "chat";
         private static final String DOMINATION_FACTORY = "Domination";
          * Sets the Chat and Application Servers.
          * @param args
          *            Never used.
         public static void main(String[] args) {
              try {
                   Registry registry = LocateRegistry.createRegistry(PORT_NUM);
                   Chat chatObject = new ChatImpl();
                   UnicastRemoteObject.unexportObject(chatObject, true);
                   UnicastRemoteObject.exportObject(chatObject, PORT_NUM);
                   registry.rebind(CHAT, chatObject);
                   System.out.println("Chat ready...");
                   Fabrica fabricaObject = new FabricaImpl();
                   UnicastRemoteObject.unexportObject(fabricaObject, true);
                   UnicastRemoteObject.exportObject(fabricaObject, PORT_NUM);
                   registry.rebind(DOMINATION_FACTORY, fabricaObject);
                            System.out.println("Domination Factory ready...");
                   System.out.println("All systems up and running");          
              } catch (Exception e) {
                   e.printStackTrace();
                   System.exit(1);
    }I wrote the code that way (and not using Naming.rebing("//" + host_name + "/Service", serviceObject)) so the server user won't need to run the rmiregistry (In fact, the Server is deployed via a jar file, so just a happy double-click to the jar will do the work)...
    OK, then the problem is this: The client is always having "connection refused" Exceptions while the server is behind a router and not in the same network of the client.
    The IP that is shown in the exception is always the inner IP of the host (or 10.x.x.x or 192.168.x.x or whatever it may be). So it seems that the registry is always choosing that IP and not the router's.
    I need to know if there is a way to rewrite the Server code so the user just should do the same 'double-click' to run the server and not mess around "investigating" the outer IP. I read some of the RMI specs and it suggest to do IP Tunneling and some other techniques that I don't think may be appropiate to the nature of this "roaming server" application.

    Thanks, but that still doesn't do the work. As I stated in the post, not every user will know how to set java.rmi.server.hostname or even look for an outer IP... I was asking for an "automagical" way to code my server class so it could do some job to do the guessing.
    Even though... I tried both ways at home with the help of a friend as the client, and it seemed to work. The client connected to the server but it was kicked out in less than 30 seconds. Being specific, every client, the ones inside and the ones outside my network. As if the only right way was to let the JVM set the IP (but again, in that way the server is invisible to the clients outside the network).

  • RMI SERVER behind the router....!!!!!!!!!!!!

    Hi I am new here...And Have a problem regarding to java RMI...
    I have a uni assignment which asks us to write an online tic tac toe game using RMI..well assigment only request if it can be run on the same machine and I finished..
    But now I am trying to config it to real life with internet instead of LAN.
    Basically I have one static IP assigned by my ISP... and I have local IP addresses on my machines. The addresses will be translated by my router to the public one...
    My server is running on port 8081 of my server computer with an local IP addresses... and I did port forwarding in my router to forward all the 8081 request to this server...
    And the the client use the public IP to locate my server they can acctually connect to my server and get the stub or ref to it...But when they acctually trying to call a method on
    the server side, I realised they actually using the local IP addresses of my server machine instead of the public one..so i think the stub acctually bind the machine IP and ask client to use this IP to communicate.
    This obviously not going to work...And In the API it seems like I can not acctually do anything about IP address when create the Registry..
    Any clue on this Thank you.......

    No, the stub consists of a single Java object which contains the IP address and port number of the host from which the remote object was exported. The client knows the initial lookup address for the Registry but it performs all subsequent communications via the information embedded in the stub.
    @OP: you need to export your remote object on a fixed port, have the router forward that port, and set the system property java.rmi.server.hostname in the server JVM to the external IP address of the router.

  • RMI server object getting garbage collected

    Hi all,
    I have seen a number of posts regarding the ConnectException and found that this can occur in a number of situations.
    I am having a problem here.
    I am having an RMI server that is always up and running. And the server object gets requests from the client at regular intervals. But, when the server object is not receiving any requests for a long time (ex: 1 day), then I think the remote object itself is getting garbage collected. And so, tough I am able to get the remote reference using the lookup method, I am getting "Connection refused to host: 192.168.0.216; nested exception is:
         java.net.ConnectException: Connection refused" when I call a method using this reference.
    I believe that this is because the server object getting garbage collected as there are no requests for the server since long. Please correct me if my assumption is wrong.
    I want to know, after how much time the server object gets garbage collected if no requests are received. But, my requirement is that the server object should always be available and WHENEVER a client request comes then that should be processed. What should I do to accomplish this task.
    If any one have any suggestions, please reply as soon as possible.
    Thanks in advance,
    srik4u

    You might do some research into using an activatable remote object. You run rmid (the rmi activation deamon) and register a subclass of java.rmi.activation.Activatable (instead of the usual UnicastRemoteObject) with it. With an activatable object, the remote reference to the activatable object doesn't need to have a live object behind it. If an activatable object is not running (ie: it hasn't been constructed yet, or it has been garbage collected ...as in your case) a remote reference to the object can still be exported to a client. The first time the client calls a method on the remote object, the activation service on the server sees the object is not active, and activates the object for the client. If the object is running ...it is rmi as usual. But if it gets gc'd again, the next invocation on the remote object will trigger the activation service again.
    (The above explanation paraphrases author David Flanagan from Java Enterprise in a Nutshell, O'Reilly)
    I have only built one of these, which loosely followed an example from the above mentioned book. It's a whole other ballgame over and above a regular rmi object. But like anything else, if you dig in and get your head wrapped around it, it eventually makes sense. Ok, why lie ...it confused the hell out of me and left me a little queasy. But you know the drill, by the time you build a few of them it will probably seem as easy as mapping the human genome, right? At any rate, it seems like what you might be after ...so have a look at it. Good luck, and wear your lifejacket.

  • Java.rmi.server.hostname

    Hi,
    i am trying to figure out where this property comes into play. The docs say:
    "The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. In 1.1.7 and later, the default value of this property is the IP address of the local host, in "dotted-quad" format."
    So i reverse engineered the stub to see if the value is inside the stub, but it isnt. I am asking because i want to run my RMI server program as a service and i dont want to define a static hostname property, because the server can be installed on several machines. Perhaps i can leave out this property completey and rely on defaults.
    So two questions remain to me:
    - Can i leave out this without getting into trouble?
    - Where is this propery used, obviously not in the stub.
    Thanks.
    marc

    Hi Marc,
    - Can i leave out this without getting into trouble?
    Possibly, see answer to your second question.
    - Where is this propery used, obviously not in the stub?
    The property is used primarily for one of two reasons, otherwise it is generally not necessary.
    1. If you have more than one network interface on a given machine, this property will specify which one to use.
    2. If you are behind a NAT router, this property will specify the actual address to use, outside the NAT subnet.
    Unspecified it will use the default network adapter address specified by your OS.
    Hope that was interesting :-)
    -John

  • RMI Server issuing commands to clients - help please

    I am trying to setup 2 clients to respond when an RMI server sends them a message, however I have never done any distributed programming before.
    Can anyone please post up some classes which show how to have a client listening and a server connecting to them in order to activate a method. I would be extremely grateful. If anyone knows of a web site or another similar resource with an example like this that would also be much appreciated...
    Many thanks,
    drawdE

    Earlier responses pointed out something important:
    when it comes to real communications, the roles of
    client and server are frequently switched.Yes, but CONCEPTUALLY.
    What you mean to say really, is that a process can be ASKED for some resource (then it would be acting like a "server") or it can ASK for a resource (it would be acting like a "client"). Please note that i said it ACTS like something. It is not the same thing as it REALLY BEING that thing substantially. What i'm driving at is that when you design an app, objects that make it up take dual roles at THAT LEVEL of their own operation, but universally (when you look at the ENTIRE app), things cannot switch around like that anytime they want. An RMI Server is just that: A server. Clients connect to it, and there's no reason for the server to want to connect to a client of its own volition. When you start doing that, you're messing around with WHAT IT MEANS to implement client/server arch.....For instance, the objects that make up of that talk to bound remote objects on the server, CAN act out this dual role: but not when you have a bird's eye view of the entire app.
    Its bad design. Its bad practise.
    >
    At the "architectural" level - something I admit is
    vague - I suggest that in the application described by
    the original poster, the only distinctions between
    client and server are
    o There are multiple clients but only one server.What the original post doesnt seem to get is that there would be as many clients as servers if he succeeds.
    o A client can register with a server for on-going
    communications, In everything else i would agree, but not in RMI: its nature just forbids it, because it means implementing what is in the server-side......on the client-side, just so the client can be TALKED TO by the "one server", as you put it.
    but not the reverse.
    >
    This last point is key to server-initiated
    communications (using RMI). When a client registers
    with a server, it passes a reference to an object that
    extends Remote. The server holds onto this reference,
    and when it has something to say to the clientlike what? RMI isnt built that way! the client talks to the server. End of story.
    , then
    the server calls a method of that remote objectimplying another server on the client-side!!! doesnt make sense at all.
    >
    Finally, It bears repeating in this forum: With RMI,
    such "callbacks" will not work if the clients are
    behind firewalls.Correct, but irrelevant: firewalls or no firewalls, WHY are you trying to do it in the first place?
    It also bears repeating in this forum: RMI is client/server architecture in practice, but its the NATURE of RMI that forbids it from being used the way ANY OTHER C/S architecture out there is flexible.

  • Is it even possible to bind the RMI servant to a static port?

    Hi all,
    We would like to bind a RMI service to a static port, so that it is easier to configured the firewall setting to make it accessible by RMI client outside of the fire wall. Is it possible at all?
    Thanks,
    -Mark

    That's what the port argument to UnicastRemoteObject.UnicastRemoteObject() and exportObject() is for.

  • Fire Wall Tab

    Hi,
    Im having trouble with fire wall in leopard
    when im trying to install an update for a program and it says my computer is behind a firewall. Ive read that i need to go to system preferences>sharing>Firewall tab. Well i cant find the fire wall tab, it just shows a list of services but nothing about firewalls.

    Alas, Apple changed how the firewall works in Leopard.
    What you need to do now is go to the Firewall tab of the Security preference pane.
    If your firewall is set to "Allow all incoming connections," your firewall is disabled so you need not do anything.
    If your firewall is set to "Block all incoming connections," no applications should be able to accept incoming connections.
    If your firewall is set to "Set access for specific services and applications" you'll have to click the "+" button, navigate to your application, and let the firewall know whether it should be allowed to accept incoming connections.

  • Rmi server communicating with client

    Is there any way for an rmi server to communicate back to the client? What I mean is, the client connects to the server and calls some method x(). One of the arguments of x() is the client(x(AClient ac)). Assume that AClient is a JFrame and has a method y() which adds a button to the frame or something. If the server calls ac.y(), in my understanding/experience, the server would actually create a local copy of AClient and add the button to the local copy, not to the frame that the client user is looking at.Is this correct? { 
      If so, is there any way to have ac.y() add the button to the client user's frame?
        If not, does anyone have any ideas for how to implement something like this relatively easily? 
    If not, does anyone have any ideas why it's not responding that way for me?I'm trying to avoid programming socket connections for this, and would love to be able to do it with rmi.
    Thanks in advance,
    m

    Not sure exactly what your starting point is. But:
    1. The client must be a UnicastRemoteObject.
    2. If your client is behind a firewall, then the scheme probably won't work. (Explored exhaustively in this forum.)

  • 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.

  • Urgent Help Required For Starting RMI server from servlet.

    I am currently working on rmi project.
    I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
    I am writing servlet and inside it i am binding object to registry for rmi server.
    which will be deployed on remote server.
    code ....
    Registry reg;
    reg=LocateRegistry.createRegistry(1099);
    Server server=new Server("server");//class whose remote object to be accessed
    //extends unicast remote object.Implement ServerInt interface which extends Remote.
    reg.bind("server",server);
    When i am trying to access this object i am getting following exception.
    javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
    on: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: ServerModule.ServerInt]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at RequstReplication.main(RequstReplication.java:27)
    Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
    tion is:
    java.lang.ClassNotFoundException: ServerModule.ServerInt
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    ... 4 more
    Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
    at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    ... 5 more
    I can access naming enumeration of registry and object bound to it.
    by following program.I shows corect objects.
    Context namingContext=new InitialContext();
    NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
    while(e.hasMore())
    System.out.println(e.next().getName());
    While when i start RMI server from simple java program i can access these objects from registry.
    I am not getting what is problem problem.Is there any other way to send request?
    Plese give quick response.

    I am currently working on rmi project.
    I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
    I am writing servlet and inside it i am binding object to registry for rmi server.
    which will be deployed on remote server.
    code ....
    Registry reg;
    reg=LocateRegistry.createRegistry(1099);
    Server server=new Server("server");//class whose remote object to be accessed
    //extends unicast remote object.Implement ServerInt interface which extends Remote.
    reg.bind("server",server);
    When i am trying to access this object i am getting following exception.
    javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
    on: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: ServerModule.ServerInt]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at RequstReplication.main(RequstReplication.java:27)
    Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
    tion is:
    java.lang.ClassNotFoundException: ServerModule.ServerInt
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    ... 4 more
    Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
    at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    ... 5 more
    I can access naming enumeration of registry and object bound to it.
    by following program.I shows corect objects.
    Context namingContext=new InitialContext();
    NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
    while(e.hasMore())
    System.out.println(e.next().getName());
    While when i start RMI server from simple java program i can access these objects from registry.
    I am not getting what is problem problem.Is there any other way to send request?
    Plese give quick response.

  • Attempting to use SSL over RMI from a web application to a RMI server

    Hi,
    I am attempting to use SSL over RMI to a server. The client is the web
    application that is hosted on WebLogic and that attempts to connect to the
    server. There is no client or server verification at either the client or
    the server end. The code works outside of WebLogic 7/8 but has the following
    issues when running the web application inside weblogic:
    java.rmi.ConnectException: Connection refused to host: gkhanna1; nested
    exception is:
    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
    sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketF
    actory.java:20)
    at
    sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketF
    actory.java:115)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:79)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.initConnection(NTLMConne
    ctionClient.java:59)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.getUsers(NTLMConnectionC
    lient.java:197)
    at com.hyperion.css.CSSAPIImpl.getUsers(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at jsp_servlet._jsp._app1.__app1signin._jspService(__app1signin.java:133)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1058)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :401)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :445)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :306)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5445)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:780)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3105)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2588)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    The code at the client that initiates the connection:
    socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
    SSLSocket socket = (SSLSocket) socketFactory.createSocket(host, port);
    socket.setEnabledCipherSuites(CIPHERS);
    socket.setEnableSessionCreation(true);
    Any ideas?
    Thanks

    I don't see anything that indicates SSL was directly a factor in the
    failure.
    From the exception stack it looks like a more basic connectivity issue,
    maybe the URL for the
    RMI server is incorrect for some reason or the server was down.
    It looks like you are doing something like this:
    SSL client -> WLS server with servletA, servletA RMI client
    (com.hyperion.css) -> RMI server
    The connection failure appears to be the connection from servletA RMI client
    to the RMI server.
    Is that a correct picture?
    Tony
    "Gaurav Khanna" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I am attempting to use SSL over RMI to a server. The client is the web
    application that is hosted on WebLogic and that attempts to connect to the
    server. There is no client or server verification at either the client or
    the server end. The code works outside of WebLogic 7/8 but has thefollowing
    issues when running the web application inside weblogic:
    java.rmi.ConnectException: Connection refused to host: gkhanna1; nested
    exception is:
    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
    sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketF
    actory.java:20)
    at
    sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketF
    actory.java:115)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:79)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.initConnection(NTLMConne
    ctionClient.java:59)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.getUsers(NTLMConnectionC
    lient.java:197)
    at com.hyperion.css.CSSAPIImpl.getUsers(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at jsp_servlet._jsp._app1.__app1signin._jspService(__app1signin.java:133)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1058)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :401)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :445)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :306)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5445)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:780)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3105)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2588)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    The code at the client that initiates the connection:
    socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
    SSLSocket socket = (SSLSocket) socketFactory.createSocket(host, port);
    socket.setEnabledCipherSuites(CIPHERS);
    socket.setEnableSessionCreation(true);
    Any ideas?
    Thanks

  • Error while registering RMI Server

    Hi
    I have a system connected to bradband with a static ip. I am planning to use this as the RMI server and any system connected to the internet as the client. Is this possible....?
    I tried to bind the name to the registry and I get the following error.
    C:\PROGRA~1\Java\jre1.5.0_06\bin>java -Djava.security.policy=policy HelloServer
    HelloServer error: Connection refused to host: 59.144.28.215; nested exception i
    s:
            java.net.ConnectException: Connection refused: connect
    java.rmi.ConnectException: Connection refused to host: 59.144.58.215; nested exc
    eption 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.rebind(Unknown Source)
            at java.rmi.Naming.rebind(Unknown Source)
            at HelloServer.main(HelloServer.java:18)
    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)
            ... 7 moreCan anyone help me by resolving this error.....

    what do you mean by intranet address?
    If you use some NAT device (e.g, DSL, cable) that it is likely you won't be able to access the registry using the external IP address. In such case you need to open the registry port in the firewall.

  • Not able to run a simple RMI server

    I am running an RMI program like follwing
    import java.rmi.* ;
    import java.rmi.registry.* ;
    import java.rmi.server.* ;
    public class CallBeanServer extends UnicastRemoteObject implements ICallBeanServer
         //main
         public static void main(String args[]) throws Exception
              int port = 1000 ;
              Registry reg = null ;
              if( args[0].equals("true"))
                   reg = LocateRegistry.createRegistry(port) ;
                   System.out.println("Successfully created registry") ;
              else
                   reg = LocateRegistry.getRegistry(port) ;
                   System.out.println("Connected to existing registry") ;
              CallBeanServer callBeanServer = new CallBeanServer(reg) ;
         }//main
         //constructor
         public CallBeanServer(Registry reg) throws Exception, RemoteException
              super() ;
              reg.rebind("CallBeanServer",this) ;
              System.out.println("CallBeanServer Object bound") ;
         //my public method
         public String callBeanServer() throws RemoteException
         {          return "Success" ;
    I have run the rmiregistry at port no 1000 like
    rmiregistry 1000
    I have compiled ICallBeanServer also and run rmic also over CallBeanServer like
    rmic CallBeanServer
    when I run this program using
    java CallBeanServer false
    it gives the follwoing errors
    Connected to existing registry
    Exception in thread "main" java.rmi.ServerException: Server RemoteException; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    java.lang.ClassNotFoundException: CallBeanServer_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 CallBeanServer.<init>(CallBeanServer.java:38)
    at CallBeanServer.main(CallBeanServer.java:30)
    Can you please tell me what is the error?
    Thanks
    Prashant Gupta

    Add the classes (the stubs included) to the classpath when you start the registry.

Maybe you are looking for