Menu

Network Chatter problem

AFME
2009-05-19
2013-03-03
  • David Saldaña

    David Saldaña - 2009-05-19

    Hello,

    I have a problem with the Network Chatter example. I have run the MPPServer with

    java com.agentfactory.mts.mpp_server.MPPServer 3333 8 5555

    as the guide says: I start Alice agent but when I start the Bob's platform, the server show me the next message: http://pastebin.com/f3a5659ed

    registering platform 19
    19 Bob
    receiving: request Bob chat
    connecting to http://navanman.ucd.ie:5555/acc
    incoming message: request chat
    To: agentID(Alice,addresses(http://navanman.ucd.ie:5555/acc))
    storing message in: agentID(Alice,addresses(http://navanman.ucd.ie:5555/acc))
    agentID(Alice,addresses(http://navanman.ucd.ie:5555/acc)) not registered 1242706671252
    Message sent to navanman.ucd.ie:5555

    I don't know why it says "not registered" and the graphic interface in the phone emulator doesn't show any thing.

    I will be thankful with your help.

     
    • Conor

      Conor - 2009-05-19

      Hi David,

      The reason you are getting that message is either that Alice's platform has not been registered with the message server or that the server file (registeredPlatforms.xml) that contains the information related to Alice's platform has been deleted.

      When the message transport service, connects to the message server for the first time, it obtains a unique id number that it stores in the local record management store (this is the database system used in CLDC as an alternative to a file system for persistent storeage). The next time the message transport system is started, it check for the number in the local store. If the number is there, it does not register again, rather it uses the number as an identifier.

      There are two solutions to this problem. 1. Delete the relevant record managment store database files. If you are using a real phone, this can be done by deleting the application and then reinstalling it. If you are using an emulator, the record management store file should be located somewhere in the wireless toolkit directory. The relevant files should be in the appdb folder. For instance, on my computer the files are in the following location: C:\Users\Conor\j2mewtk\2.5.2\appdb\MediaControlSkin and are called run_by_class_storage_#Aliceplat#Name#Store and run_by_class_storage_#Aliceplat#Reg.
      Once the files have been deleted, run the Alice platform again. The Alice platform will then register with the server.
      2. Alternatively, you can change the name of the platform from Aliceplat to something else. Once the platform name has been changed and the platform recompiled and then rerun, it will register.

      Additionally, you should change all instances of navanman.ucd.ie to the IP address or host name of the computer that the message server is running on.

      Conor

       
      • David Saldaña

        David Saldaña - 2009-05-19

        Hi Conor,

        I am running it on the netbans emulator and I have deleted all the RMS files as you told me, but the message persists http://pastebin.com/m1f2b965d . My registeredPlatforms.xml is http://pastebin.com/m4f3eaaa1 looks fine, but I don't know why the text doesn't show any message.

        Additionally, as it is possible to see in the error message, I had created an alias from navanman.ucd.ie to localhost in the first post, but now, I have changed it for bitocampo.homelinux.com.

        Could a problem be that I am running it on Linux?

        Thanks for your help.

        David

         
        • Conor

          Conor - 2009-05-20

          hi David,

          The fact that you are running it on linux should not make a difference. In your precious post you were getting an error like the following:

          agentID(Alice,addresses(http://navanman.ucd.ie:5555/acc)) not registered 1242706671252

          are you still getting this error?

          Conor

           
          • David Saldaña

            David Saldaña - 2009-05-20

            hi Conor,

            Yes, I have the same error agentID(Alice,addresses(http://navanman.ucd.ie:5555/acc)) not registered 1242706671252
            After erasing the RMS files.

            I am using the AFME latest version (not CVS) and my Chatter agent is the same that you showed me.

             
            • Conor

              Conor - 2009-05-20

              hi David,

              Change the navanman.ucd.ie in add Bob chatUp(agentID(Alice,addresses("http://navanman.ucd.ie:5555/acc"))); in Bob's platform to the IP address or host name of your machine. Recompile the script and generated Java code and rerun the platform.

               
              • David Saldaña

                David Saldaña - 2009-05-20

                Hi Conor,

                I have made that, changing navanman.ucd.ie for bitocampo.homelinux.com and for that reason, both agents are connecting to the server, but the error persists. Bobs doesn't recongnize the id from Alice in the server.

                Please, look:

                   dav@dav-desktop:~/tmp/aa$ java com.agentfactory.mts.mpp_server.MPPServer 3333 8 5555
                      Message Server open on 3333
                      FIPA Server open on 5555
                      socket received
                      registering platform 1
                      1 Alice
                      socket received
                      socket received
                      socket received
                      socket received
                      socket received
                      registering platform 2
                      2 Bob
                      receiving: request Bob chat
                      connecting to http://bitocampo.homelinux.com:5555/acc
                      socket received
                      incoming message: request chat
                      To: agentID(Alice,addresses(http://bitocampo.homelinux.com:5555/acc))
                      storing message in: agentID(Alice,addresses(http://bitocampo.homelinux.com:5555/acc))
                      agentID(Alice,addresses(http://bitocampo.homelinux.com:5555/acc)) not registered 1242772243253
                      Message sent to bitocampo.homelinux.com:5555
                      socket received
                      socket received

                And my registeredPlatforms.xml

                <?xml version="1.0" encoding="UTF-8"?>
                <registered_platforms><platform>1<agent>Alice</agent></platform><platform>2<agent>Bob</agent></platform></registered_platforms>

                 
                • Conor

                  Conor - 2009-05-21

                  strange, it's working ok on my machine. try deleting all rms files and the registeredPlatforms.xml. Change the hostname to the IP address of your machine in all scripts. Recompile the scripts and then recompile the generated java code. Start the MPP server. Once it is started, start Alice's platform. Once, alices platform has registered, start Bob's platform. The following are the scripts that are working on my machine (taken from agentfactory.com). Notice that there is no http:// in the address that I pass to the message transport service. See if you can recognise any differences with your own configuration.

                  package netchat;

                  gui chatter.ChatterInterface;

                  platform Aliceplat{
                     
                    // Number of threads in operation on the platform
                    scheduler 2;
                   
                    service com.agentfactory.cldc.mts.MessageTransportService "193.1.132.9"
                    3333 Aliceplat SYNC 1007;
                     
                    create Alice chatter.Chatter 991;
                    start Alice;
                     
                    template com/agentfactory/cldc/compiler/MIDlet.template
                    Aliceplatlet
                    com/agentfactory/cldc/compiler/AgentPlatform.template
                    AliceplatAgentPlatform;
                     
                  }

                  package netchat;

                  gui chatter.ChatterInterface;

                  platform Bobplat{
                     
                    // Number of threads in operation on the platform
                    scheduler 2;

                    service com.agentfactory.cldc.mts.MessageTransportService "193.1.132.9"
                    3333 Bobplat SYNC 1007;
                      
                    create Bob chatter.Chatter 991;

                    add Bob chatUp(agentID(Alice,addresses("http://193.1.132.9:5555/acc")));

                    start Bob;
                     
                    template com/agentfactory/cldc/compiler/MIDlet.template
                    Bobplatlet
                    com/agentfactory/cldc/compiler/AgentPlatform.template
                    BobplatAgentPlatform;
                     
                      }

                  import com.agentfactory.cldc.Agent;

                  act chatter.ChatActuator;

                  chatUp(?agent) > request(?agent,chat);

                  message(request,sender(?agt,?addr),chat) >
                    par(request(?agt,chat),chat(?agt));

                  Remember that if you make changes to the agent design or agent platform scripts, they have to be recompiled using the AFME compiler. Once they have been recompiled, you need to compile the generated Java code. It might be an idea to delete all previously compiled class files before you compile the code (a clean build).

                   
                  • David Saldaña

                    David Saldaña - 2009-05-21

                    Hi Conor,

                    I have found the problem after downloading the source code of MPPServer and debug it. I found in the Incommming Message class that when agentMap calls for getting the key:
                      String identifier=agentMap.get(aid.toString());

                    The comparation that it does:
                    "agentID(Alice,addresses(http://192.168.1.1:5555/acc))"
                    "agentID(Alice,addresses(http://dav-desktop:5555/acc))"

                    Where 192.168.1.1 is my ip and dav-desktop is my machine name and for that reason, the comparison doesn't match and the method could not find the key.

                    I will tell you if I find something new.

                    I am very thankful for your help.

                     
                    • Conor

                      Conor - 2009-05-22

                      Hi David,

                      Yes, I think you have to either always use the fully qualified domain name or the IP address in all scripts. I will change this in a later release to use the InetAddress class in Java.

                      Conor

                       
        • Conor

          Conor - 2009-05-20

          Another thing just occured to me. What version of AFME are you using? If it is the latest version make sure that the agent design for the chatter agent is something like the following:

          import com.agentfactory.cldc.Agent;

          act ChatActuator;

          chatUp(?agent) > request(?agent,chat);

          message(request,sender(?agt,?addr),chat) >
            par(request(?agt,chat),chat(?agt));

          That is, messages in AFME now have a functor of message rather than fipaMessage.

           
    • Conor

      Conor - 2009-05-19

      It should be noted that in my previous post, if you take the second option of just changing the platform name to something else, the name passed as an argument to the message transport service in the platform script must also be changed.

      Conor

       
    • Conor

      Conor - 2009-05-21

      Another thing to note is that if you are using netbeans, you will probably have to refresh the folder in Netbeans that contains the files that are generated from the AFME compiler once the script has been recompiled. Check the relevant files to make sure the change has taken effect. Then compile the class.

       

Log in to post a comment.

Auth0 Logo