Menu

IBDIAgentFeature bdi - DuplicateResultException

Help
2016-12-04
2016-12-05
  • Filipe Magalhães Moreira

    I will be honest I have no idea why this throws an exeption but it does, when I try to run the project is throws,If anyone knows why this is happening I would appriciate some help since I have been stuck in this for quite some time, it would be noteworthy to say I am new to Jadex.

    Thanks in advance :D

    Future: jadex.commons.future.Future@5baf4915
    DuplicateResultException(exception1=jadex.bridge.component.FeatureNotAvailableException: No such feature: interface jadex.bdiv3.features.IBDIAgentFeature, result2=null)
        at jadex.commons.future.Future.doSetResult(Future.java:422)
        at jadex.commons.future.Future.setResult(Future.java:375)
        at jadex.micro.features.impl.MicroInjectionComponentFeature.init(MicroInjectionComponentFeature.java:235)
        at jadex.platform.service.cms.PlatformComponent.executeInitOnFeatures(PlatformComponent.java:292)
        at jadex.platform.service.cms.PlatformComponent$1.execute(PlatformComponent.java:144)
        at jadex.bridge.component.impl.ExecutionComponentFeature.execute(ExecutionComponentFeature.java:1162)
        at jadex.commons.concurrent.Executor.code(Executor.java:299)
        at jadex.commons.concurrent.Executor.run(Executor.java:126)
        at jadex.platform.service.execution.AsyncExecutionService$1.run(AsyncExecutionService.java:109)
        at jadex.commons.concurrent.ThreadPool$ServiceThread.run(ThreadPool.java:515)
    jadex.bridge.component.FeatureNotAvailableException: No such feature: interface jadex.bdiv3.features.IBDIAgentFeature
        at jadex.platform.service.cms.PlatformComponent.getComponentFeature(PlatformComponent.java:630)
        at jadex.micro.features.impl.MicroInjectionComponentFeature.init(MicroInjectionComponentFeature.java:156)
        at jadex.platform.service.cms.PlatformComponent.executeInitOnFeatures(PlatformComponent.java:292)
        at jadex.platform.service.cms.PlatformComponent$1.execute(PlatformComponent.java:144)
        at jadex.bridge.component.impl.ExecutionComponentFeature.execute(ExecutionComponentFeature.java:1162)
        at jadex.commons.concurrent.Executor.code(Executor.java:299)
        at jadex.commons.concurrent.Executor.run(Executor.java:126)
        at jadex.platform.service.execution.AsyncExecutionService$1.run(AsyncExecutionService.java:109)
        at jadex.commons.concurrent.ThreadPool$ServiceThread.run(ThreadPool.java:515)
    
    import jadex.bdiv3.annotation.Body;
    import jadex.bdiv3.annotation.Plan;
    import jadex.bdiv3.annotation.Plans;
    import jadex.bdiv3.features.IBDIAgentFeature;
    import jadex.micro.annotation.Agent;
    import jadex.micro.annotation.AgentBody;
    import jadex.micro.annotation.AgentFeature;
    import jadex.micro.annotation.Description;
    
    @Agent
    @Description("The translation agent A1. <br> Empty agent that can be loaded and started.")
    @Plans(@Plan(body = @Body(TranslationPlan.class)))
    public class TranslationBDIAgent {
    
        @AgentFeature
        protected IBDIAgentFeature bdi;
    
        @AgentBody
        public void body() {
            bdi.adoptPlan(new TranslationPlan());
        }
    }
    
    package a1;
    
    import java.util.HashMap;
    import java.util.Map;
    
    import jadex.bdiv3.annotation.Plan;
    import jadex.bdiv3.annotation.PlanBody;
    
    @Plan
    public class TranslationPlan {
        protected Map<String, String> wordtable;
    
        public TranslationPlan() {
            this.wordtable = new HashMap<String, String>();
            this.wordtable.put("coffee", "Kaffee");
            this.wordtable.put("milk", "Milch");
            this.wordtable.put("cow", "Kuh");
            this.wordtable.put("cat", "Katze");
            this.wordtable.put("dog", "Hund");
            // Init the wordtable and add some words
        }
    
        @PlanBody
        public void translateEnglishGerman() {
            String eword = "dog";
            String gword = wordtable.get(eword);
            System.out.println("Translated: " + eword + " - " + gword);
            // Fetch some word from the table and print the translation
        }
    }
    
    package main;
    
    import jadex.base.PlatformConfiguration;
    import jadex.base.Starter;
    
    public class Main {
        public static void main(String[] args) {
    
            PlatformConfiguration config = PlatformConfiguration.getDefault();
    
            config.addComponent("a1.TranslationBDIAgent.class");
            Starter.createPlatform(config).get();
        }
    }
    
     

    Last edit: Filipe Magalhães Moreira 2016-12-04
  • KaiJ

    KaiJ - 2016-12-05

    Hi,

    if you want to implement a BDI agent (as opposed to a micro agent) your class name has to end with BDI, not Agent, i.e. TranslationBDI not TranslationBDIAgent.

    Agent classes that end with "Agent" are considered to be micro agent which do not have the BDI features (we know this is less than ideal, but it allows us to quickly identify classes without actually having to load them when scanning directories/jars).

    Kai

     
  • Filipe Magalhães Moreira

    Hi,

    Kai I love you, you are awesome and I am a very very dumb person.
    Thank you for your time.

     

Log in to post a comment.