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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:52:26+00:00 2026-06-11T04:52:26+00:00

in my application the follwoing code is used. Can some one give a detailed

  • 0

in my application the follwoing code is used. Can some one give a detailed explanation for the code that is highlighted?

I understood that in first highlighted block java reflection is used in invoking the method handle_validation..but need the detailed explanation.

Then in second highlighted block RemoteException is thrown..

My exact question is why they used reflection to call EngineHandlerIF and then why they are using RMI in this EngineHandlerIF to invoke the definition of method in EngineHandler?

private static EngineHandlerIF init() {
        ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "validation.xml" });
        String[] beans = ctx.getBeanDefinitionNames();
        for (String string : beans) {
            logger.info(string);
        }
        EngineHandlerIF engine = (EngineHandlerIF) ctx.getBean("engine");
        return engine;
    }



private Object callEngineMethod(MiddlewareMessage mmsg) {
        Object resultObj;
        try {
            **String methodName = "handle_validation";
            Method method = EngineHandlerIF.class.getDeclaredMethod(methodName, MiddlewareMessage.class);
            method.setAccessible(true);
            resultObj = method.invoke(engine, new Object[] { mmsg });**
        } catch (Exception e) {
            logger.error("sendMessage Exception: ", e);
            return new Boolean(false);
        }
        return resultObj;
    }

EngineHandlerIF:
----------------
**public abstract String handle_validation(MiddlewareMessage mmsg) throws RemoteException;**

EngineHandler:
--------------
public String handle_validation(MiddlewareMessage mmsg) throws Exception {
//some code
    }
  • 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-06-11T04:52:28+00:00Added an answer on June 11, 2026 at 4:52 am

    I understood that in first highlighted block java reflection is used
    in invoking the method handle_validation..but need the detailed
    explanation.

    That’s pretty much it. The only other bit is the

     method.setAccessible(true);
    

    which makes the method accessible to the caller (e.g. from private to public), thus allowing you to call it. However the above method does appear to be public already. Perhaps this is some legacy following a refactor ?

    Note that this isn’t RMI (remote method invocation), but rather reflection. The only RMI I can see here is the handle_validation() method possibly throwing a RemoteException.

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

Sidebar

Related Questions

Up to this point, I have used the following code to restrict the application
In our Struts2-Spring application we are using the follwoing lines of code access the
The following code will log in my application to a server. That server will
I have created an ASP.net application with several aspx. Some of them are used
I've a JSP/Servlet Web App that consist of more than one servlet (and some
Can some one please assist me in this example of TabHost? The problem i
I had a code (lets suppose a simple chat application), I used Tcp with
I am writing a program that will eventually be used to have one child
I am writing some code to update an application by fetching new dlls from
Can someone give me some hints about how to combine bumblebee with requireJs ?

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.