Class agent.ContinuousDcopAgent for agent not found

70 Views Asked by At

I am currently working on a java program that uses many libraries. Now it should create many agents who would perform individually. I have compiled and Main.java file and now I am trying to run it. This is the command I am using to run the file.

java -cp "../jade.jar:../weka.jar:../guava.jar:../elki.jar:../bounce.jar:../commons-lang.jar:." main.Main 1 2 3 4

But it's showing me this error every time I am running it.

jade.core.IMTPException: Class agent.ContinuousDcopAgent for agent ( agent-identifier :name "[email protected]:1099/JADE" ) not found - Caused by:  agent.ContinuousDcopAgent
        at jade.core.management.AgentManagementService$CommandTargetSink.createAgent(AgentManagementService.java:624)
        at jade.core.management.AgentManagementService$CommandTargetSink.handleRequestCreate(AgentManagementService.java:533)
        at jade.core.management.AgentManagementService$CommandTargetSink.consume(AgentManagementService.java:488)
        at jade.core.CommandProcessor$SinksFilter.accept(CommandProcessor.java:253)
        at jade.core.Filter.filter(Filter.java:89)
        at jade.core.Filter.filter(Filter.java:90)
        at jade.core.Filter.filter(Filter.java:90)
        at jade.core.CommandProcessor.processIncoming(CommandProcessor.java:229)
        at jade.core.BaseNode.serveVerticalCommand(BaseNode.java:163)
        at jade.core.BaseNode.serveHorizontalCommand(BaseNode.java:111)
        at jade.imtp.leap.NodeLEAP.accept(NodeLEAP.java:60)
        at jade.core.management.AgentManagementProxy.createAgent(AgentManagementProxy.java:67)
        at jade.core.AgentContainerImpl$1.createAgent(AgentContainerImpl.java:176)
        at jade.wrapper.ContainerController.createNewAgent(ContainerController.java:135)
        at main.Main.main(Main.java:38)
Nested Exception:
java.lang.ClassNotFoundException: agent.ContinuousDcopAgent
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at jade.core.management.AgentManagementService$CommandTargetSink.createAgent(AgentManagementService.java:612)
        at jade.core.management.AgentManagementService$CommandTargetSink.handleRequestCreate(AgentManagementService.java:533)
        at jade.core.management.AgentManagementService$CommandTargetSink.consume(AgentManagementService.java:488)
        at jade.core.CommandProcessor$SinksFilter.accept(CommandProcessor.java:253)
        at jade.core.Filter.filter(Filter.java:89)
        at jade.core.Filter.filter(Filter.java:90)
        at jade.core.Filter.filter(Filter.java:90)
        at jade.core.CommandProcessor.processIncoming(CommandProcessor.java:229)
        at jade.core.BaseNode.serveVerticalCommand(BaseNode.java:163)
        at jade.core.BaseNode.serveHorizontalCommand(BaseNode.java:111)
        at jade.imtp.leap.NodeLEAP.accept(NodeLEAP.java:60)
        at jade.core.management.AgentManagementProxy.createAgent(AgentManagementProxy.java:67)
        at jade.core.AgentContainerImpl$1.createAgent(AgentContainerImpl.java:176)
        at jade.wrapper.ContainerController.createNewAgent(ContainerController.java:135)
        at main.Main.main(Main.java:38)
jade.wrapper.StaleProxyException: Class agent.ContinuousDcopAgent for agent ( agent-identifier :name "[email protected]:1099/JADE" ) not found - Caused by:  agent.ContinuousDcopAgent
        at jade.wrapper.ContainerController.createNewAgent(ContainerController.java:140)
        at main.Main.main(Main.java:38)

This is my Main.java file

package main;

import agent.DcopConstants;
import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.wrapper.AgentController;
import jade.wrapper.ContainerController;
import jade.wrapper.StaleProxyException;

public class Main {

  public static void main(String[] args) {
    args[0] = "rep_2_d3.dzn";
    args[1] = "hybrid_maxsum";
    args[2] = "1";
    args[3] = "3";

    String inputFileName = args[0]; // "rep_0_d10.dzn"; 
    String a[] = inputFileName.replaceAll("rep_","").replaceAll(".dzn","").split("_d");
    int noAgent = Integer.parseInt(a[1]); 
    
    String arg[] = new String[4];
    arg[0] = inputFileName; // The filename decides number of agents
    arg[1] = String.valueOf(parseAlgorithm(args[1])); 
    arg[2] = args[2]; // number of iterations
    arg[3] = args[3]; // number of pointsShare
    
    Runtime rt = Runtime.instance();
    rt.setCloseVM(true);
    Profile p = new ProfileImpl();
    p.setParameter(Profile.MAIN_HOST, "localhost");
    p.setParameter(Profile.GUI, "false");
    ContainerController cc = rt.createMainContainer(p);
    for (int i = 1; i <= noAgent; i++) {
      AgentController ac;
      try {
        ac = cc.createNewAgent(String.valueOf(i), "agent.ContinuousDcopAgent", arg);
        ac.start();
      } catch (StaleProxyException e) {
        e.printStackTrace();
      }
    }
  }
  
  // "EF_DPOP", "DPOP", "AF_DPOP", "CAF_DPOP", "MAXSUM", "HYBRID_MAXSUM", "CAF_MAXSUM", 
  // "DISCRETE_DPOP", "DISCRETE_DSA", "CONTINUOUS_DSA"};  
  public static int parseAlgorithm(String algorithm) {
    switch (algorithm) {
      case "ef_dpop":         return DcopConstants.EF_DPOP;
      case "dpop":            return DcopConstants.DPOP;
      case "af_dpop":         return DcopConstants.AF_DPOP;
      case "caf_dpop":        return DcopConstants.CAF_DPOP;
      case "maxsum":          return DcopConstants.MAXSUM;
      case "hybrid_maxsum":   return DcopConstants.HYBRID_MAXSUM;
      case "caf_maxsum":      return DcopConstants.CAF_MAXSUM;
      case "discrete_dpop":   return DcopConstants.DISCRETE_DPOP;
      case "discrete_dsa":    return DcopConstants.DISCRETE_DSA;
      case "continuous_dsa":  return DcopConstants.CONTINUOUS_DSA;
      default:                return -1;
    }
  }
}

This is the directory I am currently in.

.
├── agent
│   ├── ContinuousDcopAgent.java
│   ├── DcopConstants.class
│   └── DcopConstants.java
├── APDescription.txt
├── behavior
│   ├── AGENT_TERMINATE.java
│   ├── BROADCAST_RECEIVE_HEURISTIC_INFO.java
│   ├── CONTINUOUS_DSA.java
│   ├── DISCRETE_DSA.java
│   ├── DPOP_UTIL.java
│   ├── DPOP_VALUE.java
│   ├── MAXSUM_FUNCTION_TO_VARIABLE.java
│   ├── MAXSUM_VARIABLE_TO_FUNCTION.java
│   ├── PROPAGATE_RECEIVE_VALUE.java
│   ├── PSEUDOTREE_GENERATION.java
│   ├── RECEIVE_SEND_UTIL_TO_ROOT.java
│   └── SEARCH_NEIGHBORS.java
├── function
│   ├── Function.java
│   ├── Interval.java
│   └── multivariate
│       ├── MultivariateCubicFunction.java
│       ├── MultivariateQuadFunction.java
│       ├── PiecewiseMultivariateCubicFunction.java
│       └── PiecewiseMultivariateQuadFunction.java
├── main
│   ├── Main.class
│   └── Main.java
├── maxsum
│   └── MaxSumMessage.java
├── MTPs-Main-Container.txt
├── table
│   ├── Row.java
│   └── Table.java
├── transition
│   └── TransitionFunction.java
├── utilities
│   └── Utilities.java
├── zexception
│   └── FunctionException.java
└── ztest
    ├── DpopTest.java
    └── TestFunction.java

11 directories, 33 files

I don't know to proceed from here. Any kind o help would be appreciated.

0

There are 0 best solutions below