📄 baseclient.java
字号:
package com.learnweblogic.examples;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
public abstract class BaseClient {
private Context ctx;
private String url = "t3://localhost:7001";
protected Object narrow(Object o, Class c) {
return PortableRemoteObject.narrow(o, c);
}
protected Context getInitialContext() throws NamingException {
if (ctx == null) {
try {
Properties p = new Properties();
p.put(
Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, url);
ctx = new InitialContext(p);
} catch (NamingException ne) {
System.err.println(
"** Unable to connect to the server at:" + url);
ne.printStackTrace();
throw ne;
}
}
return ctx;
}
public BaseClient(String[] argv) {
if (argv.length > 0)
url = argv[0];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -