• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJBand RMI

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic