Hi again,

I think the problem is what is described here:

===================
http://freemarker.blogspot.co.nz/2010/02/freemarker-on-google-app-engine.html#c7806981190571108253

GAE will replace java.lang.reflect.* classes on the fly with its own
doppelgangers defined in
"com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect."
This causes problems when, say, a class tries to reflectively access a
private member of itself, or a package-private member of another class
in its package. This works in a compliant JRE as java.lang.reflect.*
classes aren't subject to security checks, but it fails with GAE as
their doppelgangers won't have the necessary permissions. See this
message for an example:

http://www.mail-archive.com/[email protected]/msg00865.html

Here, a class named "freemarker.ext.beans.BeansWrapper" tries to
reflectively create an instance of "freemarker.ext.beans.EnumModels"
using a package-private constructor. In a compliant JRE, this works
flawlessly, since they're both in the same package. Under GAE, it
won't work because of intervening doppelganger Constructor instance.
I'm not sure what GAE is trying to achieve by intercepting reflection
(that couldn't be achieved by a carefully tuned security policy file
instead).

=================

So, I've changed our code a bit and what I'm seeing is that, using
reflection, some members are not accessible even if they're public.
So, a call to Field.set() throws an exception.
Then I catch the exception and I manage to call
Field.setAccessible(true). Finally Field.set() succeeds.

So I thought the exception I was seeing was being thrown by
setAccessible() instead is thrown by setField().
I'm going to write a unit test and hopefully that will give you an
example!

Thanks,
Emanuele

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to