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.
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.
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.
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: IDLmg.org/CosNaming/NamingContext/NotFound:1.0]
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
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.
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.
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
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.
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!