Dan
Dan

Reputation: 223

JADE cannot find agent

I'm new to JADE and am having a bit of trouble loading agents.

I created a new IntelliJ project and added "jade.jar" and "commons-codec-1.3.jar" (I'm using JADE 4.1.1) in "Dependencies" and ticked the export boxes (I've also tried without them ticked). I then added the "HelloWorldAgent.java" that comes in the examples to the src. I set up the run configurations as:

When I run using this configuration the JADE guy does start but it does not find the "HelloWorldAgent". The output is:

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 [email protected]:1099/JADE ) not found [nested java.lang.ClassNotFoundException: HelloWorldAgent]
14-Feb-2012 21:43:08 jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container [email protected] is ready.

The key problem clearly being:

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

I've tried using eclipse but I get the same problem, I also tried using a earlier version of JADE but again, no luck. Any help would be much appreciated.

Many Thanks

Dan

Upvotes: 6

Views: 9584

Answers (6)

Ali tariq
Ali tariq

Reputation: 11

I was facing another problem so I thought I would write the the solution for it here so that it could help someone. While writing the class path with "-cp" or "-classpath", write the path till the output folder name only and dont include the folders created for namespaces. For example, if your agent class is in namespace "sample.namespace" the javac command will create a directory structure like "bin\sample\namespace" and put the files there. In this case don't include "sample\namespace" in the class path. Just the path till "bin" folder the name of the output folder(bin) can be different.

Upvotes: 0

Nicolas Forero
Nicolas Forero

Reputation: 864

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

Upvotes: 0

Igle
Igle

Reputation: 21

You need to add:

-gui nameAgent:packageName.className

Upvotes: 2

user2698049
user2698049

Reputation: 41

Just add the Package Name before the class Name

-gui testAgent:packageName.HelloWorldAgent

Upvotes: 4

Dan
Dan

Reputation: 223

It seems that the location I put the "jade.jar" and "commons-codec-1.3.jar" was the problem (I originally put them in /Library/Java/Extensions (in OSX lion)). I tried removing them, putting them somewhere else and tried again and now it works. Not entirely sure why mind!

Upvotes: 0

DoctorRuss
DoctorRuss

Reputation: 1439

You need to pass the fully qualified name of the class when you start it. On my old version of JADE, the HelloWorldAgent is in the examples.hello package. Thus you should specify the program arguments: -gui testAgent:examples.hello.HelloWorldAgent.

Upvotes: 6

Related Questions