JADE相关问题1

本文解决启动JADE远程平台时遇到的具体问题,包括如何正确启动rmiregistry.exe、配置classpath以包含必要的桩文件,以及解决未知主机问题。此外,还介绍了如何在Web应用程序中集成JADE Agent,通过示例代码展示了初始化过程及命令处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • 启动问题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

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值