Troubleshooting

   

Reflection Permission Denied

You get a runtime error that says you do not have permission to perform a requested Reflection operation.

Reflection often includes requests that conflict with the access restrictions assigned to a class and its members . If you need to perform Reflection that is not by default granted by the SecurityManager, you need to explicitly grant the appropriate permission. This is typically done by adding the following entry to the associated policy file, which is the means used within the Java security architecture to specify the security policy in effect at runtime:

 permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; 

The default policy is determined by the java.policy file in the lib\ security directory underneath your JRE directory (for example, c:\Program Files\JavaSoft\JRE\1.3\lib\security ). For more information on the use of policy files, refer to Sun's documentation available at http://java.sun.com/docs/books/tutorial/ext/security/policy.html.

No Class Members Reflected

You query a Class object for its fields and methods , but nothing is returned.

Remember that a Class object does not necessarily represent a class, or even an interface. A Class instance might also represent an array, a primitive type, or even the keyword void. You should use the isArray, isInterface, and isPrimitive methods to determine more information about an instance when in doubt.

   


Special Edition Using Java 2 Standard Edition
Special Edition Using Java 2, Standard Edition (Special Edition Using...)
ISBN: 0789724685
EAN: 2147483647
Year: 1999
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net