For some reasons you might want to turn Java Security Management off for Google Appengine Development Environment.
I need this for properly handling of Tapestry5 error page. With Java SecurityManager enabled it produced the following errors:
Could not initialize class org.apache.tapestry5.corelib.components.Loop
java.lang.NoClassDefFoundError: Could not initialize class
org.apache.tapestry5.corelib.components.Loop
java.lang.NoClassDefFoundError:
org/apache/tapestry5/corelib/components/Loop$1
To turn it off, you should replace two classes in SDK, that are responsible to installing Security Manager.
- Close all Eclipse instances
- Locate appengine-tools-api.jar:
%YOUR_ECLIPSE_FOLDER%\plugins\com.google.appengine.eclipse.sdkbundle_1.2.2.v200907291526\appengine-java-sdk-1.2.2\lib\appengine-tools-api.jar
- Replace original classes
com\google\appengine\tools\development\DevAppServerFactory$CustomSecurityManager.class
andcom\google\apphosting\utils\security\SecurityManagerInstaller.class
with ones provided below (you may want to do a backup first)
Thats all. Now after starting App Engine project in eclipse you should see the following output in console:
Skip install SecurityManager
Create dummy CustomSecurityManager
The server is running at http://localhost:8080/
Just keep in mind that original App Engine cloud still have those Security Managers installed.
FYI here is the sources of those classes:
DevAppServerFactory.java
package com.google.appengine.tools.development;
import java.security.Permission;
public class DevAppServerFactory {
public static class CustomSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm) {
// Do nothing
}
public CustomSecurityManager(DevAppServer devAppServer) {
System.out.println("Create dummy CustomSecurityManager");
}
}
}
SecurityManagerInstaller.java
package com.google.apphosting.utils.security;
import java.net.URL;
public class SecurityManagerInstaller {
public static void install(URL... urls) {
System.out.println("Skip install SecurityManager");
}
}
Download Google App Engine/Java 1.2.2 Security Manager patch here (3 KB)
Dmitry, very cool tip, not being able to run the local dev server is a real pain in the neck ! Thanks for the tip, good stuff !
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete