File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and Other Java EE Technologies and the fly likes EJBand RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "EJBand RMI" Watch "EJBand RMI" New topic
Author

EJBand RMI

Opincaru Cristian
Greenhorn

Joined: Oct 30, 2001
Posts: 1
Hi
I want to build an EJB that solves equations.
For this, the client sends to the ejb component the rmi adress of a class that implements the equation logic.
My problem is that if the client and the ejb server are on different machines the server needs to have the stub class in the CLASSPATH. This is inconvenient for the client because he has to upload the stub on the server every time he wants to solve a new equation.
Is there a way that the client can call the EJB without uploading on the server the stub class ? I tryied serialization but it did not work out.

I have defined the following interface:
public interface Function extends java.rmi.Remote {
public float getX(float x);
}
An implementation of this interface is this:
public class ClientFunction extends UnicastRemoteObject implements Function {
private Registry reg = null;
private String name = null;

public ClientFunction (Registry reg, String name) throws Exception {
super ();

this.reg = reg;
this.name = name;

reg.rebind (name, this);
}

public float getX(float x) {
return x*x;
}
public void unbind () throws Exception {
reg.unbind (name);
}
}
The ejb component create method has the following code:
public void ejbCreate(String lookupString) throws CreateException,ODEException {
try {
f= (Function) Naming.lookup(lookupString);
} catch (Exception e)
{
e.printStackTrace();
throw new ODEException("Can't find "+lookupString);
}
}
I thank big to the one that helps me with this
Cristi
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3878
In general, no there's no easy way to do this. Now, it sounds to me like you might want to look into something like using the SOAP protocol and creating messages from the client "on the fly" to different SOAP servers for the different equation solvers...
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
 
subject: EJBand RMI
 
Threads others viewed
Exception: Connection refused to host
RMI pass by value or by reference ?
RMI sever setup problem
need help. I have problems running the client
Problem with Testing my RMI BusinessLogic with more than 200 Threads
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture