Avatar billede fredand Forsker
15. september 2004 - 10:18 Der 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.

My guess is JNDI but it looks quit difficult.


Best regards
Fredrik
Avatar billede arne_v Ekspert
15. september 2004 - 10:24 #1
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.
Avatar billede fredand Forsker
15. september 2004 - 12:31 #2
I think I understand.

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?

BTW give a svar so I can reward you ;-)

Fredrik
Avatar billede arne_v Ekspert
15. september 2004 - 12:35 #3
Remote interfaces are always looked up via JNDI.

Support for JNDI is mandatory for app-servers.

The deployment of an EJB includes definition of it for JNDI lookup.

JNDI is purely an interface. The app-servers may use whatever they want to
implement it. I belive that LDAP servers are used by some app-servers.

But usually that is completely invisible both to the EJB being deployed
and to the code using that EJB.
Avatar billede fredand Forsker
15. september 2004 - 12:40 #4
Okey!

Thanks mate!

Do not forget the svar so I can give you the points!

/Fredrik
Avatar billede arne_v Ekspert
15. september 2004 - 12:45 #5
svar
Avatar billede Ny bruger Nybegynder

Din løsning...

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.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester