devsource360

How to make two distributed web apps talk using foreign JNDI concept.

This item was filled under [ MISC. ]


In the present day scenario, we often tend to use webservice for the client-server interaction in distributed environment.Nevertheless, the foreign jndi concept is often used wherever legacy system is involved.
NB: Wherever server is being talked about, you should assume it as WebLogic server.

A brief outline about JNDI : The Java Naming and Directory Interface (JNDI) is a Java API for a directory that allows Java software clients to discover and look up data and objects via a name. Like all Java APIs that interface with host systems, JNDI is independent of the underlying implementation. Additionally, it specifies a service provider interface (SPI) that allows directory service implementations to be plugged into the framework. The implementations
may make use of a server, a flat file, or a database; the choice is up
to the vendor.
The JNDI API is used by the Java RMI (Remote method invocation) and Java EE APIs to look up objects in a network.

Non-distributed scenario: In this scenario your client and server applications both run on the same server, but this is not often the case given the need of distributed web apps in present day scenario.Here, you just have to register your local JNDI with weblogic server JNDI tree.
You can use the same jndi name across your client and server application to refer the same.

e.g, if you want to register two local jndi’s that your app uses then do the following -

myjndiservice –

     |
     ——- jndiserviceA –first      local jndi
     ——- jndiserviceB –second local jndi

Create the local jndi’s as mentioned above and use it as fully qualified name from your jndi root.

Distributed scenario: 
In this scenario your client and server app reside in different server.You can’t really use the local jndi name in both the app as any jndi registered as local is local to one of the app and foriegn to the other. So, we have to have some kind of mapping to refer to  the remote jndi registered in a different server. WLS really comes handy in simplying the stuffs for you in this scenario. All you need to do is to register a local jndi to serverA, lets say where our server app is deployed
.
Lets say the name of this jndi is: myjndiservice/jndiserviceA

In serverB,where your client app is residing, you need to register a foreign jndi referring to the one in serverA. All you need to do is -

1.In serverB, register two foreign jndi’s with corresponding local jndi mapping and the url mapping of the serverA, like t3://foreignjndihost(serverA’s url):portno.
Make sure to provide the jndi context factory name, by default it is “weblogic.jndi.WLInitialContextFactory”, however you can provide your custom class too.Provide the username password for the foreign jndi host server also.

2.Provide the  foriegn jndi name mapping in your deployment descriptors, in this case in web.xml and weblogic-applications.xml

Now you are all set to use the local  reference of foreign jndi name in your client app, which will inturn resolve it to the foreign jndi refernce and will make the communication happen between the client and server app.






Rate this topic:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Popularity: 19 views
You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.


How to make two distributed web apps talk using foreign JNDI concept. Copyright: You should confirm all information about How to make two distributed web apps talk using foreign JNDI concept. full version edition(freeware/shareware) before downloading or relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators or key gen, cd key, hacks, dvd rip is illegal and prevent future development of How to make two distributed web apps talk using foreign JNDI concept. full version edition. Download links are directly from our publisher sites or from the link provided by users, torrent files or links from rapidshare.com, yousendit.com, megaupload.com, netload.in, storage.to or depositfiles.com are not allowed.