String CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
String CONNECT_URL = "127.0.0.1:4848";
try {
// jini
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL, CONNECT_URL); //Get a naming context
InitialContext ctx = new javax.naming.InitialContext(env); //Get a reference to the Interest Bean ejb-name
Object ref = ctx.lookup("HelloHome"); //Get a reference from this to the Bean"s Home interface
home = (HelloHome) PortableRemoteObject
.narrow(
ref,
HelloHome.class ); //Create an object from the Home interface
Hello hello = home.create();
System.out.println( hello.hello() );
hello.remove(); } catch (Exception ce) {
ce.printStackTrace();
}
另外,你的EJB的JNI name是hellohome?确定?
String CONNECT_URL = "127.0.0.1:4848";
try {
// jini
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL, CONNECT_URL); //Get a naming context
InitialContext ctx = new javax.naming.InitialContext(env); //Get a reference to the Interest Bean ejb-name
Object ref = ctx.lookup("HelloHome"); //Get a reference from this to the Bean"s Home interface
home = (HelloHome) PortableRemoteObject
.narrow(
ref,
HelloHome.class ); //Create an object from the Home interface
Hello hello = home.create();
System.out.println( hello.hello() );
hello.remove(); } catch (Exception ce) {
ce.printStackTrace();
}
另外,你的EJB的JNI name是hellohome?确定?
解决方案 »
- hibernate中的(组合)排序问题,望大虾们帮帮忙啊,谢谢了
- 如何用EJB3.0实现文件上传与下载
- 在hibernate中,我用DAO.findby找出一个A表的对象,是不是会连同找出他的子表?
- 我怎样才能用replace来实现把\转换成\\
- 求救
- EJB3.0 有那些工具可以支持开发
- 关于FlippingBook逼真flash翻页效果问题,如何自动翻页,急求!!!!!
- java开源项目OpenCRX中的Depot中的Legal Entities如何应用?
- Java能否访问OCX文件?怎样访问?
- 在JAVA中能否手动设置输出设备的分辨率(如打印机)?
- 请问J2EE高手,声明为static的类变量是否可为不同的连接用户所共享?
- 菜鸟疑问:JAVABEAN是怎么处理这个表单的,望高手门给小第指点一下!疑惑中。。。。
我使用http方式的,报没有这个协议
to: humanity(很健忘了)
我是使用sun的appserver部署的,应该使用什么参数啊?