Hashtable prop = new Hashtable();
prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
prop.put(Context.PROVIDER_URL, "corbaloc:iiop:10.39.100.250:2809");
InitialContext it = new InitialContext(prop);
String jdni = "Session/DateProcess";
System.out.println("..........call ejb......");
Object object = it.lookup(jdni);
com.fly.test.ejb.DateProcessHome dpHome =
(com.fly.test.ejb.DateProcessHome) javax.rmi.PortableRemoteObject.narrow(object, com.fly.test.ejb.DateProcessHome.class);
com.fly.test.ejb.DateProcess dp = dpHome.create();
dp.process(1);
System.out.println("..........call ejb .....over.");
prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
prop.put(Context.PROVIDER_URL, "corbaloc:iiop:10.39.100.250:2809");
InitialContext it = new InitialContext(prop);
String jdni = "Session/DateProcess";
System.out.println("..........call ejb......");
Object object = it.lookup(jdni);
com.fly.test.ejb.DateProcessHome dpHome =
(com.fly.test.ejb.DateProcessHome) javax.rmi.PortableRemoteObject.narrow(object, com.fly.test.ejb.DateProcessHome.class);
com.fly.test.ejb.DateProcess dp = dpHome.create();
dp.process(1);
System.out.println("..........call ejb .....over.");
解决方案 »
- 救命啊,疯了!struts.xml都删了,还能找到action!!!
- 求帮忙看下代码为什么我的查询功能实现不了
- java中如何使用发射机制进行反射类中类
- 关于tomcat6.0自动关闭的问题
- 请教各位,在局域网内通过mac地址获得IP地址 怎么用java实现 在线等!不好意思,分不多
- 只剩下50分了:IO操作和算法分析,谢谢!
- weblogic设置实例个数的问题
- weblogic8.1,怎么把一个应用部署在根路径啊..
- java 环境变量配置
- 为什么tomcat不能正常关闭?但开机时会自己启动
- 大家好,有谁用过JEditorPane控件,为什么下面的html代码用JEditorPane显示不了?
- 已经做了10年JAVA的人肯定不如只做了3-5年JAVA的人,你认同吗?
private static Object lookupHome(java.util.Hashtable environment, String jndiName, Class narrowTo) throws javax.naming.NamingException {
// Obtain initial context
javax.naming.InitialContext initialContext = new javax.naming.InitialContext(environment);
try {
Object objRef = initialContext.lookup(jndiName);
// only narrow if necessary
if (narrowTo.isInstance(java.rmi.Remote.class))
return javax.rmi.PortableRemoteObject.narrow(objRef, narrowTo);
else
return objRef;
} finally {
initialContext.close();
}
}
这些都是myeclipse自动生成的.我调用这句时就出错了.