rogeliog
rogeliog

Reputation: 3692

Integrate Jersey with RMI

I have a Java Jersey project, where I am running an application. On the other hand I have a project were there is a RMI application how can I put this two to work together. In other words how can I intergrate RMI/IIOP into a Jersey application.

I was thinking of something like this:

@Path("/items")
public class ItemsResource {
    @Context
    UriInfo uriInfo;
    @Context
    Request request;
        Stuber s = new Stuber();


    @GET
    public Response get() throws RemoteException {
        }

Were I have an external class in the Jersey Project that will work as a client to connect with the RMI/IIOP

public class Stuber {
    Context ic;
    iRemoteLogic logic;

    public Stuber() {
        super();

        Object objref;


            try {
                ic = new InitialContext();

                objref = ic.lookup("LogicService");
                System.out.println("Client: Obtained a ref. to Hello server.");

                logic = (iRemoteLogic) PortableRemoteObject.narrow(
                        objref, iRemoteLogic.class);

What should I add to the Stuber class to be able to work as an RMI/IIOP client?

Thanks :)

NOTE: I followed this tutorial for the RMI/IIOP

Upvotes: 0

Views: 326

Answers (1)

user207421
user207421

Reputation: 310860

You would need to provide somewhere an implementation of iRemoteService that is exported via RMI/IIOP (i.e. PortableRemoteObject), and register it via JNDI as LogicService. I doubt the latter is going to work: surely you will need to provide a protocol and host to JNDI.

Upvotes: 1

Related Questions