RMI Doesn't Work Over Firewall

Hi,I need urgent help!!! I am writing a RMI server which will be hosted behind the firewall and the client could be anyone. I started my RMI server but I have problem connecting to it. Here's my codes:
If you look at the Client.java class, my code got as far as:
Registry reg = LocateRegistry.getRegistry("216.16.45.33", 2001);
I could get the registry but the lookup of "MyServer" failed. I encounter, the "java.rmi.ConnectException: Connection refused" at the Client side.
More info:
I am using Linksys router and I have already set the router to forward all traffics at port 2001 and 2999 to go to the computer that hosts the RMI server. Can someone point me to the right direction? THANKS GUYS!!!!
----FixedPortRMISocketFactory.java----
import java.rmi.server.RMISocketFactory;
import java.net.Socket;
import java.net.ServerSocket;
import java.io.IOException;
public class FixedPortRMISocketFactory extends RMISocketFactory {     
public ServerSocket createServerSocket(int port) throws IOException {
port = (port == 0 ? 2999: port); //use some arbitrary fixed port.
return new ServerSocket(port);
public Socket createSocket(String host, int port) throws IOException {          
return new Socket(host, port);
----End of MyRMIServer .java----
----MyRMIServer .java----
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RMISecurityManager;
import java.rmi.server.RMISocketFactory;
import java.rmi.Naming;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
public class MyRMIServer extends UnicastRemoteObject implements HelloWorldIf {
public boolean helloWorld() throws RemoteException {
return "hello world";
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
// Create and install the security manager
System.setProperty("java.security.policy","java.policy");
System.setSecurityManager(new RMISecurityManager());
try {     
RMISocketFactory.setSocketFactory(new FixedPortRMISocketFactory());
String host = "rmi://216.16.45.33:2001 + "/MyServer";
MyRMIServer server = new MyRMIServer ();
Registry reg = LocateRegistry.createRegistry(2001);
Naming.rebind(host, server);
System.out.println("MyServerbound on localhost");
} catch (Exception e) {
System.out.println("Error trying to bind MyServer.");
e.printStackTrace();
----End of MyRMIServer .java----
----Client .java----
import java.rmi.*;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.RMISocketFactory;
public class Client {
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setProperty("java.security.policy","java.policy");
System.setSecurityManager(new RMISecurityManager());
try {
Registry reg = LocateRegistry.getRegistry("216.16.45.33", 2001);          
HelloWorldIf server = (HelloWorldIf)reg.lookup("MyServer");
System.out.println("****String got from server: " + server.helloWorld());
} catch (Exception e) {
System.out.println("****Exception looking for server.");
----End of Client .java----
----java.policy----
grant {
permission java.security.AllPermission;
----End of java.policy----

On what platform (Linux or windows) your server is running?
And more important, what IP address this server has?
When it tries to bind object to IP that is not set to this machine, then it fails. RMI server does not say any error or something...
I had the same problem. I added second interface (linux command):
ifconfig eth0 xxx.xxx.xxx.xxx
where xxx.xxx.xxx.xxx is my public IP.

Similar Messages

  • Facetime, imessage and find my ipad doesn`t work over wifi but they work over 4g

    Facetime, imessage and find my ipad doesn`t work over wifi but they work over 4g, please help me

    Are you sure?
    According to Apple Facetime will only work over WiFi. IOS 6 will bring feature that you can make Facetime call over 3g-4g

  • SB-Messaging adapter doesn't work behind firewall

    Using BizTalk 2013 and the SB-Messaging adapter to retrieve and send messages from Microsoft Azure Service Bus Queue's and Topics.
    The Internet proxy and firewall are blocking all the outgoing TCP Ports but the HTTP (80) and HTTPS (443) port are open.
    The SB-Messaging receive location is configured correct but the messages are not being received. There is nog error message in de event log.
    The SB-Messaging send port is configuerd correct, but the messages are not being send. This is the error message:
    A message sent to adapter "SB-Messaging" on send port "SP_Queue_SB-Messaging" with URI "sb://myesb-o.servicebus.windows.net/testmessagequeue/" is suspended.
     Error details: System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://myesb-o.servicebus.windows.net:9354/. The connection attempt lasted for a time span of 00:00:20.9927053. TCP error code 10060: A connection attempt failed
    because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 65.52.128.246:9354.  ---> System.Net.Sockets.SocketException: A connection attempt failed because
    the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
    Why does the SB-Messaging adapter not work over the HTTP(S) connection? Why does it not fall back to the HTTP protocal?

    Have you installed Windows Azure SDK v2.2 from the SDK site
    here  ?
    If not try installing it and restart the host instance.
    Reference can be taken from
    blog post   
    If above does not resolve your issue,I would also suggest to open ports from range 9350 to 9354 .
    Also go through below links to get more understanding.
    ConnectivityMode
    ConnectivitySettings.Mode
    Thanks
    Abhishek

  • [solved] SSH doesn't work over PPTP VPN with pptpclient

    I just got set up with access to my work's PPTP VPN. Using pptpclient I can establish a connection and ping servers. I can use telnet to confirm ports 22, 80 etc are accessible and I can access web services in my browser, but SSH doesn't work.
    When I try and SSH to a server it just hangs for a minute and then "Connection closed by 10.70.11.10". Wondering if SSH was using my default route rather than the appropriate tunnel, I tried setting my default route to use the VPN, and ping, telnet, nmap etc still seem to function and return expected results, but SSH still hangs and closes. There are no entries in the sshd log on the servers that I attempted to get access to. I have both Arch and CentOS servers and I cannot get to either via SSH.
    My colleague connected to the VPN on his mobile phone and managed to SSH to a server, so it doesn't seem that the VPN is blocking this... any ideas?
    Thanks
    [update]
    Solved! I found that in /etc/ppp/options, un-commenting -mru fixed this for me:
    # Disable MRU [Maximum Receive Unit] negotiation (use default, i.e.
    # 1500).
    -mru
    [/update]
    Last edited by jsteel (2014-08-10 20:06:31)

    targetbsp wrote:
    summit48 wrote:
     Windows10 has hijacked the back end believing every Laptop and Desktop PC is a Smartphone. What do you mean by that?Windows 10: Microsoft under attack over privacyhttp://www.theguardian.com/technology/2015/jul/31/windows-10-microsoft-faces-criticism-over-privacy-default-settings In the "one size fits all" philosophy of Microsoft there is no distinction between a smartphone and a PC. You might turn some of these privacy setting on for a smartphone but not on a PC. 

  • Verizon messages app doesn't work over wifi....

    Hello, all,
    Until recently, I used the verizon messages app to send/receive texts over wifi on my gs3 when I had no cellular/data reception.  Now it will only send/rec when there's cell reception.
    But...the app does still work over wifi onmy galaxy tab 2 7.0.
    Why could this be?  Did a recent app update break txt over wifi for the gs3?
    Thanks!
    Abe

    This does NOT work on the Galaxy S3.
    Airplane mode ON, Wifi ON, No network mode is available in Airplane mode.  So...only wifi is available.  When I try to send a text with only wifi available I get "Network not available.  The message will be sent when the network is available"
    BUT...On my Galaxy Tab 2 (non-verizon), This DOES work.  On the tab 2 with only wifi available, I CAN send text messages using Verizon Messages.
    So....again...
    On Galaxy Tab 2 with only WiFi available...texting with Verizon messages DOES work.
    On Galaxy S3 with only WiFi available...texting with Verizon messages DOES NOT work.
    Please fix Verizon Messages to work over WiFi using Galaxy S3.
    Thanks,
    Abe

  • Officejet 4500 doesn't work over ethernet connection

    My Officejet 4500 is recognized by my router but not by anything else.  Tablet doesn't see it nor does the desktop.  Your also supposed to be able to set it up as sort of a cloud printer...but that doesn't work either.  System is Vista Home Basic 32 bit SP2.
    HP= Good hardware + terrible software
    Dell= Bad hardware + good support

    Hi Tim,
    I would like to confirm the exact model of your printer.  Is this the G510h or a different model? 
    The list of printers and the ePrint (Cloud) support list is here:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c03722645&tmp_task=prodinfoCategory&cc=us&dlc=en...
    Is the desktop also connected Ethernet to the network?  Does the printer network status page show a network IP address?
    Which tablet do you have?
    I was an HP employee.
    Please mark the post that solves your problem as "Accepted Solution"

  • Windows File Share doesn't work over RV042 QuickVPN

    I have two sites, one has an RV042 and the other an RV042G, and there is an IPSec tunnel between the two.
    Windows file sharing works between these two over the tunnel.
    I have a laptop with QuickVPN Client which I use to connect to either site.
    If I connect to the RV042G site, file sharing works fine.
    If I connect to the RV042 site, I can't get file sharing to work.
    As far as I can see, both routers are set the same.
    Can anyone help here?
    Thanks in advance.

    Good morning
    Hi Dominic, thanks for using our forum, my name is Johnnatan and I am part of the Small business Support community. You´d better don´t turn off your Windows Firewall, you have just to configure it, you can do it follow these steps:
    https://supportforums.cisco.com/docs/DOC-29399
    I hope you find this answer useful,
    “Please rate useful posts so other users can benefit from it”
    Greetings,
    Johnnatan Rodriguez Miranda.
    Cisco Network Support Engineer.

  • Song-Radio doesn't work over different (Spotify Connect) devices at same time (anymore)

    In current Versions of the Clients (Android, Windows, Spotify Connect Device (Yamaha CD-N301)) the Song-Radio function doesn't sync the Song-Radio List* (not the playlist!) correct over different devices. For example, if I start a Song-Radio on Android, the correct screen is shown on my Android Device, but in the Windows Client, I see only "a normal playlist" without the thump up/down buttons, but with the (in Radio-Modus not allowed) back button. In the other direction (starting Song-Radio in Windows and look it on Android) it also do not work. It's possible a bug - not only that it worked in older Versions - starting a Song-Radio on Windows with a Spotify Connect Device currently being the speaker (Android or Yamaha CD-N301) results in a "working" Radio Screen in Windows, but the current playing Song isn't that shown on the Radio Screen, but the Speaker Symbol on the Song in front is shown! (see attached screenshot)Starting the Song-Radio in Windows with Windows is the Speaker works. It looks like that it works also when it's switched to another device as speaker after the Song-Radio was started with Windows as the Speaker. Starting the Song-Radio in Android Device shows the correct Song on all devices - even with other devices as the speaker - but it's not shown as Radio on Windows. Possible it's just a problem with the Windows Client - but without more devices to test, I couldn't say, and when starting the post, I noticed it while listening to my Yamaha CD-N301. *: The Radio Screen where I'm able to see the current and last played songs and where I'm allowed to like/unlike (thumb up/down) the current song, and where I'm also only allowed to forward to the next song - not go back to the last ones, so the backward arrow is missing. Well, you possible know what screen I mean - it's that one called Radio :D

    emeres wrote:
    schizo-ri wrote:When I try to pair it shows it failed. Is this normal, it doesnt have to be paired? In Gnome bluetooth settings it also shows DS3 as connected but not paired.
    Wiki wrote:Now you will need to pair it with bluez.
    Are there any additional messages in dmesg or journalctl?
    Yes, from journalctl:
    bluetoothd[267]: No agent available for request type 0
    bluetoothd[267]: device_request_pin: Operation not permitted
    emeres wrote:
    Wiki wrote: Next time you hit the Playstation button it will connect without asking anything else.
     Does it do that?
    Yes, it connects.
    kernel: input: PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:12.0/usb3/3-4/3-4:1.0/bluetooth/hci0/hci0:3/0005:054C:0268.0006/input/input17
    kernel: sony 0005:054C:0268.0006: input,hidraw1: BLUETOOTH HID v1.00 Joystick [PLAYSTATION(R)3 Controller] on 00:15:83:15:a3:10
    bluetoothd[267]: sixaxis: compatible device connected: PLAYSTATION(R)3 Controller (054C:0268)
    upowerd[501]: (upowerd:501): UPower-Linux-WARNING **: no valid voltage value found for device /sys/devices/pci0000:00/0000:00:12.0/usb3/3-4/3-4:1.0/bluetooth/hci0/hci0:3/0005:054C:0268.0006/power_supply/sony_controller_battery_00:24:33:54:94:fb, assuming 10V

  • IPhone 3G - email works in wifi; doesn't work over 3G or Edge

    Anyone else experienced this problem? Since the middle of this past week, my iPhone 3G cannot send or receive email from my POP account over the 3G or EDGE network. It works fine over WiFi however.
    I took it to the Apple Store where they were able to reproduce the problem, but could not figure it out and promptly replaced the phone. The new phone has the same issue, which leads me to believe it must either be the network or my AT&T account.

    I'm having the same exact problem. I am on my second phone now. Both phones worked originally and now it stopped working again.
    Any solutions would be great.

  • HP Laserjet p1505n doesn't work over network with Yosemite

    Ever since upgrading the machines in my house (Mac Pro, iMac, MBPretina, MBAir) to Yosemite, I have not been able to use the network attached Laserjet p1505n that used to work flawlessly under 10.9.  It doesn't appear in the printer tab in System Prefs where it used to pop up.  Anyone have any experience with this?  The printer will install via USB just fine on the Mac Pro, MBPRetina, etc.  Thanks!

    To see the printer in the Default view of the Add printer window, a protocol called Bonjour is used by the printer and Mac. This protocol is having issues for some users who have upgraded to Yosemite. Until the issue is resolved you may be able to use one of the IP protocols to connect to the networked printer. To do so you will need to find the IP address being used by the printer. If the LJ-P1505n has a control panel, you may be able to generate a report showing the network settings.
    Once you have the IP address you can open Printers & Scanners and click the plus button to add a printer. Then click on the IP icon and enter the IP address of the HP in the Address Field. In the Protocol field, change to HP Jetdirect-Socket and in the Queue field, leave this blank. You can then change the Name from the IP address to LJP1505n and in the Use menu, select the P1505n printer. Click the Add to complete the printer creation and then see if you can print.

  • Firefox update won't work, re-install doesn't work, safe mode doesn't work, Not firewall / virus software

    I had Firefox v 16 or 17 on windows 7
    A few weeks ago it told me to update, I did, and then it wouldn't load when I clicked on the icon
    I used system recovery to get back to the prior version. I just ignored the "update firefox" messages for a while.
    I decided to try to fix the problem and completely un-install firefox (all bookmarks, etc), re-install the newest version, and now again it won't load when I click on the icon.
    (((And i have no system restore points that still have firefox)))
    In the task manager firefox.exe *32 shows up for about 30 seconds after I click on the icon
    I've un-installed, re-installed 10 times with no luck
    I tried entering firefox in safemode (both by pressing F8 in system startup and also by holding shift down while I click on the desktop icon).
    I've tried using chrome (which loads but freezes) and opera (which won't even install)
    IE works
    I have allowed firefox through the firewall, allowed all permissions for my user, and turned off my virus software entirely
    I searched for the firefox profiles folder but did not locate it (It must have been deleted with my bookmarks, etc)
    I scanned my computer using the microsoft security scanner suggested by mozilla, located 5 infected files, deleted those files, un-installed and re-installed firefox and still nothing
    I have turned off everything in the task manager that appears to be non-essential. I've googled the things that have no description and found they are essential.
    Am I doomed to a lifetime of IE?

    Certain Firefox problems can be solved by performing a '''''Clean reinstall'''''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!

  • Pixma MG6200 scanner doesn't work over wifi

    Hi I'm on a Mac Book Pro OS X 10.8.5.
    I'm WIFIed to my MG6200 printer scanner and can print, but can't scan. When I try, I get..
    Printer is in use or an error has occurred. Check status.
    Scanner reported an error
    I've tried trashing and rechoosing the printer/scanner and that doesn't help.
    What can you suggest?
    Thanks,
    Ty Ford
    Solved!
    Go to Solution.

    Hi TyFord,
    We can reset the printer system on your computer, then reinstall the printer using the latest drivers from the Canon USA website to see if this will resolve the issue.  To reset the printer system, please follow these steps:
    1. Go to your Apple icon on the upper left corner of your screen.
    2. Click System Preferences.
    3. Click Print & Fax
    4. Right click your printer on the left and select "Reset printer system". Note: If right click does not work, press and hold the
    control key on your keyboard and then click the mouse button.
    5. If your printer is still listed on the left select your printer and then click the minus (-) button to delete it.
    6. Restart your Mac.
    Next, please click here to go to the Drivers and Software page for the PIXMA MG6220. Once on the initial download page for your model, please do the following:
    1. Verify that the operating system detected in the "OPERATING SYSTEM" drop-down menu is correct, and if it is not, please click the drop-down menu to select your operating system.
    2. Next, please click on the red arrow next to the "RECOMMENDED DOWNLOADS" section and click the MINI MASTER SETUP file. When you do, a red DOWNLOAD button will appear. Please click on the checkbox below the DOWNLOAD button, then click the red DOWNLOAD button to begin the download. The time for the download process may vary depending on the speed of your Internet connection and the size of the file being downloaded.
    Once you have downloaded the Mini Master Setup file, please follow the steps above to also download the ICA drivers from the DRIVERS section, and the MP Navigator program from the Recommended Downloads section. 
    Once all items are downloaded, please double-click on each of the items to install them on your Mac, then attempt to scan.  Should you still experience difficulty, please call or email us using one of the methods on the Contact Us page for further assistance.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • Lexmark x4650 doesn't work over wifi

    I recently bought a Lexmark x4650 wireless printer. I followed the install instructions that it came with it then updated the software, but my Mac just doesn't recognize it wirelessly, but it prints fine when connected via USB. My Linux laptop can print over the wifi no problem, so it's not the printer.

    I would expect that with the Linux laptop you would have needed to create a TCP/IP network queue rather than relying on some form of network discovery. I suggest that you could use the same technique on the Mac.
    When adding the printer, select the IP icon and then select LPD or HP Jetdirect for the protocol. You can then enter IP address of the printer and the respective driver in the Print Using menu.
    If this new queue fails to print, open Network Utility and use the Ping function to check that the Mac can get a response from the Lexmark.

  • Kinect application doesn't work over remote desktop but it works over TeamViewer

    I have a use case where I need to use Kinect attached to a remote computer.
    I tried to run an app on the remote computer via RDP but It turns out that it's not possible.
    FPS drops to 0 (I get no data), for few seconds (LEDs on kinect device disappear) and then after few seconds kinect restarts to work for next few seconds (I can see LEDs on the device again). After few seconds that history repeats over and over (LEDs disappear,
    I get no data from device....).
    It's reproducible with all types of applications (WPF, DirectX, WinRT). I use RDP between two laptops with Windows 8.1.
    However, everything is ok when I connect to the remote computer using TeamViewer.
    Do you have any solution to that? If needed I'll be happy to provide you with more info on that problem.

    See known issues and troubleshooting guide on remote desktop:
    https://msdn.microsoft.com/en-us/library/dn758677.aspx
    https://social.msdn.microsoft.com/Forums/en-US/20dbadae-dcee-406a-b66f-a182d76cea3b/troubleshooting-and-common-issues-guide?forum=kinectv2sdk
    You must disable audio remoting to ensure the audio data is running through Kinect runtime on the host machine.
    Carmine Sirignano - MSFT

  • Image Capture doesn't work over WiFi

    I've got an HP Printer connected via USB to an AirPort Express. I can print to it without any problems. However, if I open the Image Capture app native to OS X it doesn't show the printer, so I can't scan documents. Is there any way to get Image Capture (or any other app which from which I can scan) to recognize the printer when it's connected via the AirPort Express?
    Thanks

    Is there any way to get Image Capture (or any other app which from which I can scan) to recognize the printer when it's connected via the AirPort Express?
    Sorry, but no. Printers connected to the AirPort's USB port are supported only for printing. Advanced printer functions like copying, faxing, or scanning (as in this case) are not supported.

Maybe you are looking for