我把客户端程序改做下面这样,但还是不知道怎样才能调用两台不同机子的ejb1,ejb2,
p.setProperty("java.naming.provider.url", "t3://210.80.197.105:7001");只能写一个IP呀???要怎么改变?package demo1;import javax.naming.*;
import java.util.Properties;
import javax.rmi.*;
import javax.ejb.*;
public class Enterprise1TestClient3 extends Object {
public static void main(String[] args)
{
try
{
Properties p=new Properties(
p.setProperty("java.naming.factory.initial", "weblogic.jndi.TengahInitialContextFactory");
p.setProperty("java.naming.provider.url", "t3://210.80.197.105:7001");
InitialContext jndiContext = new InitialContext(p);
System.out.println("Got context"); // Get a reference to the Interest Bean
Object ref = jndiContext.lookup("Enterprise1");
System.out.println("Got reference"); // Get a reference from this to the Bean's Home interface
Enterprise1Home home = (Enterprise1Home)
PortableRemoteObject.narrow(ref, Enterprise1Home.class); // Create an Hello object from the Home interface
Enterprise1 hello = home.create(); // call the hello() method
System.out.println(hello.helloworld("ddd"));
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
p.setProperty("java.naming.provider.url", "t3://210.80.197.105:7001");只能写一个IP呀???要怎么改变?package demo1;import javax.naming.*;
import java.util.Properties;
import javax.rmi.*;
import javax.ejb.*;
public class Enterprise1TestClient3 extends Object {
public static void main(String[] args)
{
try
{
Properties p=new Properties(
p.setProperty("java.naming.factory.initial", "weblogic.jndi.TengahInitialContextFactory");
p.setProperty("java.naming.provider.url", "t3://210.80.197.105:7001");
InitialContext jndiContext = new InitialContext(p);
System.out.println("Got context"); // Get a reference to the Interest Bean
Object ref = jndiContext.lookup("Enterprise1");
System.out.println("Got reference"); // Get a reference from this to the Bean's Home interface
Enterprise1Home home = (Enterprise1Home)
PortableRemoteObject.narrow(ref, Enterprise1Home.class); // Create an Hello object from the Home interface
Enterprise1 hello = home.create(); // call the hello() method
System.out.println(hello.helloworld("ddd"));
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
解决方案 »
- 能不能不通过submit就将HTML中的数据传送到servlet?
- Diplaytag1.2 中为什么用decorator的动态链接报错
- 动态生成tree
- struts2 radio标签
- struts2 环境配置问题求助
- java里list map怎么用呢?
- ibatis 多对多配置问题出错,帮忙看看
- java后台将jfreechart生成的图片如何插入到现有的word模版中
- 如何用Java生成这样的XML文件???其中有一句我加不进去
- 哪儿有下栽 包:com.sun.image.codec.jpeg 的地方。急!!!
- 请介绍几本关于servlet的经典书! 谢谢
- 请问哪里有《JAVA AND XML》这本书的电子档,我在成都找遍了书店都没有这本书!!
只能在一个程序中调用两台机子的EJB的.
要调用两个IP的EJB,要怎么改?
Properties p=new Properties();
p.setProperty("java.naming.factory.initial", "weblogic.jndi.TengahInitialContextFactory");
p.setProperty("java.naming.provider.url", "t3://211.80.197.105:7001");
怎么把不同机器上的EJB绑定到同一个JNDI服务器?
你说的JNDI服务器是指weblogic上的管理服务器吗?