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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling EJB from delphi

Status
Not open for further replies.

IPOz

Programmer
Jul 11, 2001
109
CN
hi,friends
I have looked up ejb,running in jboss, home interface successfully from delphi.However it throws IllegalAccessException when calling the the home to create the session bean.The following is my codesnippet:
...
procedure TForm1.ejbClick(Sender: TObject);
var
home,bean : OleVariant;
begin
JvmControl1.Classpath := 'd:\jboss\client\jnp-client.jar;' +
'd:\jboss\client\jboss-client.jar;' +
'd:\jboss\client\jboss-j2ee.jar;' +
'd:\jboss\client\jaas.jar;' +
'd:\jboss\client\jbosssx-client.jar;' +
'd:\cas\test\stub\bank.jar' ;
JvmControl1.StartJvm;

JBossServices1.ProviderURL := 'jnp://192.168.1.118:1099';

home := JBossServices1.LookupEjbHome(
'bank/BankBean',
'com.kf.ejb.interfaces.BankHome');
showMessage('Found bank home'); <=== it is ok here

bean := home.create(); <=== error here :(
showMessage('Created Bank');
showMessage(bean.getXml());
bean.remove();
showMessage('ok');
end;
...

JBossServices1 can be obtained from
Any suggestion is appreciated ! ipo_z@cmmail.com
Garbage in,Garbage out
 
hi,

The creation of an olevariant works different.

Home := CreateOleObject('applicaton');

where application is the compobject which you want to create.

ex: Home := CreateOleObject('word.application')

which will create an instance of the program Word.

In this case i donn't know the object name to create.

Steph [bigglasses]
 
Sorry ! the home is <b>home interface</b> of an EJB componment.

regards! ipo_z@cmmail.com
Garbage in,Garbage out
 
It seems this is a difficult question.Let us put a breakpoint on line &quot;bean := home.create()&quot;.When the program stops at that line we press ctrl+alt+c to enter assembly window.The following is the code snippet:
...
push $0044c0e4
lea eax,[ebp-$10]
push eax
lea eax,[ebp-$40]
push eax
call VarDispProc ; raise error here
add esp,$0c
lea edx,[ebp-$40]
lea eax,[ebp-$20]
call @OleVarFromVar
...

So it should be delphi's problem.What can i do now ?
ipo_z@cmmail.com
Garbage in,Garbage out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top