forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.java
34 lines (23 loc) · 841 Bytes
/
Client.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package st.hello;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.naming.*;
import javax.ejb.*;
import javax.rmi.PortableRemoteObject;
public class Client {
private static final String JNDI_NAME = "st.hello";
public static void main(String[] args) throws Exception
{
String url = "t3://localhost:7001";
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
Context ctx = new InitialContext(h);
// Lookup the beans home using JNDI
Object home = ctx.lookup(JNDI_NAME);
HelloHome hellohome = (HelloHome) PortableRemoteObject.narrow(home,HelloHome.class);
Hello hello = hellohome.create();
System.out.println(hello.sayHello("Srikanth"));
}
}