client for ctx lookup

This commit is contained in:
2015-05-19 00:28:59 +02:00
parent c35765e5dc
commit dac5744617
4 changed files with 67 additions and 3 deletions

45
test3_client/client.java Normal file
View File

@@ -0,0 +1,45 @@
package test3_client;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import test3_persistence.store_class_remote_interface;
/**
* Created by Giovanni on 17/05/2015.
*/
public class client {
public static void main (String[] args) {
Properties props=new Properties();
/*
props.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
props.put("java.naming.provider.url","iiop://localhost:3700");
*/
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
props.setProperty(Context.PROVIDER_URL, "corbaname:iiop:localhost:3700");
Context ctx = null;
try {
ctx =new InitialContext(props);
} catch (NamingException e) {
e.printStackTrace();
}
Object foo = null;
try {
foo = ctx.lookup("java:/global/web/store_class!test3_persistence.store_class_remote_interface");
} catch (NamingException e) {
e.printStackTrace();
}
}
}