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

Struggling with class casting #21

Open
a1anw2 opened this issue Feb 17, 2014 · 0 comments
Open

Struggling with class casting #21

a1anw2 opened this issue Feb 17, 2014 · 0 comments

Comments

@a1anw2
Copy link

a1anw2 commented Feb 17, 2014

I have what is a relatively simple/standard setup; a plugin design pattern.

I can create the plugin in the new JCL classloader and get a reference to it with no problems. I create the reference to the interface using:

myPlugin = JclUtils.cast(...)

Now any method that I pass in standard JDK objects; no problems whatsoever. Everything is happy. However the problem is when i am attempting to get at a function that is passing a custom interface to it.

So my main callable interface is:

public IJobResult handle( IJobMessage job )

I create an instance of IJobMessage in the main code and when i attempt to call myPlugin.handle() it keeps

com.sun.proxy.$Proxy0 threw unexpected java.lang.reflect.UndeclaredThrowableException

with no such method. I have tried to JclUtils.cast() on the object that implements IJobMessage but that doesn't work either.

So the question is, how do I create an object in the base code and pass that to my loaded plugin loaded by JCL?

Thank you for assistance you can lend

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

1 participant