Agent Mobility with JADE and JIPMS

A friend and I have been working on Java Agent DEvelopment Framework (JADE) for a while now. The idea is to enhance security mechanisms in the open source agent-deployment platform. The first step we decided to address was the actual mobility of an agent from one platform (in the sense of a dedicated machine running the JADE middleware) to another one. Turned out that it was much harder than one would imagine — especially given the fact that these agents are supposed to be mobile. Anyway, after around two months of part-time efforts, we got the agent working. Since the whole ordeal involved a lot of missing documentation and bad support, I decided to document the process through this tutorial. So, here it is. Read on to see how you can create an agent on one platform, migrate it to another platform, have it do some computation there and come back to the source. 

First, you’re going to need two machines running Ubuntu. (We used Ubuntu 11.10 oneric for this.) If you only have one machine, you can install VirtualBox, setup a Ubuntu instance in a VM and connect it to the host through a virtual interface. I prefer using two adapters, first one set to a NAT setting and another one set to Host-only setting. This way, I get Internet connectivity in the guest as well as host-to-guest simple addressing.

We’re going to use JADE 3.6 along with the JADE Inter-platform Mobility Service (JIPMS) 1.2 for our needs. Download JADE and JIPMS.  I used jade-binary package and extracted it in /home/documents/jade. I also extracted the JIPMS and moved the file migration.jar from its lib folder to the lib folder of jade binary. This makes it easier for us to change the classpath later on. We’ll need these files on both machines.

Now we need to setup the machines. Here are the details of the setup on each machine:

Host:

hostname: slave1
IP: 192.168.56.1 (set by VirtualBox automatically)

You can get the IP addresses of each machine through the ifconfig command. Edit /etc/hosts to insert the other machine’s address. My hosts file on slave1 looks like this:

# 127.0.0.1       localhost
127.0.0.1         slave1
192.168.56.101    slave2

Now, we can run jade using the following command:

java -cp lib/jade.jar:lib/migration.jar:lib/iiop.jar:
         lib/jadeTools.jar:lib/http.jar:
         lib/commons-codec/commons-codec-1.3.jar
     jade.Boot
         -gui
         -platform-id slave1
         -host slave1
         -services jade.core.mobility.AgentMobilityService\;
                   jade.core.migration.InterPlatformMobilityService
         -accept-foreign-agents true

You will need to use a little common sense about the line breaks and spaces here. I’ve formatted the command for highest readability. (Note the escaped ‘;’ in the services param and the use of full colon instead of the semi-colon in the classpath. This is only required on *nix platforms.) Three switches are important here: platform-id, host and services.  First two are self-explanatory. Third tells the IPMS to start the services that take care of the agent migration. We also need to enable the acceptance of foreign agents but I’m sure you already knew that from all the mailing list searches.

Guest:

hostname: slave2
IP: 192.168.56.101 (set by VirtualBox automatically)

The hosts file looks like this:

# 127.0.0.1     localhost
127.0.0.1       slave2
192.168.56.1    slave1

Start jade on slave2 using the following command:

java -cp lib/jade.jar:lib/migration.jar:lib/iiop.jar:
         lib/jadeTools.jar:lib/http.jar:
         lib/commons-codec/commons-codec-1.3.jar
     jade.Boot
        -gui
        -platform-id slave2
        -host slave2
        -services jade.core.mobility.AgentMobilityService\;
                  jade.core.migration.InterPlatformMobilityService
        -accept-foreign-agents true

The Agent:

Now, we turn to the actual agent code that does the migration. For this, we can setup eclipse and code from within that. The code for the agent is fairly straight-forward:

package org.csrdu.mobility;

import jade.core.AID;
import jade.core.Agent;
import jade.core.PlatformID;
import jade.core.behaviours.TickerBehaviour;

@SuppressWarnings("serial")
public class MobileAgent extends Agent {

    @Override
    protected void setup() {
        super.setup();
        addBehaviour(new MyTickerBehaviour(this, 1000));

        System.out.println("Hello World. I am an agent!");
        System.out.println("My LocalName: " + getAID().getLocalName());
        System.out.println("My Name: " + getAID().getName());
        System.out.println("My Address: " + getAID().getAddressesArray()[0]);
    }

    private class MyTickerBehaviour extends TickerBehaviour {
        Agent agent;
        // long interval;
        int counter;

        public MyTickerBehaviour(Agent agent, long interval) {
            super(agent, interval);
            this.agent = agent;
            // this.interval = interval;
        }

        @Override
        protected void onTick() {
            if (counter == 3) {
                // move out
                AID remoteAMS = new AID("ams@slave2", AID.ISGUID);
                remoteAMS.addAddresses("http://slave2:7778/acc");
                PlatformID destination = new PlatformID(remoteAMS);
                agent.doMove(destination);
            }
            if (counter == 10) {
                // move back
                AID remoteAMS = new AID("ams@slave1", AID.ISGUID);
                remoteAMS.addAddresses("http://slave1:7778/acc");
                PlatformID destination = new PlatformID(remoteAMS);
                agent.doMove(destination);
            }
            if (counter < 15)
                System.out.println(counter++);
            else
                agent.doDelete();
        }

    }
}

For the sake of completion, here’s the arguments that you have to pass when running the agent code from within eclipse.

-container -agents mob:org.csrdu.mobility.MobileAgent 
  -services jade.core.mobility.AgentMobilityService;jade.core.migration.InterPlatformMobilityService

Also, add all the jade and mobility jars to the build path of the project. I’m not sure which ones are needed here so you will have to figure that out on your own.

Caveats:

  1. If you get this error: Destination slave2:1099/JADE does not exist or does not support mobility, it most probably means that you (a) you don’t have IPMS running, (b) you didn’t put the -services switch properly (c) there’s a firewall blocking your port 7778 or (d) your hostnames are messed up. In any case, the whole instructions above should work for you.
  2. You will most probably need to change your /etc/hosts file and comment out the line that says ‘127.0.0.1 localhost’. It causes JADE to start the ams@slaveN service as http://localhost:7778/acc instead of http://slaveN:7778/acc and that means a lot of missed ACL messages and a lot of headaches. You usually get the dreaded getContainerID() failed to find agent ams@slave1 error because of this. Do this for both the host and the guest. Make sure your JADE GUI looks like the following:
  3. Finally, if you need detailed logging, you can create the logging config file by the name of logging.properties given below and pass the -Djava.util.logging.config.file=logging.properties parameter when starting JADE. This will give much finer-grained logs. This is standard log4j syntax.
handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level=INFO
jade.domain.mobility.level=ALL

# --- ConsoleHandler ---
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter

# --- FileHandler ---
java.util.logging.FileHandler.level=ALL

java.util.logging.FileHandler.pattern=%h/java%u.log
java.util.logging.FileHandler.limit=50000
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter 

17 Comments

  1. Can i get your help please. I try several time ,but it does not work I do every things you wrote above but the agent does not move to the remote plateform and there are no errors in the terminate.
    i will appreciate your help thank you.

  2. recluze

    January 5, 2012 at 3:34 am

    Rafat, can you paste your logs on gist.github.com or pastebin.com and send me the link? I’ll need to see the logs before I can help. Also, please enable the detailed logging as I described at the end of the tutorial so that we can see what’s going on.

  3. Hello there,
    I’m having the following error:

    run:
    Feb 19, 2012 3:23:15 PM jade.core.Runtime beginContainer
    Retrieving CommandDispatcher for platform slave1
    INFO: ———————————-
    This is JADE 4.1.1 – revision 6532 of 2011/11/18 16:21:34
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
    —————————————-
    Feb 19, 2012 3:23:18 PM jade.imtp.leap.LEAPIMTPManager initialize
    INFO: Listening for intra-platform commands on address:
    – jicp://169.254.107.142:1099

    Feb 19, 2012 3:23:19 PM jade.core.BaseService init
    INFO: Service jade.core.management.AgentManagement initialized
    Feb 19, 2012 3:23:19 PM jade.core.BaseService init
    INFO: Service jade.core.messaging.Messaging initialized
    Feb 19, 2012 3:23:19 PM jade.core.BaseService init
    INFO: Service jade.core.resource.ResourceManagement initialized
    Feb 19, 2012 3:23:19 PM jade.core.BaseService init
    INFO: Service jade.core.mobility.AgentMobility initialized
    Feb 19, 2012 3:23:19 PM jade.core.BaseService init
    INFO: Service jade.core.migration.InterPlatformMobility initialized
    Feb 19, 2012 3:23:19 PM jade.core.migration.InterPlatformMobilityService init
    WARNING: AGENTS_PATH property not set, using C:\Users\Priesh\Documents\NetBeansProjects\MobileAgent5\ directory for jar agents
    Feb 19, 2012 3:23:19 PM jade.core.migration.InterPlatformMobilityService init
    WARNING: Resource cache is: enabled
    Feb 19, 2012 3:23:19 PM jade.core.migration.InterPlatformMobilityService init
    WARNING: IPMS: Default transfer protocol is set to: pctp-v1
    Feb 19, 2012 3:23:19 PM jade.core.migration.InterPlatformMobilityService init
    INFO: jade.core.migration.InterPlatformMobilityService initialized
    Feb 19, 2012 3:23:20 PM jade.mtp.http.HTTPServer
    INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
    Feb 19, 2012 3:23:20 PM jade.core.messaging.MessagingService boot
    INFO: MTP addresses:
    http://Priesh-PC:7778/acc
    Feb 19, 2012 3:23:20 PM jade.core.migration.protocols.PushTransferProtocol
    WARNING: Jar cache is: enabled
    Feb 19, 2012 3:23:20 PM jade.core.migration.protocols.PushCacheTransferProtocol
    WARNING: Jar cache is: enabled
    Feb 19, 2012 3:23:20 PM jade.core.migration.protocols.FragmentedTransferProtocol loadParameters
    WARNING: Jar cache is: enabled
    Feb 19, 2012 3:23:21 PM jade.core.AgentContainerImpl joinPlatform
    INFO: ————————————–
    Agent container Main-Container@169.254.107.142 is ready.
    ——————————————–
    Feb 19, 2012 3:23:21 PM jade.tools.ToolAgent init
    WARNING: NotificationService not installed. Some tool may not work properly.
    Hello World. I am an agent!
    My LocalName: m
    My Name: m@slave1
    My Address: http://Priesh-PC:7778/acc
    0
    1
    2
    3
    Feb 19, 2012 3:25:59 PM jade.core.migration.MigrationInitiator handleAllResponses
    WARNING: MigrationInitiator: Timeout expired.
    4
    Feb 19, 2012 3:25:59 PM jade.core.migration.InterPlatformMobilityService$ServiceComponent handleInformMigrationResult
    WARNING: Migration failure: Aborting migration: Timeout to receive migration response has expired

    I have edited the host files on both computers and my settings are as follows:

    slave1 (it has ip addess 10.0.0.3)
    10.0.0.3 slave1
    10.0.0.5 slave2

    slave2 (it has ip addess 10.0.0.5)
    10.0.0.5 slave2
    10.0.0.3 slave1

    The code is nearly the same as above and i have passed the following arguments in netbeans

    Arguments for slave1
    -gui -platform-id slave1 -services jade.core.mobility.AgentMobilityService;jade.core.migration.InterPlatformMobilityService

    Arguments for slave2
    -gui -platform-id slave2 -services jade.core.mobility.AgentMobilityService;jade.core.migration.InterPlatformMobilityService

    jade & jipms are installed on both machines. Btw i have also tried to put 127.0.0.1 instead of the machine ip. i still the same problem where agent is not migrating. Thanks in advance for your help.

  4. recluze

    February 20, 2012 at 1:53 am

    A timeout can mean a couple of things: (a) There is no service listening on the remote end (b) there was a firewall issue (c) the remote service somehow rejected the request. We will need the logs on slave2 to find out what the issue is. Please post those logs as well. Also, make sure you see slave1 and slave2 respectively on Jade GUIs (refer to the caveats section above).

  5. Here is the log when running jade with the arguments, that is, when the service is started on slave 2:

    Feb 21, 2012 11:40:42 PM jade.core.Runtime beginContainer
    INFO: ———————————-
    This is JADE 4.1.1 – revision 6532 of 2011/11/18 16:21:34
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
    —————————————-
    Retrieving CommandDispatcher for platform slave2
    Feb 21, 2012 11:40:42 PM jade.imtp.leap.LEAPIMTPManager initialize
    INFO: Listening for intra-platform commands on address:
    – jicp://10.0.0.5:1099

    Feb 21, 2012 11:40:42 PM jade.core.BaseService init
    INFO: Service jade.core.management.AgentManagement initialized
    Feb 21, 2012 11:40:42 PM jade.core.BaseService init
    INFO: Service jade.core.messaging.Messaging initialized
    Feb 21, 2012 11:40:42 PM jade.core.BaseService init
    INFO: Service jade.core.resource.ResourceManagement initialized
    Feb 21, 2012 11:40:42 PM jade.core.BaseService init
    INFO: Service jade.core.mobility.AgentMobility initialized
    Feb 21, 2012 11:40:42 PM jade.core.BaseService init
    INFO: Service jade.core.migration.InterPlatformMobility initialized
    Feb 21, 2012 11:40:42 PM jade.core.migration.InterPlatformMobilityService init
    WARNING: AGENTS_PATH property not set, using C:\Users\Priesh\Documents\NetBeansProjects\MobileAgent5\jarManager\ directory for jar agents
    Feb 21, 2012 11:40:42 PM jade.core.migration.InterPlatformMobilityService init
    INFO: jade.core.migration.InterPlatformMobilityService initialized
    Feb 21, 2012 11:40:42 PM jade.mtp.http.HTTPServer
    INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
    Feb 21, 2012 11:40:42 PM jade.core.messaging.MessagingService boot
    INFO: MTP addresses:
    http://slave2:7778/acc
    Feb 21, 2012 11:40:42 PM jade.core.AgentContainerImpl joinPlatform
    INFO: ————————————–
    Agent container Main-Container@10.0.0.5 is ready.
    ——————————————–

  6. Btw, i have started the service on both machines and disabled firewall.

  7. Hello Recluze, I have got the agent working. I did not have the same version of jipms on the other device and id didnt work when i use ams@slave2. It works with amm@slave2 though.

    Now i want to have the agent update a database on another host. I can do it on my machine by creating an agent and it works fine(intra-platform). How do i make the agent update a database on another host? Is it part of behaviours?

  8. Hi there, i managed to get the database to update. The db update code should be on slave2 itself. Could you tell me how i could send the variables from slave1 to slave2 using agent? For the time being, the variables are hard coded on the db update codes on slave2. I want to send my own variables from slave1 to slave2. How do i do this using jade agents? Thanks. :)

  9. if i run this code in netbeans means what was the main method & Argument..

  10. Hi frendz,
    It is useful. if u ppl present any video tutorial in this blog its very useful for beginners for creating and installing add-on services.

    Thanks in advance,
    Srinivas….

  11. I opened slave1 at default port on my system and i got the following with platform opening

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Admin>cd c:\jade

    C:\jade>java -cp lib/jade.jar;lib/migration.jar;lib/iiop.jar:lib/jadeTools.jar;l
    ib/http.jar;lib/commons-codec/commons-codec-1.3.jar jade.Boot -gui -platform-id
    slave1 -services jade.core.mobility.AgentMobilityService\;jade.core.migration.In
    terPlatformMobilityService -accept-foreign-agents true
    Feb 27, 2013 11:52:06 AM jade.core.Runtime beginContainer
    INFO: ———————————-
    This is JADE 4.2.0 – revision 6574 of 2012/06/20 15:38:00
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
    —————————————-
    Retrieving CommandDispatcher for platform slave1
    Feb 27, 2013 11:52:06 AM jade.imtp.leap.LEAPIMTPManager initialize
    INFO: Listening for intra-platform commands on address:
    – jicp://192.168.1.2:1099

    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.management.AgentManagement initialized
    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.messaging.Messaging initialized
    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.resource.ResourceManagement initialized
    Feb 27, 2013 11:52:06 AM jade.core.AgentContainerImpl initAdditionalServices
    WARNING: Exception initializing service jade.core.mobility.AgentMobilityService\

    jade.core.ServiceException: An error occurred during service activation [nested
    java.lang.ClassNotFoundException: jade.core.mobility.AgentMobilityService\]
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:111
    7)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImp
    l.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:492
    )
    at jade.core.Runtime.createMainContainer(Runtime.java:166)
    at jade.Boot.main(Boot.java:89)
    Nested Exception:
    java.lang.ClassNotFoundException: jade.core.mobility.AgentMobilityService\
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:110
    1)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImp
    l.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:492
    )
    at jade.core.Runtime.createMainContainer(Runtime.java:166)
    at jade.Boot.main(Boot.java:89)

    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.migration.InterPlatformMobility initialized
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    WARNING: AGENTS_PATH property not set, using C:\jade\ directory for jar agents
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    WARNING: Resource cache is: enabled
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    WARNING: IPMS: Default transfer protocol is set to: pctp-v1
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    INFO: jade.core.migration.InterPlatformMobilityService initialized
    Feb 27, 2013 11:52:06 AM jade.mtp.http.HTTPServer
    INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParse
    rImpl$JAXPSAXParser
    Feb 27, 2013 11:52:07 AM jade.core.messaging.MessagingService boot
    INFO: MTP addresses:
    http://home:7778/acc
    Feb 27, 2013 11:52:07 AM jade.core.migration.protocols.PushTransferProtocol
    WARNING: Jar cache is: enabled
    Feb 27, 2013 11:52:07 AM jade.core.migration.protocols.PushCacheTransferProtocol

    WARNING: Jar cache is: enabled
    Feb 27, 2013 11:52:07 AM jade.core.migration.protocols.FragmentedTransferProtoco
    l loadParameters
    WARNING: Jar cache is: enabled
    Feb 27, 2013 11:52:07 AM jade.core.AgentContainerImpl joinPlatform
    INFO: ————————————–
    Agent container Main-Container@192.168.1.2 is ready.
    ——————————————–
    Feb 27, 2013 11:52:07 AM jade.tools.ToolAgent init
    WARNING: NotificationService not installed. Some tool may not work properly.
    Feb 27, 2013 11:53:49 AM jade.core.PlatformManagerImpl localAddNode
    INFO: Adding node to the platform
    Feb 27, 2013 11:53:49 AM jade.core.PlatformManagerImpl$1 nodeAdded
    INFO: — Node ALIVE —
    Feb 27, 2013 11:54:55 AM jade.core.nodeMonitoring.BlockingNodeFailureMonitor run

    INFO: PING from node Container-1 returned [EXIT]
    Feb 27, 2013 11:54:55 AM jade.core.PlatformManagerImpl removeTerminatedNode
    INFO: — Node TERMINATED —
    Feb 27, 2013 11:54:55 AM jade.core.PlatformManagerImpl localRemoveNode
    INFO: Removing node from the platform
    Feb 27, 2013 11:55:21 AM jade.core.PlatformManagerImpl localAddNode
    INFO: Adding node to the platform
    Feb 27, 2013 11:55:21 AM jade.core.PlatformManagerImpl$1 nodeAdded
    INFO: — Node ALIVE —

    Then opened slave2 at port 1111

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Admin>cd c:\jade

    C:\jade>java -cp lib/jade.jar:lib/migration.jar:lib/iiop.jar:lib/jadeTools.jar:l
    ib/http.jar:lib/commons-codec/commons-codec-1.3.jar jade.Boot -gui -platform-id
    slave1 -services jade.core.mobility.AgentMobilityService\;jade.core.migration.In
    terPlatformMobilityService -accept-foreign-agents true
    Error: Could not find or load main class jade.Boot

    C:\jade>java -cp lib/jade.jar;lib/migration.jar;lib/iiop.jar:lib/jadeTools.jar;l
    ib/http.jar;lib/commons-codec/commons-codec-1.3.jar jade.Boot -gui -platform-id
    slave1 -services jade.core.mobility.AgentMobilityService\;jade.core.migration.In
    terPlatformMobilityService -accept-foreign-agents true
    Feb 27, 2013 11:52:06 AM jade.core.Runtime beginContainer
    INFO: ———————————-
    This is JADE 4.2.0 – revision 6574 of 2012/06/20 15:38:00
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
    —————————————-
    Retrieving CommandDispatcher for platform slave1
    Feb 27, 2013 11:52:06 AM jade.imtp.leap.LEAPIMTPManager initialize
    INFO: Listening for intra-platform commands on address:
    – jicp://192.168.1.2:1099

    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.management.AgentManagement initialized
    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.messaging.Messaging initialized
    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.resource.ResourceManagement initialized
    Feb 27, 2013 11:52:06 AM jade.core.AgentContainerImpl initAdditionalServices
    WARNING: Exception initializing service jade.core.mobility.AgentMobilityService\

    jade.core.ServiceException: An error occurred during service activation [nested
    java.lang.ClassNotFoundException: jade.core.mobility.AgentMobilityService\]
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:111
    7)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImp
    l.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:492
    )
    at jade.core.Runtime.createMainContainer(Runtime.java:166)
    at jade.Boot.main(Boot.java:89)
    Nested Exception:
    java.lang.ClassNotFoundException: jade.core.mobility.AgentMobilityService\
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:110
    1)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImp
    l.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:492
    )
    at jade.core.Runtime.createMainContainer(Runtime.java:166)
    at jade.Boot.main(Boot.java:89)

    Feb 27, 2013 11:52:06 AM jade.core.BaseService init
    INFO: Service jade.core.migration.InterPlatformMobility initialized
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    WARNING: AGENTS_PATH property not set, using C:\jade\ directory for jar agents
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    WARNING: Resource cache is: enabled
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    WARNING: IPMS: Default transfer protocol is set to: pctp-v1
    Feb 27, 2013 11:52:06 AM jade.core.migration.InterPlatformMobilityService init
    INFO: jade.core.migration.InterPlatformMobilityService initialized
    Feb 27, 2013 11:52:06 AM jade.mtp.http.HTTPServer
    INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParse
    rImpl$JAXPSAXParser
    Feb 27, 2013 11:52:07 AM jade.core.messaging.MessagingService boot
    INFO: MTP addresses:
    http://home:7778/acc
    Feb 27, 2013 11:52:07 AM jade.core.migration.protocols.PushTransferProtocol
    WARNING: Jar cache is: enabled
    Feb 27, 2013 11:52:07 AM jade.core.migration.protocols.PushCacheTransferProtocol

    WARNING: Jar cache is: enabled
    Feb 27, 2013 11:52:07 AM jade.core.migration.protocols.FragmentedTransferProtoco
    l loadParameters
    WARNING: Jar cache is: enabled
    Feb 27, 2013 11:52:07 AM jade.core.AgentContainerImpl joinPlatform
    INFO: ————————————–
    Agent container Main-Container@192.168.1.2 is ready.
    ——————————————–
    Feb 27, 2013 11:52:07 AM jade.tools.ToolAgent init
    WARNING: NotificationService not installed. Some tool may not work properly.
    Feb 27, 2013 11:53:49 AM jade.core.PlatformManagerImpl localAddNode
    INFO: Adding node to the platform
    Feb 27, 2013 11:53:49 AM jade.core.PlatformManagerImpl$1 nodeAdded
    INFO: — Node ALIVE —
    Feb 27, 2013 11:54:55 AM jade.core.nodeMonitoring.BlockingNodeFailureMonitor run

    INFO: PING from node Container-1 returned [EXIT]
    Feb 27, 2013 11:54:55 AM jade.core.PlatformManagerImpl removeTerminatedNode
    INFO: — Node TERMINATED —
    Feb 27, 2013 11:54:55 AM jade.core.PlatformManagerImpl localRemoveNode
    INFO: Removing node from the platform
    Feb 27, 2013 11:55:21 AM jade.core.PlatformManagerImpl localAddNode
    INFO: Adding node to the platform
    Feb 27, 2013 11:55:21 AM jade.core.PlatformManagerImpl$1 nodeAdded
    INFO: — Node ALIVE —

    Then i ran the program as follows

    C:\jade>java -cp lib/jade.jar;classes jade.Boot -container -agents mob:mobility.
    MobileAgent -services jade.core.mobility.AgentMobilityService;jade.core.migratio
    n.InterPlatformMobilityService
    Feb 27, 2013 11:55:20 AM jade.core.Runtime beginContainer
    INFO: ———————————-
    This is JADE 4.2.0 – revision 6574 of 2012/06/20 15:38:00
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
    —————————————-
    Retrieving CommandDispatcher for platform null
    Feb 27, 2013 11:55:20 AM jade.imtp.leap.LEAPIMTPManager initialize
    INFO: Listening for intra-platform commands on address:
    – jicp://192.168.1.2:1489

    Feb 27, 2013 11:55:21 AM jade.core.BaseService init
    INFO: Service jade.core.management.AgentManagement initialized
    Feb 27, 2013 11:55:21 AM jade.core.BaseService init
    INFO: Service jade.core.messaging.Messaging initialized
    Feb 27, 2013 11:55:21 AM jade.core.BaseService init
    INFO: Service jade.core.resource.ResourceManagement initialized
    Feb 27, 2013 11:55:21 AM jade.core.BaseService init
    INFO: Service jade.core.mobility.AgentMobility initialized
    Feb 27, 2013 11:55:21 AM jade.core.AgentContainerImpl initAdditionalServices
    WARNING: Exception initializing service jade.core.migration.InterPlatformMobilit
    yService
    jade.core.ServiceException: An error occurred during service activation [nested
    java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityServi
    ce]
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:111
    7)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImp
    l.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:492
    )
    at jade.core.Runtime.createAgentContainer(Runtime.java:134)
    at jade.Boot.main(Boot.java:91)
    Nested Exception:
    java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityServi
    ce
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:110
    1)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImp
    l.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:492
    )
    at jade.core.Runtime.createAgentContainer(Runtime.java:134)
    at jade.Boot.main(Boot.java:91)

    Feb 27, 2013 11:55:21 AM jade.core.AgentContainerImpl joinPlatform
    INFO: ————————————–
    Agent container Container-2@192.168.1.2 is ready.
    ——————————————–
    Hello World. I am an agent
    My LocalName: mob
    My Name: mob@slave1
    0
    1
    2
    3
    Feb 27, 2013 11:55:21 AM jade.core.mobility.AgentMobilityService$CommandSourceSi
    nk handleInformMoved
    SEVERE: Destination slave2 does not exist or does not support mobility
    4
    5
    6
    7
    8
    9
    10
    Feb 27, 2013 11:55:22 AM jade.core.mobility.AgentMobilityService$CommandSourceSi
    nk handleInformMoved
    SEVERE: Destination slave1 does not exist or does not support mobility
    11
    12
    13
    14

    can you pls help me to resolve this…

  12. hello recluze, i’ve been followed your code about jipms and then i have an error like..

    Jul 06, 2013 3:09:17 PM jade.core.AgentContainerImpl startBootstrapAgents
    SEVERE: Cannot create agent RMA: Name-clash Agent RMA@slave1 already present in the platform
    Hello World. I am an agent!
    My LocalName: mob
    My Name: mob@slave1
    My Address: http://localhost:7778/acc
    Jul 06, 2013 3:09:17 PM jade.core.AgentContainerImpl joinPlatform
    INFO: ————————————–
    Agent container Container-1@slave1 is ready.
    ——————————————–
    0
    1
    2
    moving agent
    My Address: http://localhost:7778/acc
    3
    Jul 06, 2013 3:10:37 PM jade.core.migration.InterPlatformMobilityService$ServiceComponent handleInformMigrationResult
    4
    WARNING: Migration failure: Aborting migration: MigrationInitiator: Failure received: ( (action ( agent-identifier :name amm@slave1 :addresses (sequence http://localhost:7778/acc )) (ACLMessage) ) (MTS-error ( agent-identifier :name amm@slave2:1099/JADE :addresses (sequence http://172.16.161.135:7778/acc )) (internal-error “Foreign agent unreachable: No valid address contained within the AID amm@slave2:1099/JADE”)) )
    5
    6
    7
    8
    moving agent
    My Address: http://localhost:7778/acc
    9
    Jul 06, 2013 3:11:57 PM jade.core.migration.InterPlatformMobilityService$ServiceComponent handleInformMigrationResult
    WARNING: Migration failure: Aborting migration: MigrationInitiator: Failure received: ( (action ( agent-identifier :name amm@slave1 :addresses (sequence http://localhost:7778/acc )) (ACLMessage) ) (MTS-error ( agent-identifier :name amm@slave1:1099/JADE :addresses (sequence http://172.16.161.1:7778/acc )) (internal-error “Foreign agent unreachable: No valid address contained within the AID amm@slave1:1099/JADE”)) )
    10
    11
    12
    13
    14

    so what should i do to fix it?
    thanks

  13. hello recluze, i’ve been followed your code about jipms and then i have an error like..

    Jul 06, 2013 3:09:17 PM jade.core.AgentContainerImpl startBootstrapAgents
    SEVERE: Cannot create agent RMA: Name-clash Agent RMA@slave1 already present in the platform
    Hello World. I am an agent!
    My LocalName: mob
    My Name: mob@slave1
    My Address: http://localhost:7778/acc
    Jul 06, 2013 3:09:17 PM jade.core.AgentContainerImpl joinPlatform
    INFO: ————————————–
    Agent container Container-1@slave1 is ready.
    ——————————————–
    0
    1
    2
    moving agent
    My Address: http://localhost:7778/acc
    3
    Jul 06, 2013 3:10:37 PM jade.core.migration.InterPlatformMobilityService$ServiceComponent handleInformMigrationResult
    4
    WARNING: Migration failure: Aborting migration: MigrationInitiator: Failure received: ( (action ( agent-identifier :name amm@slave1 :addresses (sequence http://localhost:7778/acc )) (ACLMessage) ) (MTS-error ( agent-identifier :name amm@slave2:1099/JADE :addresses (sequence http://172.16.161.135:7778/acc )) (internal-error “Foreign agent unreachable: No valid address contained within the AID amm@slave2:1099/JADE”)) )
    5
    6
    7
    8
    moving agent
    My Address: http://localhost:7778/acc
    9
    Jul 06, 2013 3:11:57 PM jade.core.migration.InterPlatformMobilityService$ServiceComponent handleInformMigrationResult
    WARNING: Migration failure: Aborting migration: MigrationInitiator: Failure received: ( (action ( agent-identifier :name amm@slave1 :addresses (sequence http://localhost:7778/acc )) (ACLMessage) ) (MTS-error ( agent-identifier :name amm@slave1:1099/JADE :addresses (sequence http://172.16.161.1:7778/acc )) (internal-error “Foreign agent unreachable: No valid address contained within the AID amm@slave1:1099/JADE”)) )
    10
    11
    12
    13
    14

    so what should i do to fix it?
    thanks

  14. Can I move agent from my local PC to amazon server using this tutorial? What I want to do is, I want to open remote platform on amazon machine and want to move my agents from local pc to amazon machine. Kindly give me suggestions to do so..

    Thank YOu

  15. hi Nauman,

    I have followed your instructions exactly but getting the following error…I also followed instructions given in Caveats section, to resolve the issue but it didn’t work either. ..JIPMS running, firewall disabled..
    Here is the error that I am getting…


    Apr 11, 2014 4:14:36 PM jade.core.Runtime beginContainer
    INFO: ----------------------------------
    This is JADE 4.3.1 - revision 6695 of 2013/12/03 14:41:54
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
    ----------------------------------------
    Apr 11, 2014 4:14:37 PM jade.imtp.leap.LEAPIMTPManager initialize
    INFO: Listening for intra-platform commands on address:
    - jicp://10.99.17.132:13270

    Apr 11, 2014 4:14:38 PM jade.core.BaseService init
    INFO: Service jade.core.management.AgentManagement initialized
    Apr 11, 2014 4:14:38 PM jade.core.BaseService init
    INFO: Service jade.core.messaging.Messaging initialized
    Apr 11, 2014 4:14:38 PM jade.core.BaseService init
    INFO: Service jade.core.resource.ResourceManagement initialized
    Apr 11, 2014 4:14:38 PM jade.core.BaseService init
    INFO: Service jade.core.mobility.AgentMobility initialized
    Apr 11, 2014 4:14:38 PM jade.core.AgentContainerImpl initAdditionalServices
    WARNING: Exception initializing service jade.core.migration.InterPlatformMobilityService
    jade.core.ServiceException: An error occurred during service activation - Caused by: jade.core.migration.InterPlatformMobilityService
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:1120)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImpl.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:495)
    at jade.core.Runtime.createAgentContainer(Runtime.java:134)
    at jade.Boot.main(Boot.java:91)
    Nested Exception:
    java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityService
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:1104)
    at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImpl.java:448)
    at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:387)
    at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:495)
    at jade.core.Runtime.createAgentContainer(Runtime.java:134)
    at jade.Boot.main(Boot.java:91)

    Apr 11, 2014 4:14:38 PM jade.core.AgentContainerImpl joinPlatform
    Hello World. I am an agent
    My LocalName: m
    My Name: m@mysteriousboy
    My Address: http://mysteriousboy:7778/acc
    INFO: --------------------------------------
    Agent container Container-3@10.99.17.132 is ready.
    --------------------------------------------
    0
    1
    2
    3
    Apr 11, 2014 4:14:42 PM jade.core.mobility.AgentMobilityService$CommandSourceSink handleInformMoved
    SEVERE: Destination minii5 does not exist or does not support mobility
    4
    5
    6
    7
    8
    9
    10
    Apr 11, 2014 4:14:49 PM jade.core.mobility.AgentMobilityService$CommandSourceSink handleInformMoved
    SEVERE: Destination mysteriousboy does not exist or does not support mobility
    11
    12
    13
    14

    Here is the code,

    package Mobility;
    import jade.core.AID;
    import jade.core.Agent;
    import jade.core.PlatformID;
    import jade.core.behaviours.TickerBehaviour;
    public class MobileAgent extends Agent {

    @Override
    protected void setup() {
    super.setup();
    addBehaviour(new MyTickerBehaviour(this, 1000));

    System.out.println("Hello World. I am an agent");
    System.out.println("My LocalName: " + getAID().getLocalName());
    System.out.println("My Name: " + getAID().getName());
    System.out.println("My Address: " + getAID().getAddressesArray()[0]);
    }

    private class MyTickerBehaviour extends TickerBehaviour {
    Agent agent;
    // long interval;
    int counter;

    public MyTickerBehaviour(Agent agent, long interval) {
    super(agent, interval);
    this.agent = agent;
    // this.interval = interval;
    }

    @Override
    protected void onTick() {
    if (counter == 3) {
    // move out
    AID remoteAMS = new AID("ams@minii5", AID.ISGUID);
    remoteAMS.addAddresses("http://minii5:7778/acc");
    PlatformID destination = new PlatformID(remoteAMS);
    agent.doMove(destination);
    }
    if (counter == 10) {
    // move back
    AID remoteAMS = new AID("ams@mysteriousboy", AID.ISGUID);
    remoteAMS.addAddresses("http://mysteriousboy:7778/acc");
    PlatformID destination = new PlatformID(remoteAMS);
    agent.doMove(destination);
    }
    if (counter < 15)
    System.out.println(counter++);
    else
    agent.doDelete();
    }
    }
    }

    Here is my main method…


    package mobility;

    public class MobileAgentTester {
    public static void main(String[ ] args){
    MobileAgent agent = new MobileAgent();
    agent.setup();
    }
    }

    Can you please guide me what is going wrong??
    Thanks in advance..

    Regards,
    Yasir Mehmood

  16. Hi Nauman,
    I have solved the problem…Agent migration is working now…thanks


    Regards,
    Yasir

  17. First off I would like to say terrific blog! I had a quick question which
    I’d like to ask if you don’t mind. I was curious to find out how you center yourself and clear your thoughts before writing.
    I have had a difficult time clearing my mind in getting my thoughts out there.
    I truly do enjoy writing but it just seems like the first 10
    to 15 minutes are generally lost simply just trying to figure out
    how to begin. Any recommendations or tips? Thank you!

    My web blog – Bing.Com (http://Bing.Com)

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2014 recluze

Theme by Anders NorenUp ↑