- 启动问题1
启动远程平台需要先启动jre下的rmiregistry.exe。注意oracle中也有个rmiregistry,若path中先后未设置正确,可能使用该rmiregistry,将无法注册
- 启动问题2
rmi需要使用sub,因此需要将带桩的jar文件(jade.jar)配到系统classpath中。否则rmiregistry.exe将无法找到该桩文件。
- 脱机启动问题3
v3.5 jade.Boot -detect-main false
- 启动问题 --- unknowhost
客户端主机名 必须对应一个正确的客户端IP
例如linux下配置主机/etc/sysconfig/networking/profiles/default/hosts文件中
xxx.xxx.x.x 主机名
- 在web中嵌入agent
public class MonitorServlet extends HttpServlet {
public void init() throws ServletException {
Properties prop = new Properties();
String path = this.getServletContext().getRealPath("/")+"/WEB-INF/webagent.properties";
try {
prop.load(path);
JadeGateway.init("com.lingtong.monitor.agent.WebAgent",prop); //非本机时需配置
} catch (IOException e) {
e.printStackTrace();
}
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
DetectCommand cmd = null;
...
cmd = new DetectCommand(agentId);
JadeGateway.execute(cmd,200000); //同步调用,可配超时
result =cmd.getResult();
...
}
}
class WebAgent extends GatewayAgent {
public void setup() {
....
super.setup(); //不可少
}
protected void processCommand(java.lang.Object obj) {
if (obj instanceof DetectCommand) {
....
}
}
----- webagent.properties(参见jade.core.Profile) --------
host=192.168.10.88
#port=1099
container-name=monitor