This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Remote client Vs Local Client

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

What is actual differnce between a local client and Remote Client and what is the reason we have two differnt types of Local home and Remote Home Interface . Is Local client means that the Local EJB is installed in the same jvm or same machine where the client reside . I want to clear my doubts in real world .

Thanks in Advance.
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Local Client means the client that is going to access the EJB deployed on same machine as client and same JVM. To create Local EJBs, EJB spec has provided EJBLocalHome and EJBLocalObject interfaces. Local client was required due to the performance issues, so that if client and EJB reside on same machine then instead of going over the network, the container can find it locally. Say you have two EJBs which uses each other frequently, so you do the analysis and found out that if you make them local to each other then it will help improve the performance, so you can make them local.

Whereas in case of Remote client, the client doesn't know whether the EJB is deployed on same machine or on some other machine, Container will go over the network and access the EJB using RMI/IIOP which will degrade performance in some cases.
 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ali for your reply. i understand now better.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have been using the application client container in Glassfish to communicate with the beans.

I tried to write a JNDI client to communicate with the beans, so that the client can be placed in any desktop in the network. When I try to fill the properties of the InitialContext, I had errors.

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial



The following mandatory properties are filled.


It would be good to find the jndi.properties of the Glassfish server and write the same in these properties. But there was no jndi.properties in Glassfish.

Or, could the application server documentation mention the properties (except the hostname of the server).

Your help would be very useful.

Thanks,
Rajesh
 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,

I managed to come out of NoInitialContextException, by specifying the Provider URL and the jndi name as part of the lookup.


I followed the server documentation
Sun Java System Application Server Documentation

However, I get different exception and the call has not reached the server.

javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]



Please help!

Rajesh
 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have managed to move up, but yet to reach the bean. The problem was that the Context factory was wrong. I am using Glassfish 9.1 Update 2 and used the ldap factory com.sun.jndi.ldap.LdapCtxFactory and the Context.PROVIDER_URL,"ldap://localhost:389/o=myObjects" as mentioned Sun System Application Server 9.1 Admin guide

I get an exception
javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: co
nnect]

Do I have to run any LDAP server. If yes, how to. The JNDI name is visible in the log of the server and in the Admin Console. But having problems to reach the jndi naming service from the remote client.

Could you help me in this regard.

Regards,
Rajesh


 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ali Gohar's answer is not 100 % correct.

According to the spec, A Client to an EJB in same JVM is not must be a local client. Spec only says A local Client means a client in Same JVM + Same Application.

For a example glass fish treat a client in different application in same jvm as a remote client, while jboss treat as a local client.

Regards,
Cham
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rajesh, why don't you start your own thread instead of hijacking this one ?
 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I got it working and wish to publish it, so that anyone who has this problem can get it sorted easily.

This thread was useful
http://forums.java.net/jive/thread.jspa?messageID=225734𷇆

The problem was that the application server's client jar was file was not present in my remote client. Application servers have a client jar file, that is intended for use of client applications of the Appserver.

For Glassfish 9.1 update 2, it is appserv-rt.jar. If our client make use of the packages such as the context factory implementation, we have to embed the jar that has this implementation. As soon as i entered the jar, the context factory implementation (com.sun.enterprise.naming.SerialInitContextFactory) was found and the 'irritating' error of NameNotFoundException or NoInitialContextException were sorted.

Besides, it is possible to specify just the no-args construction of InitalContext and the jar is capable of using its preferred ContextFactory.

Good luck!

Christophe, i shall use separate threads for my questions. My intention was to reuse the thread that was related. I have posted this answer to avoid leaving my query open. Sorry!

Regards,
Rajesh
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic