0 Replies Latest reply on Feb 23, 2007 7:42 AM by Bastian Schneller

    JBoss send Email with external IP -- Firewall Problem

    Bastian Schneller Newbie

      Hi dear Community,

      My name is Bastian and I have a strange problem with my application. I setup JBoss on a japanese server. One server for the JBoss itself (192.168.0.60) and another server with a database(192.168.0.61). These two servers where behind a firewall which opend port 80 for incoming HTTP requests.
      The JBoss is connected to the Apache with mod_jk.
      Everything works fine. I can call the portal from outside in my office in Europe
      and from inside the server as well. Normally I choose the database server to test if everything works fine. I connect via RemoteDesktop to the japanese server.
      My Application has a resend password funktion, that call the java:/mail (mail-service.xml) funktion in JBoss to connect to an external mailserver also located in japan. And here I get my problem, when I resend the email from the inside database server or the JBoss server itself via a browser, JBoss connects to the email server an I receive a email.

      There he send the email when started from inside the firewall.

      java.exe:4660 TCP pcom01:2466 g101.secure.ne.jp:imap ESTABLISHED
      java.exe:4660 TCP pcom01:2467 g101.secure.ne.jp:587 ESTABLISHED


      If I do that from my browser in europe or usa, I get a refused connection error in the JBoss console.

      Here he tries to connect to himself (with -Djava.rmi.server.hostname=192.168.0.60) but witout this string too..:/

      java.exe:4660 TCP (src)pcom01:2542 (rmt)pcom01:http SYN_SENT


      I have done some research about that behaviour here in the forum and the wiki for quite a week now. The most issues I found were about firewall problems with java clients, they can't connect because the ports for RMI or so where not open.
      Also the wiki article about JBoss behind a firewall does not seem to match to my problem.
      I used TCPview to see what is going on at that moment JBoss received my request.
      If JBoss receive the request to send the email from inside his subnet, he open the connection directly to the mailserver. When I try this from my office or some other machine via internet TCPview shows me that JBoss tries to connect to himself using the external ip from the firewall. But JBoss cannot know the external IP by himself because he cannot connect to the external IP from inside. So I think JBoss takes the client remote address and replaces its own with it.

      I tried to change the bind port of JBoss and the Java:/Mail without success.
      I tried a guide in an article from this forum where to change the settings in the hosts file, but didn't worked too :|

      I know when I make the external IP from the firewall visible for JBoss, the problem would disapper, but this is an unprofessional way my administration team told me.
      Is there any way that I can tell JBoss not to replace it's IP with the one from the client who is doing the request?

      I am using JBoss 4.0.3 and he runs on a W2k3 Standard Edition.
      Please don't punish me if have forgot a important thing to tell, but I think thats all I can say for now.

      Thanks for any help
      Bastian