简体   繁体   中英

App Engine: Reflection is not allowed on private java.lang.Throwable java.lang.Throwable.cause

Today I went to deploy a java application I've created up to Google App Engine, and I am being roadblocked by some very unhelpful error messages.

Invocation of init method failed; nested exception is java.lang.SecurityException:
java.lang.IllegalAccessException: Reflection is not allowed on private 
java.lang.Throwable java.lang.Throwable.cause

Followed by a stack-trace that doesn't mention any of my classes: there is no line of my code I can point to as causing this.

This application uses Objectify and Spring MVC, and works fine on my local development server (App Engine version 1.7.4).

I've gone through my code and removed any mention of "cause" from any of the exception classes I use. I still have this problem. Also, there is only one type of Exception my controllers can throw, and this again makes no mention of cause.

Any ideas?

PS I found this discussion , but wasnt very informative.

In case anyone else comes across similar problems, they have something to do with the code running under sandbox security restrictions when on the appengine servers, but without such restrictions when running on a local development server.

The sandbox restrictions don't allow reflection on private variables.

In my case, I was using Gson for serialization, which uses reflection heavily in ways that are difficult to debug. I still have no idea where or why it was trying to perform reflection on the Throwable thingie it talks about in the stack trace. Regardless, all of my problems went away when I switched to using Jackson instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM