• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBand RMI  RSS feed

Opincaru Cristian
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
throw new ODEException("Can't find "+lookupString);
I thank big to the one that helps me with this
Kyle Brown
Ranch Hand
Posts: 3892
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!