简体   繁体   English

App Engine:私有java.lang.Throwable java.lang.Throwable.cause上不允许进行反射

[英]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. 今天,我去部署了由Google App Engine创建的Java应用程序,但由于一些非常无用的错误消息而使我受阻。

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). 该应用程序使用Objectify和Spring MVC,并且可以在我的本地开发服务器(App Engine版本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. 如果其他任何人遇到类似的问题,则它们与在appengine服务器上在沙箱安全性限制下运行的代码有关,而在本地开发服务器上运行时不受此类限制。

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. 就我而言,我使用Gson进行序列化,该序列以难以调试的方式大量使用反射。 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. 我仍然不知道它试图在堆栈跟踪中谈论的Throwable事物上执行反射的位置或原因。 Regardless, all of my problems went away when I switched to using Jackson instead. 无论如何,当我改用Jackson时,我所有的问题都消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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