Jbuilder8+weblogic7+oracle9i下EJB的BMP客户端测试的问题!
急!!!!!我按<<CSDN_文档中心_Jbuilder8开发J2ee学习笔记>>做一个BMP的例子,部署完后,用Jbuilder中的标准客户端测试时,出现这样的错误:javax.naming.CommunicationException. Root exception is java.net.ConnectException: t3://billgates:7001: Destination unreachable; nested exception is:
java.net.ConnectException: Connection refused: connect; No available router to destination
......
客户端的类名为BMPBEANTestClient.java,以下是部分代码:
private BMPBEANHome bMPBEANHome = null;
private BMPBEAN bMPBEAN = null;
public BMPBEANTestClient() {
initialize();
}
public void initialize() {
long startTime = 0;
if (logging) {
log("Initializing bean access.");
startTime = System.currentTimeMillis();
}
try {
Context context = getInitialContext();
//look up jndi name
Object ref = context.lookup("BMPBEANRemote");
//look up jndi name and cast to Home interface
bMPBEANHome = (BMPBEANHome) PortableRemoteObject.narrow(ref, BMPBEANHome.class);
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded initializing local bean access through Local Home interface.");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e) {
if (logging) {
log("Failed initializing bean access.");
}
e.printStackTrace();
}
}
private Context getInitialContext() throws Exception {
//是不是这里错了呢????
String url = "t3://billgates:7001";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
}
return new InitialContext(properties);
}
catch(Exception e) {
log("Unable to connect to WebLogic server at " + url);
log("Please make sure that the server is running.");
throw e;
}
}