Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 292085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:08:52+00:00 2026-05-12T06:08:52+00:00

I’d like to setup RMI to pass through port 80 on a java servlet..

  • 0

I’d like to setup RMI to pass through port 80 on a java servlet.. (To pass through the firewall)
I have a Tomcat server and i’m looking for the module that will catch the RMI http request and pass it to the RMI layer on the server machine.
I’ve read that RMI automatically handles this on it’s side.

Is there a step-by-step guide to this? Or just a war file to install on the server?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:08:53+00:00Added an answer on May 12, 2026 at 6:08 am

    We’ve done this on a production server, but it was a long time ago. There’s no war file to install as this is a pretty unusual thing to do, especially these days with AJAX and web-enabled apps and what-not. I wouldn’t recommend deploying RMI over the Internet for reasons of scalability and reliability. It’s great across LANs or even JVMs but on a wider-scale I’d consider a more conventional web service if possible.

    That aside, there’s a so-so guide here. It’s for Tomcat 3 but the concepts are still the same, and it mentions an integration with Apache which is quite redundant for Servlet use, so there’s chunks of it you can ignore if you’re already quite au fait with Tomcat.

    It will guide you through installing a servlet in Tomcat which will unpack an RMI request that’s piggy-backing on an HTTP Post, locate the local registry and complete the remote method call for you. It also provides a little demo server and client application to test your set up with.


    Edit in response to comments:

    I’ve found a servlet that will mimic /cgi-bin/java-rmi.cgi but to use it I have to direct all requests to /RMIServlet without letting the client know that it is being redirected. I googled a lot for this and tried numerous solution. All without success. What’s the best way to do this?

    I think this is done by providing a SocketFactory to RMI that forgoes the usual port 1099 route and piggybacks the request on an HTTP/Post instead.

    The socket factory itself is something like this: You can make it work with HTTPS just by changing the URL object.

    public class RMIHttpToCgiSocketFactory extends RMISocketFactory implements Serializable {
        public static final long serialVersionUID = 1L;
    
        public RMIHttpToCgiSocketFactory(){}
    
        public Socket createSocket( String s, int i ) throws IOException {
            // Whacked out indentation for StackOverflow! Hope you can read this.
            return new HttpsSendSocket( 
                s, 
                i,
                new URL(
                    "http", 
                    s, 
                    "/cgi-bin/java-rmi.cgi?forward="+i
                )
            );
        }
    
        public ServerSocket createServerSocket( int i ) {
            return null;
        }
    }
    

    Now you just need to tell your application to use this socket factory in its RMI dealings. In our codebase this is done on both the server and the client. On the server side when your RMI service is binding itself to the registry you can specify the client socket factory when export the object to get the Remote stub.

    RMIClientSocketFactory clientSocketFactory = new RMIHttpToCgiSocketFactory();
    Remote stub = UnicastRemoteObject.exportObject( 
        server, 
        port, 
        clientSocketFactory, 
        RMISocketFactory.getDefaultSocketFactory() 
    );
    

    And on the client you can specify the socket factory when finding the registry.

    Registry registry = LocateRegistry.getRegistry(
        loginHostName, 
        portNumber, 
        new RMIHttpToCgiSocketFactory()
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have two tables with like below codes: Table: Accounts id | username |
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.