JADE cannot find agent

I am new to JADE and have a bit of trouble loading agents.

I created a new IntelliJ project and added "jade.jar" and "commons-codec-1.3.jar" (I use JADE 4.1.1) in "Dependencies" and checked the export flags (I also tried the checkbox without them). Then I added "HelloWorldAgent.java", which is provided in the examples for src. I configured startup options as:

  • Main class: jade.Boot
  • program arguments: -gui testAgent: HelloWorldAgent
  • Use module module path: jadeCW (my project name)

When I run this configuration, the JADE guy starts, but he does not find "HelloWorldAgent". Exit:

14-Feb-2012 21:43:08 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 null 14-Feb-2012 21:43:08 jade.imtp.leap.LEAPIMTPManager initialize INFO: Listening for intra-platform commands on address: - jicp://192.168.1.66:1099 14-Feb-2012 21:43:08 jade.core.BaseService init INFO: Service jade.core.management.AgentManagement initialized 14-Feb-2012 21:43:08 jade.core.BaseService init INFO: Service jade.core.messaging.Messaging initialized 14-Feb-2012 21:43:08 jade.core.BaseService init INFO: Service jade.core.resource.ResourceManagement initialized 14-Feb-2012 21:43:08 jade.core.BaseService init INFO: Service jade.core.mobility.AgentMobility initialized 14-Feb-2012 21:43:08 jade.core.BaseService init INFO: Service jade.core.event.Notification initialized 14-Feb-2012 21:43:08 jade.mtp.http.HTTPServer <init> INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser 14-Feb-2012 21:43:08 jade.core.messaging.MessagingService boot INFO: MTP addresses: http://unknown-00-19-c5-7e-cb-4b.home:7778/acc 14-Feb-2012 21:43:08 jade.core.AgentContainerImpl startBootstrapAgents SEVERE: Cannot create agent testAgent: Class HelloWorldAgent for agent ( agent-identifier :name testAgent@192.168.1.66 :1099/JADE ) not found [nested java.lang.ClassNotFoundException: HelloWorldAgent] 14-Feb-2012 21:43:08 jade.core.AgentContainerImpl joinPlatform INFO: -------------------------------------- Agent container Main-Container@192.168.1.66 is ready. 

The key issue is:

 SEVERE: Cannot create agent testAgent: Class HelloWorldAgent for agent ( agent-identifier :name testAgent@192.168.1.66 :1099/JADE ) not found [nested java.lang.ClassNotFoundException: HelloWorldAgent] 

I tried using eclipse, but I have the same problem, I also tried using an earlier version of JADE, but again, no luck. Any help would be greatly appreciated.

Many thanks

Dan

+6
source share
6 answers

It seems that the place where I put "jade.jar" and "commons-codec-1.3.jar" was a problem (I originally put them in / Library / Java / Extensions (on OSX lion)). I tried deleting them by placing them in another place and trying again, and now it works. Not quite sure why the mind!

0
source

At startup, you must pass the fully qualified class name. In my old version of JADE, HelloWorldAgent is in the examples.hello package. Thus, you must specify the program arguments: -gui testAgent:examples.hello.HelloWorldAgent .

+6
source

Just add the package name in front of the class name

-gui testAgent: packageName.HelloWorldAgent

+3
source

You need to add:

 -gui nameAgent:packageName.className 
+1
source

In my case, it was an extra space after the agent name:

 -gui nameAgent: packageName.className 

After removing the space and adding the project to the classpath, everything worked correctly.

 -gui nameAgent:packageName.className 
0
source

I ran into another problem, so I thought that I would write a solution for her here so that she could help someone. When writing class paths using "-cp" or "-classpath", write the path only to the name of the output folder and do not include folders created for namespaces. For example, if your agent class is in the namespace "sample.namespace", the javac command will create a directory structure, such as "bin \ sample \ namespace", and place the files there. In this case, do not include "sample \ namespace" in the class path. Just the path to the bin folder, the name of the output folder (bin) may be different.

0
source

Source: https://habr.com/ru/post/1396511/


All Articles