`
MMSCAU
  • 浏览: 114317 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

JADE Agent works with JSP

    博客分类:
  • JADE
阅读更多

闲着就会想比较多的东西,弄比较多的东西。

 

JADE Agent ,忘记了是大三,还是大四的是否知道有这个东东。曾经开始HelloWorld,又中断了,很久,现在是死灰复燃?还是心血来潮? 此篇东西就如一个草稿,写给自己看。

 

index.jsp

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

 

<!-- 添加import -->

<%@ page import="jade.core.*" %>

<%@ page import="jade.wrapper.*" %>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

  <head>

 

 

    <title>My JSP 'index.jsp' starting page</title>

 

  </head>

 

  <body>

  <!-- 调用Jade程序包 -->

  <jsp:useBean id="jsp2agent" class="example.jsp.jsp2agent">

  <%

     try{

     String[] args={"-container"};

     jade.Boot.main(args);

 

     }

     catch(Exception ex){

     out.println(ex);

     }

  %>

  </jsp:useBean>

    将在此,以JavaBean方式使用Jade <br>

  </body>

</html>

 

Javabean:

 

 

package example.jsp;

 

import jade.core.AID;

import jade.core.Agent;

import jade.core.behaviours.CyclicBehaviour;

import jade.lang.acl.ACLMessage;

 

public class jsp2agent extends Agent{

    private ACLMessage msg;

 

    public jsp2agent(){

     msg=new ACLMessage(ACLMessage.INFORM);

    }

 

 

protected void setup() {

//允许对象到Agent的传输通信?

setEnabledO2ACommunication(true, 10);

 

//加入一个循环行为

addBehaviour(new CyclicBehaviour(){

public void action(){

Object obj=getO2AObject(); //Agent

if(obj!= null)

{

//调用方法

send2agent(obj.toString());

}

else

{

block();

}

}

});

}

 

 

protected void takeDown() {

//关闭对象到Agent的传输

setEnabledO2ACommunication(false, 0);

}

 

public void send2agent(String str){

msg.clearAllReceiver();

msg.addReceiver(new AID("AgentName",AID.ISLOCALNAME));

msg.setContent(str);

send(msg);

}

 

}



结果输出:
2009-10-14 9:29:10 jade.core.Runtime beginContainer
信息: ----------------------------------
    This is JADE 3.7 - revision 6154 of 2009/07/01 17:34:15
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
----------------------------------------
2009-10-14 9:29:10 jade.core.AgentContainerImpl joinPlatform
严重: Some problem occurred while joining agent platform.
jade.core.ProfileException: Can't get a proxy to the Platform Manager [nested jade.core.IMTPException: Can't get a proxy to the PlatformManager at address rmi://169.254.186.212:1099/ [nested java.rmi.NoSuchObjectException: no such object in table]]
at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:574)
at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487)
at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501)
at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342)
at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478)
at jade.core.Runtime.createAgentContainer(Runtime.java:116)
at jade.Boot.<init>(Boot.java:133)
at jade.Boot.main(Boot.java:70)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:85)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Nested Exception:
jade.core.IMTPException: Can't get a proxy to the PlatformManager at address rmi://169.254.186.212:1099/ [nested java.rmi.NoSuchObjectException: no such object in table]
at jade.imtp.rmi.RMIIMTPManager.getPlatformManagerProxy(RMIIMTPManager.java:318)
at jade.imtp.rmi.RMIIMTPManager.getPlatformManagerProxy(RMIIMTPManager.java:308)
at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:571)
at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487)
at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501)
at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342)
at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478)
at jade.core.Runtime.createAgentContainer(Runtime.java:116)
at jade.Boot.<init>(Boot.java:133)
at jade.Boot.main(Boot.java:70)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:85)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Nested Exception:
java.rmi.NoSuchObjectException: no such object in table
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at jade.imtp.rmi.RMIIMTPManager.getPlatformManagerProxy(RMIIMTPManager.java:314)
at jade.imtp.rmi.RMIIMTPManager.getPlatformManagerProxy(RMIIMTPManager.java:308)
at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:571)
at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487)
at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501)
at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342)
at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478)
at jade.core.Runtime.createAgentContainer(Runtime.java:116)
at jade.Boot.<init>(Boot.java:133)
at jade.Boot.main(Boot.java:70)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:85)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
2009-10-14 9:29:10 jade.core.Runtime$1 run
信息: JADE is closing down now.


有待努力...

 

 

分享到:
评论

相关推荐

    Developing Multi-Agent Systems with JADE

    ### 开发基于JADE的多Agent系统 #### 引言 《使用JADE开发多Agent系统》是一本针对多Agent技术领域的重要参考书籍,由Fabio Bellifemine、Giovanni Caire 和 Dominic Greenwood 合著,由John Wiley & Sons Ltd ...

    Developing multi-agent system with Jade

    《Developing Multi-Agent System with Jade》是一本专为学习和实践多智能体系统(Multi-Agent Systems,MAS)开发而编写的指南,尤其聚焦于使用JADE(Java Agent DEvelopment Framework)平台。JADE是一个开源的、...

    acl.rar_ACL_Agent_jade_jade agent_jade java

    在这个“ACL_Agent_jade_jade_agent_jade_java”主题中,我们将探讨如何在JADE上构建和配置agent,以及它们如何使用ACL进行通信。 首先,了解JADE的基本结构是至关重要的。JADE由几个核心组件组成,包括:Agent容器...

    JADE-all-4.1.zip_Agent_JADE4.1_Multi Agent System_jade java_jade

    JADE (Java Agent DEvelopment Framework) is a software framework fully implemented in Java language.It simplifies the implementation of multi-agent systems through a middle-ware that claims to comply ...

    jade 开发多agent

    ### JADE:开发多Agent系统 #### 一、引言 JADE(Java Agent DEvelopment Framework)是一款基于Java的开源框架,旨在简化多Agent系统的开发流程,并确保与FIPA(Foundation for Intelligent Physical Agents)...

    2001_IM_Developing multi-agent systems with JADE

    本文将深入探讨JADE(Java Agent Development Framework)及其如何简化基于Java的多主体系统的开发过程。该框架致力于实现符合FIPA(Foundation for Intelligent Physical Agents)标准的多主体应用,并作为一个高效...

    y.rar_AGENT JAVA JADE_jade multi agent_multi agent_multi agent j

    在描述中提到的"An example of the use of multi agent interaction using java with Jade."表明,压缩包可能包含了一个实际的代码示例,演示了如何用Java编写智能体,并在JADE环境中实现它们之间的互动。...

    JADE平台-用于multi-agent的研究

    JADE(Java Agent Development Framework)是一个强大的开源平台,专门设计用于开发和实现多代理系统(Multi-Agent Systems, MAS)。它基于Java编程语言,为开发者提供了一个标准化的环境,可以方便地创建、部署和...

    HelloWorldAgent.rar_Agent_agent jade

    《JADE Agent编程初探——基于HelloWorldAgent的实践指南》 在计算机科学领域,Agent技术作为一种分布式计算模型,已经成为解决复杂、动态问题的重要手段。其中,JADE(Java Agent DEvelopment Framework)是一个...

    delevop multi-agent with jade

    2. **JADE框架详解**:深入探讨JADE的核心组件,如容器(Container)、代理(Agent)、服务发现机制等,并通过实例展示如何创建和管理这些组件。 3. **通信机制**:重点讲解了JADE中的通信协议FIPA ACL(Foundation for ...

    jade开发多Agent系统pdf版本

    通过阅读《Developing Multi-Agent Systems with JADE》,读者不仅能够全面掌握JADE框架的基本原理和开发技巧,还能深入了解多智能体系统的前沿应用和发展趋势。无论是在学术研究还是商业实践中,本书都是一本不可或...

    bookTrading.rar_bookTrading.rar_jade agent

    JADE - Java Agent DEvelopment Framework is a framework to develop multi-agent systems in compliance with the FIPA specifications.

    jade平台下的多agent应用指南

    **JADE平台下的多agent应用指南** JADE(Java Agent Development Framework)是一个基于Java语言的多agent系统开发框架,设计用于构建遵循FIPA(Foundation for Intelligent Physical Agents)标准的智能agent应用...

    Developing Multi.Agent Systems with JADE

    JADE(Java Agent Development Framework)是用于构建分布式智能体应用的开放源代码框架,特别适用于互联网环境。它基于Java语言,支持MAS的开发,使开发者能够设计和实现复杂的交互式系统。JADE不仅提供了一套强大的...

    JADE实例(多agent开发)

    **JADE(Java Agent DEvelopment Framework)实例:多Agent系统开发** JADE,全称Java Agent DEvelopment Framework,是一个开源的、跨平台的框架,专为实现基于FIPA(Foundation for Intelligent Physical Agents...

    JADE(Java Agent DEvelopment Framework):一个Agent,多Agent系统的开发框架

    在此和大家分享JADE(全称Java Agent DEvelopment Framework)一个很酷的在Java上进行Agent开发的框架。你可以用这个框架很轻易的搭建一个MAS(多智能体系统),在这些系统中,各个Agent是自治的,而且可以互相通信...

Global site tag (gtag.js) - Google Analytics