经过研究发现。google 的限制jar 是
appengine-tools-api
修改类:
com.google.appengine.tools.development.DevAppServerFactory
就可以再本地环境适应 hibernate 连接数据库。创建线程,创建文件等操作。(当然你改的是本地环境。google服务器上的是没有办法了。)
这样做主要是为了开发 gwt 应用的。
修改类如下:
/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
package com.google.appengine.tools.development;
import com.google.apphosting.utils.security.SecurityManagerInstaller;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.security.Permission;
import java.security.Permissions;
import java.util.*;
// Referenced classes of package com.google.appengine.tools.development:
// DevAppServerClassLoader, DevAppServer, AppContext
public class DevAppServerFactory {
private static class CustomSecurityManager extends SecurityManager {
private synchronized boolean appHasPermission(Permission perm) {
return true;
/** 直接返回 */
}
public void checkPermission(Permission perm) {
return;
/** 直接返回 */
}
public void checkPermission(Permission perm, Object context) {
return;
/** 直接返回 */
}
public void checkAccess(ThreadGroup g) {
return;
/** 直接返回 */
}
public void checkAccess(Thread t) {
return;
/** 直接返回 */
}
public boolean isDevAppServerThread() {
return true;
/** 直接返回 */
}
private StackTraceElement getCallerFrame() {
StackTraceElement frames[] = Thread.currentThread().getStackTrace();
for (int i = 1; i < frames.length; i++)
if (!"checkAccess".equals(frames[i].getMethodName())
&& !getClass().getName().equals(
frames[i].getClassName()))
return frames[i];
throw new IllegalStateException(
"Unable to determine calling frame.");
}
private static final RuntimePermission PERMISSION_MODIFY_THREAD_GROUP = new RuntimePermission(
"modifyThreadGroup");
private static final RuntimePermission PERMISSION_MODIFY_THREAD = new RuntimePermission(
"modifyThread");
private static final String KEYCHAIN_JNILIB = "/libkeychain.jnilib";
private static final Object PERMISSION_LOCK = new Object();
private final DevAppServer devAppServer;
public CustomSecurityManager(DevAppServer devAppServer) {
this.devAppServer = devAppServer;
}
}
public DevAppServerFactory() {
}
public DevAppServer createDevAppServer(File appDir, String address, int port) {
return createDevAppServer(appDir, null, null, address, port, true);
}
private DevAppServer createDevAppServer(File appDir, File webXmlLocation,
File appEngineWebXmlLocation, String address, int port,
boolean useCustomStreamHandler) {
return createDevAppServer(appDir, webXmlLocation,
appEngineWebXmlLocation, address, port, useCustomStreamHandler,
true, ((Map) (new HashMap())));
}
public DevAppServer createDevAppServer(File appDir, File webXmlLocation,
File appEngineWebXmlLocation, String address, int port,
boolean useCustomStreamHandler, boolean installSecurityManager,
Collection classpath) {
Map containerConfigProps = newContainerConfigPropertiesForTest(classpath);
return createDevAppServer(appDir, webXmlLocation,
appEngineWebXmlLocation, address, port, useCustomStreamHandler,
installSecurityManager, containerConfigProps);
}
private Map newContainerConfigPropertiesForTest(Collection classpath) {
Map containerConfigProps = new HashMap();
Map userCodeClasspathManagerProps = new HashMap();
userCodeClasspathManagerProps.put(
"devappserver.userCodeClasspathManager.classpath", classpath);
userCodeClasspathManagerProps.put(
"devappserver.userCodeClasspathManager.requiresWebInf",
Boolean.valueOf(false));
containerConfigProps.put("devappserver.userCodeClasspathManager",
userCodeClasspathManagerProps);
return containerConfigProps;
}
private DevAppServer createDevAppServer(File appDir, File webXmlLocation,
File appEngineWebXmlLocation, String address, int port,
boolean useCustomStreamHandler, boolean installSecurityManager,
Map containerConfigProperties) {
if (installSecurityManager)
SecurityManagerInstaller.install(new URL[0]);
DevAppServerClassLoader loader = DevAppServerClassLoader
.newClassLoader(com.google.appengine.tools.development.DevAppServerFactory.class
.getClassLoader());
testAgentIsInstalled();
DevAppServer devAppServer;
try {
Class devAppServerClass = Class.forName(
"com.google.appengine.tools.development.DevAppServerImpl",
true, loader);
Constructor cons = devAppServerClass
.getConstructor(DEV_APPSERVER_CTOR_ARG_TYPES);
cons.setAccessible(true);
devAppServer = (DevAppServer) cons.newInstance(new Object[] {
appDir, webXmlLocation, appEngineWebXmlLocation, address,
Integer.valueOf(port),
Boolean.valueOf(useCustomStreamHandler),
containerConfigProperties });
} catch (Exception e) {
Throwable t = e;
if (e instanceof InvocationTargetException)
t = e.getCause();
throw new RuntimeException("Unable to create a DevAppServer", t);
}
if (installSecurityManager)
System.setSecurityManager(new CustomSecurityManager(devAppServer));
return devAppServer;
}
private void testAgentIsInstalled() {
try {
// AppEngineDevAgent.getAgent();
} catch (Throwable t) {
String msg = "Unable to locate the App Engine agent. Please use dev_appserver, KickStart, or set the jvm flag: \"-javaagent:<sdk_root>/lib/agent/appengine-agent.jar\"";
throw new RuntimeException(msg, t);
}
}
static final String DEV_APP_SERVER_CLASS = "com.google.appengine.tools.development.DevAppServerImpl";
private static final Class DEV_APPSERVER_CTOR_ARG_TYPES[];
private static final String USER_CODE_CLASSPATH_MANAGER_PROP = "devappserver.userCodeClasspathManager";
private static final String USER_CODE_CLASSPATH = "devappserver.userCodeClasspathManager.classpath";
private static final String USER_CODE_REQUIRES_WEB_INF = "devappserver.userCodeClasspathManager.requiresWebInf";
static {
DEV_APPSERVER_CTOR_ARG_TYPES = (new Class[] { java.io.File.class,
java.io.File.class, java.io.File.class, java.lang.String.class,
Integer.TYPE, Boolean.TYPE, java.util.Map.class });
}
}
/*
* DECOMPILATION REPORT
*
* Decompiled from:
* D:\soft\eclipse_3.7.2\plugins\com.google.appengine.eclipse.sdkbundle_1
* .6.4.v201203300216r37\appengine-java-sdk-1.6.4\lib\appengine-tools-api.jar
* Total time: 174 ms Jad reported messages/errors: Overlapped try statements
* detected. Not all exception handlers will be resolved in the method
* appHasPermission Couldn't fully decompile method appHasPermission Couldn't
* resolve all exception handlers in method appHasPermission Exit status: 0
* Caught exceptions:
*/
附件是 appengine-java-sdk-1.6.4\lib\appengine-tools-api.jar 的jar包。替换就可以了。
jar 文件大于 10 MB 所以压缩了下。解压缩再替换。
分享到:
相关推荐
谷歌appengine依赖库,GWT编译需要引入此库,方便好用!
gwt-windows-1.6.4.part2.rargwt-windows-1.6.4.part2.rargwt-windows-1.6.4.part2.rargwt-windows-1.6.4.part2.rargwt-windows-1.6.4.part2.rargwt-windows-1.6.4.part2.rargwt-windows-1.6.4.part2.rar
gwt-windows-1.6.4.part3.rargwt-windows-1.6.4.part3.rargwt-windows-1.6.4.part3.rargwt-windows-1.6.4.part3.rargwt-windows-1.6.4.part3.rargwt-windows-1.6.4.part3.rargwt-windows-1.6.4.part3.rar
基于Google App Engine(GAE)的Java和GWT应用开发_Google App Engine Java and GWT Application Development Nov.2010
gwt 1.6.4 for windows gwt 1.6.4 for windows
中文名: 基于Google App Engine(GAE)的Java和GWT应用开发 原名: Google App Engine Java and GWT Application Development 作者: Daniel Guermeur, Amy Unruh 资源格式: PDF 版本: 文字版 出版社: Packt ...
它使用带有纯 Maven 配置的 Google Web Toolkit,适用于希望在 Google App Engine 之上构建的开发人员,使用 Google 的 HRD、Schemaless Datastore,而无需向 IDE 添加框架配置或插件。 该项目不是示例应用程序,...
EXT-GWT2.0.1+API+DOC gwtdesigner Gwt-Ext基础-中级-进阶 GWT快速开发 GWT入门 GWT中文教程
正在做一个gwt项目的开发,我会把在项目开发中遇到的问题以及解决方法记录下来(有很多是同事,也整理放在其中了),以供同道中人参考,少走不该走的路,也希望与同仁交流。 gwt的1.4发布了,好久没有更新我的文章...
EXT-GWT2.1.0 java api 文档 chm格式方便查找2010年7月制作 完美的搜索,支持全文检索功能。另新版本EXT-GWT2.2.0 java api 已可用请到http://download.csdn.net/source/2700814 下载
C:\程序开发\Java\gwt-windows-1.4.59 doc(文档目录,开发文档和Java API文档) samples(示例代码目录,非常有名的KitchenSink示例代码即在此目录中) about.html about.txt applicationCreator.cmd ...
如今,编写网络应用程序是一个单调乏味且易于出错的过程。开发人员可能要花费 90% ...Google Web 工具包 (GWT) 通过允许开发人员用 Java 编程语言快速构建和维护复杂但高性能的 JavaScript 前端应用程序来减轻该负担。
EXT-GWT 2.2.0 API DOC (gxt) chm 版 。 2010年10月制作。完美的搜索功能。如果打不开,请选中它,点右键 看属性,选择解除锁定。别再抱怨打不开了。
GWT快速开发(GWT) 是一个Java软件开发框架用于开发类似于Google Maps和Gmail的AJAX应用程序。GWT的设计参考Java AWT包设计,类命名规则、接口设计、事件监听等。你可以用Java编程语言开发你的界面,然后用GWT编译器将...
GWT API文档(史上最全),通过java写WEBUI,开发必不可少的文档,Gwt将不同模块页面生成到相关文件及页面,使用IFrame方式将各个模块组合在在HTML页面中
gwt代码调试插件gwt-dev-plugin-x86.msi,针对ie浏览器使用
#GWT-Maps-V3-Api 该库为Google Maps Javascript API提供Java语言绑定。 ## Demo #####社区### ##实施者示例:示例:[从A到B]( ) ## Maven版本可用gwt-maps-api-3.9.0-alpha-15 gwt-maps-api-3.9.0-build-17 或##...
gwt-2.0.0API.CHM Google Web Toolkit (GWT)是一个开源的工具集,可以让Web开发人员用Java语言创建和维护复杂的JavaScript前端应用程序
Google App Engine Java and GWT Application Development