15. september 2004 - 10:18Der er
4 kommentarer og 1 løsning
JNDI or RMI
Hello!
I got a problem that I do not know how to solve in the easiest and best way.
I need to get access to a object in one application from an other application.
I got a webbapplication called main.ear running in a orionserver. In that app I got a object of a class CacheManager that needs to be cleared/emptyied sometimes.
But the object that are in charge of clearing that object is running in an other application called admin.ear but in the same orionserver.
So now is the question how to get some reference to objects between different applications? Is RMI the only and best way? Or is JNDI better? Perhaps some one could give a quick how to step by step for the best solution.
I think the most clean solution would be to have an EJB in main.ear that exposes a remote interface with an method to do it. Then the code in admin.ear can lookup that and call it.
It may not necesarrily be the most efficient solution. But it gives good separation. You do not assume anythimng about the two running on the same app server or anything about how the app server seperates different applications.
Correct me if I'm wrong, if I would use JNDI for this porpuse I guess that I MUST use a LDAP server as well? Or could I use JNDI for this with out a LDAP-server running?
I guess that I will use EJB any way but do you mean that if I register it in main.ear I can use it from admin.ear (the remote interface ) without any extra or do I have register it some whare in the admin.ear?
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.