Forums Register Login

What is the main method client code for loacl interface in EJB?

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 777 times.
Similar Threads
Solution for "NoInitialContextException" error in session bean's client
How can we use JNDI?
Looking Up JNDI name for home interface
EJB Terms.
Can we use crystal reports in java?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:06:20.