Accessing 1 application from another on the UNIX Server ?


Web tier: servlets, JSP, Web frameworks: Accessing 1 application from another on the UNIX Server ?

  1. Hi !
      I have a unique problem. I have 2 J2EE applications running on a UNIX server. I have a link in application A(on port 7001), which opens a window in application B(running on port 7002).
      When I click on the link to open application B, I have the whole URL for application B as

       In the servlet of application B, when I try to get the port number for application B as request.getServerPort(), I get the port number of the application that invoked the application i e 7001. As a result when I try to display the next page, I get an error. How do I get the port number 7002 which is already available in the URL ? Is there any way to get the port number from the URL other than hardcoding the port number ?

    Any help is greatly appreciated.

    Thanks in advance,
  2. Sounds like this is a problem with your server's set up. Without knowing this setup, I can only speculate.

    Maybee this speculation will help:
    Are these two J2EE applications running in the same servlet container? If so, it'd be logical that your servlet container is set up to field requests on a single port, in your case 7001. This means the web server could listen on ports 7001 & 7002, but send all servlet processing requests to the servlet container through a proxy. Meaning, requests for port 7002 are proxied to port 7001, thus you will have this problem.