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

Similar Messages

  • How to set the right filter mode?

    Hi All,
    I have a few applications deployed in Tomcat 5.5.9 for which i need to control access.
    I have created a policy to which I have added a rule of type URL Policy Agent and added a few users as subjects.
    Now that the policy is in place, I tried to change the filter.mode property in AMAgent.properties file to all the possible options and I have noticed the following:
    filter.mode=NONE              Allows all users without authentication
    filter.mode=SSO_ONLY          Allows all users after authentication against DS
    filter.mode=URL_POLICY          Disallows authentic users also (HTTP 403 error)
    filter.mode=J2EE_POLICY          Allows all users after authentication against DS
    filter.mode=ALL                      Disallows authentic users also (HTTP 403 error)
    In my case all the observations except the J2EE_POLICY option work as required.
    I conclude this as a part of my understanding gained through the following:
    http://docs.sun.com/source/816-6884-10/chapter3.html#wp21908
    I have failed to understand why the J2EE_POLICY option allows users which are not included as subjects in the realm as authentic.
    I have also tried setting the com.sun.am.policy.agents.do_sso_only=false property but dint get things working as needed.
    Any help in this regard would be appreciated.
    Regards,
    Saiesh Nayak,
    Persistent Systems.

    J2ee_policy allows users which are not included as subjects in the realm because the policy agent actually doesn't validate the URL policies configured in AM, it just validate j2ee declarative security from your web application.
    So, as I suspect, if you don't have security constraints in your webapp, you won't enforce security.
    With URL_POLICY option, you will enable url policy evaluations as you configure it in Access Manager. So, in this case and in the ALL option case, check that the url policy is correctly configured, mainly the rule.
    You can enable debug.level=message instead of debug.level=error in AMAgent.properties in order to see what's happening. When you enable message level debug, the agent will create some debug log files, please take a look on the amFilter and amWebPolicy log files.
    Hope it helps.

  • How to set the CLASSPATH in Unix Server

    Hi, everyone~
    Do anyone noe how to set the CLASSPATH in the hp-ux server? I tried the setenv CLASSPATH, but not working.. I think should use export. But my jsp pages still cannot working, dunnoe y?
    I wonder is the hp-ux support jsp and servlet or not?
    In order to let the jsp and servlet to run properly in the unix server, what kinds of steps should taken ?
    Hope somemore who experience with this situation b4 can give me some guidance.. Thanks~~
    regards,
    tzeyik

    Tomcat ignores any and all CLASSPATH environment variables. Even if you could figure out how to set it, Tomcat wouldn't use it.
    Better to learn how Tomcat's CLASSPATH works and how to deploy Web apps properly. - MOD

  • How to set the parameter of xi header in server proxy

    Hi,
    Does anyone have idea, how to set ref_to_message_id of a client proxy in the server proxy? My problem is, I send a message to a server proxy. The server proxy receives the message, retrieves the message id and tries to set the ref_to_message_id of the message, which will be sent to a client proxy, with its message id. I only find some useful functions to get these information of client proxy and server proxy like message_id etc. in runtime. But I did not find the "set" function to set these parameters. Maybe someone can tell me at first, if it is possible to set such parameters in runtime in server proxy.
    Can anyone help?
    regard
    hu

    Hi Chilla,
    what I want is to monitor the related message bundle easily. In my server proxy, many different client proxies are called and messages are transfered. So under the SXMB_MONI I will find many message exchanges for one server proxy call. Because the server proxy is called so often, I cannot distinguish under the SXMB_MONI, which message exchanges are caused by which server proxy call.
    So I have an idea. If I can set the ref_to_message_id of the messages for the client proxy calls with the message id of the server proxy call, then I can at first select the message of the server proxy call and find the messages for the related client proxy calls easily using the button "referencing message". The message id of the server proxy call can be retrieved. So my problem is now, how to set the ref_to_message_id of the messages for the client proxy calls with this messag id in the server proxy.
    Of cource, if anyone has better idea, how to resolve the situation in another way without setting the ref_to_message_id, pleases inform me.
    regards
    Bin

  • How to set the Server CLASSPATH?

    Hi all Oracle Java experts,
    I know this is a rather stupid questions:
    Where can I set the CLASSPATH of the Servlet Engine in Oracle 8.1.7.?
    I spent hours now searching the documentation and found loads of hints what to add to the CLASSPATH in which circumstances, but not how to... Of course I know how to use the CLASSPATH in a normal Java environment, but not in the OSE.
    In the "Oracle8i Application Developer's Guide - XML" it says in the "Using XSQL Servlet" Chapter:
    "How you set the CLASSPATH of the web server's Servlet environment and how you associate a Servlet with a file extension are done differently for each web server. The XSQL Servlet's Release Notes contain detailed setup information for specific web servers you might want to use with XSQL Pages."
    Unfortunately, the Release Notes contain this information for Tomcat, Apache JServ etc., but not for Oracle's own Servlet Engine... Maybe you should include that information.
    Thanks for any help;-)
    Cheers
    Olaf
    null

    Not sure if I understatnd the context in which you want to set your classpath.
    IDE, java or system but ...
    look at the profile file /etc/profile
    CLASSPATH= "/usr/local/jdk1.4......"
    export CLASSPATH
    or
    javac -classpath .;/usr/local/jkd1.4.... test.java
    or
    whatever your ide provides.

  • How to set the servlet context path manually in Tomcat web server.

    I tested some servlets by putting them in the folder , which the tomcats examples application uses (ie Tomcat 4.1\webapps\examples\WEB-INF\classes\) and it appeared to be working fine.
    I was calling the servlet like this : http://localhost:2006/examples/servlet/TestServlet
    But when I installed my own WAR file in the server , the servlet is not working now. now the new location of my servlets is : Tomcat 4.1\webapps\MyApp\WEB-INF\classes\
    and I'm trying to call the servlet like this : http://localhost:2006/MyApp/servlet/TestServlet
    The error , what i'm getting is :
    description :The requested resource (/MyApp/servlet/TestServlet) is not available.
    Some body please tell where I'm making the mistake ? I believe this may have something to do with the servlet context path setting. If anybody has any idea , how to set the path..will be much appreciated.

    Thanx for your reply , at first I was not using any web.xml(since not mandatory) but even after using the web.xml file the error is coming . Please have a look into the contents of the web.xml file and let me know if you find any problem...
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>TestServlet</servlet-class>
    </servlet>
    </web-app>
    one more thing I would like to tell you here. I was just looking into the configuration of Iplanet web server..I found that , there are options to set the servlet container path (like : - Prefix: /servlet
    Servlet Directory: /ecomm/iplanet/nes60/product/docs/container )
    so from here I came to know that "container " is the folder where we should put our servlets and it has URI as "servlet" but yet I'm not able to find any option in the Tomcat Web server to set the servlet container to any different directory.
    If you have any idea please let me know.

  • How to set the router and play the Command & Conquer using direct IP mode?

    My router is WRT54GFirmware Version: v3.03.1
    How to set the router and play the Command & Conquer using direct IP mode with other computer?

    Hi, when you say direct IP mode, what do you mean ? do you wanna play the game online or on the LAN ??
    can you give a few more details.

  • How to set the header variables in weblogic

    Hi,
    We have a following set up in our environment.
    We have weblogic and on the top of it we have apex listener deployed which redirects Oracle Apex.
    My Issue:
    How can we set up the header variables in weblogic once the user is authenticated against weblogic server.
    We are struck here, not knowing how to set the header variables in weblogic server. Its fairly straight forward for Oracle Access Manager or others..
    Thanks
    Ramesh P.

    maybe you are looking for the routing options
    http://docs.oracle.com/cd/E13159_01/osb/docs10gr3/userguide/modelingmessageflow.html#wp1125348

  • 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

  • How to set the number of seconds a servlet is allowed to run

    I use JSP to generate a report, but it will take about 10 minutes to search.
    IE Client screen displays an error message what is "Cannot find out your page" after 8 minutes. How to set the number of seconds a servlet is allowed to run.

    It's not a matter of how long the servlet is running... it's the browser timing out because the servlet hasn't responded to its request.
    You have several options:
    1) "Browser Pinging"
    Your servlet sends some small data which can be either seen or unseen (html comments, hidden chars, etc) by the user at short intervals while your report is running. When the report is finished, the browser will not have timed out because it has been "snacking" on those small bits of data which tell the browser its original request was both heard and being handled. I don't think there is any timeout in IE as long as it receives data continually (or at least before its own timeout mark over and over again...)
    2) Multithreaded processing
    This would probably be a better approach. Have the report run in a separate thread running on the server. You'd want to store a reference to this executing report in the user's session. Instead of making the browser wait for the report to be finished, have the servlet check the user's session to see if a report exists and is running. If one does not exist, create one and start its execution. If one does exist, and is still running, print a "please wait" type of message OR an animation, etc... along with some javascript which will reload the page every few seconds. If the page reloads and the servlet sees that the report is finished, it can then display it to the user.
    Hope this helps,
    -Scott

  • How to set the file path dynamically based on sytem, username, and date

    Hi All,
    My requirement is upload the data into one  structure like xyz that is related to t.code MCSZ.
    file will be in  UNIx SERVER .
    PATH IS: /sapif
    file name is xy789 load .txt
    I have  to write code in one user-exit
    how can i set the file path for this.
    shall i put hard code file path?
    because i have to writecode in user-exit.
    plz tell me how to set the file path based ons syetem, username, date
    Thanks in advance
    Ram.A

    Concatenate the field SY-SYSID, SY-UNAME and SY-DATUM for the file path

  • How to set the AS2 fileName for outbound Functional Ack 997 auto generated by Oracle B2B

    Hi Friends,
    How to set the AS2 fileName for outbound Functional Ack 997 auto generated by Oracle B2B.
    External Trading Partner is sending the EDI 856 via AS2 URL to our Oracle B2B Server.
    In the inbound 856 agreement, we have checked the option of Funtional Ack and also Functiona Ack handled by B2B is yes.
    We have the outbound agreement which is sending that Functional ack 997 (auto generated by oracle b2b) and we have specified the Outbound AS2 channel of the Partner.
    997 doc is being sent to external partner using AS2 channel, but the filename is generating as '40101'.
    Please can you let me know how to set the AS2 fileName for outbound Functional Ack 997 auto generated by Oracle B2B.
    Appreciate your valuable answers!!
    Thanks,
    Amirineni

    Amirineni,
    AFAIK, there is no option to set the file name when the 997 is generated automatically by B2B.
    Alternatively, if this is a must requirement, you can generate the FA from backend and  send to B2B with MSG_TYPE =9. In this case, you can set the header with filename (How to set the actionname property in B2B 11g)

  • How to start weblogic in debug mode ? and how to set the eclipse in the deb

    how to start weblogic in debug mode ? and how to set the eclipse in the debug

    Put this in JAVA_OPTIONS :
    Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=3999,suspend=y,server=y
    After restarted weblogic, in eclipse set your breakpoint , open debug perspective then choose Remote Java Appliction and configure Connection Properties (host=localhost and port=3999)

  • How to set the default profiles in pi i have a problem

    hi friends
    can any one give me the solulation for this problem
    Exception class: com.sap.aii.utilxi.prop.api.PropertiesException
    Unable to read configuration data (ExchangeProfile/aii.properties)
    Exception Details
    Exception class: com.sap.aii.utilxi.prop.api.PropertiesException
    Message
    Unable to read configuration data (ExchangeProfile/aii.properties)
    Stacktrace
    Thrown:
    MESSAGE ID: com.sap.aii.utilxi.prop.api.rb_all.NO_PROPERTIES
    com.sap.aii.utilxi.prop.api.PropertiesException: Unable to read configuration data (ExchangeProfile/aii.properties)
         at com.sap.aii.utilxi.prop.api.PropertySourceFactory.initServerMode(PropertySourceFactory.java:202)
         at com.sap.aii.utilxi.misc.api.AIIProperties.initServerMode(AIIProperties.java:401)
         at com.sap.aii.ib.server.applcomp.StartupServerProperties.initPropertiesForServer(StartupServerProperties.java:95)
         at com.sap.aii.ibrep.server.applcomp.StartupCodeEntry.startup(StartupCodeEntry.java:152)
         at com.sap.aii.ib.core.applcomp.IStartupCodeEntry.startupIfNotAlreadyDone(IStartupCodeEntry.java:33)
         at com.sap.aii.ib.core.applcomp.ExplicitApplicationComponentImpl.startup(ExplicitApplicationComponentImpl.java:116)
         at com.sap.aii.ib.core.applcomp.ExplicitApplicationComponents.startup(ExplicitApplicationComponents.java:383)
         at com.sap.aii.ib.core.applcomp.ApplicationComponent.startup(ApplicationComponent.java:209)
         at jsp_Main1198312518875._jspService(jsp_Main1198312518875.java:21)
         at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Error History, Build Info, Generic Application Info
    plz help me i could not do any work
    how to set the defult profiles
    raja

    Please look at this thread. This might resolve your problem.
    Unable to read configuration data (ExchangeProfile/aii.properties)
    -Pinkle

  • How to set the username in PeopleEditor programmatically

    Hi ,
    How to set the user name in people picker entity programmatically.
    I have tried this:
    <sp:PeopleEditor ID="sppcustom" runat="server" AllowEmpty="false" MultiSelect="false" SelectionSet="User" />
    In the webpart cs code:
    PeopleEditor sppcustom = new PeopleEditor();
    sppcustom.CommaSeparatedAccounts = "domain" + "\\" + userFullname;
    The code is executing fine without error, however the username is not shown in the peopleeditor.
    When the name is added, i am getting the error "No exact match was found. Click the item(s) that did not resolve for more options.".
    However the username is a valid one. i tried the validate code also and the username was validated.
    How to fix this?
    Thanks

    You can set the display name of the particular user
    sppcustom.CommaSeparatedAccounts = userFullname.Name;
    if userFullname is SPUser 
    Gnanasekhar K

Maybe you are looking for

  • Why does my Mac Mini keep crashing when I try backing up to the Time Machine?

    I have a Seagate Barracuda internal harddrive stuck in an external enclosure. I have formatted the harddrive to meet with the Mac's standards. I am trying to backup using the Time Machine feature and the computer has crashed three times so far. Is th

  • IPhoto 08 has more Photo Info than Aperture 2.1

    When I examine the information in the Metadata Inspector of Aperture 2.1, it is missing information found in iPhoto 08: Exposure. iPhoto tells me that my picture was taken with Aperture priority in the Exposure section of the Photo Info window. Apert

  • Two line items created while doing sales excise invoice

    Hi all, I have created an excise invoice through J1iin. But when I do so, there are two line items created for BED on excise paid. where as ideally there should only be one line item created. The standard entry should be as follows : Excise Duty BED

  • SQL Server 2005 Workgroup Edition compatibility for SAP B1 2005B

    Hi Experts, Please advise SQL Server 2005 Workgroup Edition can be used as the backend for SAP Business One 2005B. Thanks, Shakeel

  • Header is displayed more than once

    I have several records that I can display as a table just for checking out. It has several types of records. I can delete this from the template in the future. Now, I´d like to create a section for record type X. I do have a logic like: for-each reco