Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding components only works with a magic string path (Jadex 3.0.117) #3

Open
fredericjacob opened this issue Jun 11, 2020 · 1 comment

Comments

@fredericjacob
Copy link

I found a strange issue when starting a platform over a PlatformConfiguration with added components. The platform starts up fine if I directly use a magic string for the full path of the added component:

config.addComponent("myproject.mypackage.MyAgent.class");

However, config.addComponent(MyAgent.class); does not work (the platform does not start properly and Jadex hangs up), although Jadex should support Class objects.
Interestingly, even this does not work, although the same string content is passed:

String path = MyAgent.class.getName() + ".class";
config.addComponent(path);

So the only possibility is to use the magic string as argument as shown above, which makes platform definitions quite error-prone for refactorings. I cannot explain this behavior, but it should be a bug, I guess.

@jellelicht
Copy link
Contributor

@fredericjacob this might have something to do with the fact that Jadex dynamically enhances your classfiles to be able to do BDI-related things. This can only happen before the JVM loads the class using a ClassLoader: by referring to MyAgent.class, you load the class, making the required enhancements no longer possible.

You could look into the jadex.bdiv3.BDIEnhancer.enhanceBDIClasses method to see if you can integrate that in your build steps; that would make this enhancement happen as a part of your builds instead of at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants