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 6838907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:39:14+00:00 2026-05-26T23:39:14+00:00

I have a Java web application I’m developing for a school project. There’s a

  • 0

I have a Java web application I’m developing for a school project. There’s a requirement to have the presentation tier (servlets/jsp) be deployed to one server and business logic be deployed to another.

I need a solution to connecting the 2 servers.

Currently I’ve researching RMI and Axis2.

I’m not able to get RMI successfully working. I’m following official tutorial and keep getting a security exception locally, and imagine that it will get worse when Tomcat is involved.

Axis2 seems like a good solution, but I will need time to ramp up on it.

My question is: there a simple way of connection 2 servers so that I can call my business layer? Maybe Tomcat has something built-in.

If RMI is the de-facto protocol and API I should use, is there any good tutorials on using RMI with Tomcat.

Servers that I’m using are both running Tomcat.

  • 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-26T23:39:15+00:00Added an answer on May 26, 2026 at 11:39 pm

    I ended up using RMI. Using this tutorial I got it working: http://sacrosanctblood.blogspot.com/2008/11/rmi-tutorial-rmi-and-tomcat.html . The key is: in the start up servlet you have to make sure that the Object that you are stubbing out is class scoped and not method scoped. Also, the Security manager code is not needed.

    Here’s the code for the startServer servlet that I’m using:

    public class startServer extends HttpServlet
    {
        public static boolean isRegistered = false;    
        public IRemote service = new RemoteImpl();
    
        @Override
        public void init(ServletConfig config) throws ServletException
        {
            super.init(config);        
            if (!isRegistered)
            {
                try
                {                
                    IRemote stub = (IRemote) UnicastRemoteObject.exportObject(service, 0);
                    Registry registry = LocateRegistry.createRegistry(9345);
                    registry.rebind(IRemote.serviceName, stub);
                    System.out.println("Remote service bound");
                    isRegistered = true;
                }
                catch (Exception e)
                {
                    System.err.println("Remote service exception:");
                    e.printStackTrace();
                }
            }
        }
    }
    

    And here’s the client code:

    public String getRemoteString()
    {
        String result = "";
        try
        {
            Registry registry = LocateRegistry.getRegistry(9345);            
            IRemote serv = (IRemote) registry.lookup(IRemote.serviceName);
    
            result = serv.executeRemote("Test");
        }
        catch (Exception e)
        {
            System.err.println("Remoteservice exception:");
            e.printStackTrace();
        }
    
        return result;
    }
    

    Currently it’s running all on the same server, but I’m sure that I can get the 2 working at a later time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing one web application project using java for education industry.In this Admin have
I have a web application (Java, Websphere, JSP) which allows co-workers to register visitors
I am developing a dynamic web project j2ee web application using eclipse. I have
I'm developing a web application using Java EE6 and JSF 2.0. I have a
I have a java web application that I am developing in Netbeans (and running
I have a Java web application at my work and I'd like simplify how
We have a java web service application that uses log4j to do logging. An
I have a Java based web-application using Java Server Faces and Facelets. I am
I have a Java-JSF Web Application on GlassFish, in which I want to use
I have a Java Web Start application. I specify the resource (jars, images, etc)

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.