Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

about calling EJB from delphi

Status
Not open for further replies.

IPOz

Programmer
Jul 11, 2001
109
CN
hi,friends
I have used delphi for a long time.Now i wnat to reuse the EJB running in jboss
( or apusic( from delphi.
I have imported the com-bridge(ess/j2eecas/download-com-bridge.html)
into delphi 5 successfully and delphi can call local java class as below:

procedure TForm1.methodClick(Sender: TObject);
var
theTime : OleVariant;
begin
theTime := JavaServices1.JavaNew('java.util.Date');
showMessage(theTime.toString);
end;

procedure TForm1.staticMethodClick(Sender: TObject);
var
SystemStatics : OleVariant;
begin
SystemStatics := JavaServices1.GetJavaStaticsFor('java.lang.System');
showMessage(SystemStatics.currentTimeMillis);
end;

However i encountered problem when calling EJB.No matter what EJB container(i ha
ve tested jboss and apusic).The following is a code snippet:
procedure TForm1.ejbClick(Sender: TObject);
var
home : OleVariant;
bean : OleVariant;
begin
JvmControl1.Classpath :=
'd:\allen\cas\ejb\build\bankClient.jar;' +
'd:\allen\cas\ejb\lib\apusic.jar';

JvmControl1.StartJvm;
apusic.ProviderURL := 'rmi://192.168.1.118:6888';
{
apusic.SecurityPrincipal := 'peter';
apusic.SecurityCredentials := 'peter';
}
home := apusic.LookupEjbHome(
'ejb/BankBean',
'com.kf.ejb.interfaces.BankHome');
showMessage('Found bank home');

bean := home.create(); <=========error here !!!!!!
showMessage('Created Bank');
showMessage(bean.getXml());
bean.remove();
showMessage('ok');
end;
It seems the home object returned by com-bridge can NOT be resolved by delphi.Bu
t the VB can do it very well :(

Any suggestion is appreciated !

BTW,you can download the corresponding com-bridge service dll from apusic and ht
tp://laurent.etiemble.free.fr/combridge/ ipo_z@cmmail.com
Garbage in,Garbage out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top