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

Exception does not propegate to the client from the server (InvocationTargetException) #33

Closed
gaborbernat opened this issue Jul 10, 2014 · 8 comments

Comments

@gaborbernat
Copy link
Contributor

When I throw a RuntimeException from the server it does not fully extract the source exception and such sends an InvocationTargetException to the client. However, this cannot be instantianated, so the client throws:

 WARNING: Unable to find a suitable constructor for        java.lang.reflect.InvocationTargetException
 Exception in thread "main" com.googlecode.jsonrpc4j.JsonRpcClientException: null
    at        com.googlecode.jsonrpc4j.DefaultExceptionResolver.createJsonRpcClientException(DefaultExceptionResolver.java:80)

Here's a quick test project (https://github.com/gaborbernat/json4j-rpc-test). You need to run:

./gradlew server:appRun
./gradlew client:run

Any ideas what's wrong and how to fix it?

Thanks,

@bgaborg
Copy link
Contributor

bgaborg commented Jul 17, 2014

I have the same issue too!!
What would be a solution?

bgaborg pushed a commit to bgaborg/jsonrpc4j that referenced this issue Jul 22, 2014
…Service. When CompositeService is being used, the exception gets wrapped 2 times. Changing the if to while when unwrapping causes the exception to be well unwrapped.
@bgaborg
Copy link
Contributor

bgaborg commented Jul 22, 2014

I think I've solved the issue. The problem was when using CompositeService. It wraps the exeption thrown two times, and then it gets unwrapped only one time.

The fix is here:
bgaborg@a92c8a6

bgaborg pushed a commit to bgaborg/jsonrpc4j that referenced this issue Jul 23, 2014
…eService. When CompositeService is being used, the exception gets wrapped 2 times. Changing the if to while when unwrapping causes the exception to be well unwrapped.
@stfnlutter
Copy link

Thank you, I encountered the same problem and the fix solved it for me. I commented on the fix conversation - I'd love to see this merged to brian's branch, I would greatly appreciate his feedback.

Thanks

@gaborbernat
Copy link
Contributor Author

Can we apply the pull request?

@folsson
Copy link

folsson commented Mar 4, 2015

I would also love to see this patch merged to upstream.
@bgaborg, I think that @briandilley is waiting for you to actually create the pull request?

@folsson
Copy link

folsson commented Jul 7, 2015

@briandilley, any progress on this?

@gaborbernat
Copy link
Contributor Author

This has been merged in. Unfortunatly no release since then, but around the end of the month I'll aim for a new release (1.2.0?).

@folsson
Copy link

folsson commented Jul 8, 2015

Awesome!

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

4 participants