2 Replies Latest reply on Mar 20, 2007 1:50 PM by pkles

    Invoke remote method without remote interface

    pkles

      Hi everybody,

      I've been struggling for the last 2 days trying to find out how to invoke a remote method of an EJB without having the remote interface on the client.

      For example, is it possible to do something like this?:

      Object obj = ctx.lookup("myEjb");
      obj.invoke(methodName,.....,....)

      Thanks a lot.

        • 1. Re: Invoke remote method without remote interface
          asack

           

          "pkles" wrote:
          Hi everybody,

          I've been struggling for the last 2 days trying to find out how to invoke a remote method of an EJB without having the remote interface on the client.

          For example, is it possible to do something like this?:

          Object obj = ctx.lookup("myEjb");
          obj.invoke(methodName,.....,....)

          Thanks a lot.


          My understanding is no. You never directly call a particular EJB instance but rather get access to a Proxy interface (local or remote) which allows the container to manage the invocation.

          Why do you want do this? Why not just define a remote interface?

          • 2. Re: Invoke remote method without remote interface
            pkles

            Of course the idea is to access the EJB through it's proxy but without having to know at compile time which EJB remote Interface I am going to use.

            The problem is that I don´t know at compile time the EJB that's gonna be remotely accessed. The program will know the EJB JNDI name and method name to be executed at runtime