What is the main method client code for loacl interface in EJB?
rameshmca rk
Greenhorn
Joined: Jan 27, 2007
Posts: 17
posted
0
Hi, Is it possible to create EJB and make look up in the same machine?How?Could you give me the sample code?
Thanks and regards, Ramesh RK
Dale DeMott
Ranch Hand
Joined: Nov 02, 2000
Posts: 514
posted
0
Are you talking about having an EJB call itself. If so, yes. As for how, I'm working on that now. I'm working on having an EJB basically call itself in order to enclose a transaction. I'm not done w/it yet though.
By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Originally posted by rameshmca rk: Is it possible to create EJB and make look up in the same machine?
You mean you want to lookup a bean(deployed in a JVM) from a client which resides in the same JVM? That's what local interfaces are meant for. As far as the code is concerned, it would be the same as the one you would use to lookup a remote bean - only the jndi name needs to be changed to the name at which the localhome is bound.
thank you jaikiran, you have said a bean can call itself.How can we look up localhome using JNDI name inside the main method client?Could you give me the complete code for look up with property setting?
Thanks and regards, Ramesh RK
Sumit Malik
Ranch Hand
Joined: Jan 05, 2007
Posts: 84
posted
0
Hi Rameshmca Rk,
I hope this code snippet would help you up for calling local interface from JBOSS AS
See there are two ways for jndi setting. You can put jndi.properties file in you classpath or you can hard code jndi values in code. First approach is the good practice and easier to maintain code values.
If you have deployed your bean on other Application server other Jboss then you need to pass those interface values and context factory setting while doing jndi lookup.
I hope above code would give you more insight for calling ejb...
Cheers !!! Sumit Malik
If at first you don't succeed, don't try skydiving
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: What is the main method client code for loacl interface in EJB?