经过研究发现。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 所以压缩了下。解压缩再替换。
分享到:
相关推荐
描述中提到,GWT编译需要引入"appengine-java-sdk",这是因为AppEngine提供了GWT的兼容支持,使得开发者可以利用GWT的强大功能开发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 for Java中文API知识点详解 #### 一、Google App Engine for Java概览 - **背景介绍**: - Google App Engine最初是专为Python开发者设计的平台,但随着时间的发展,为了满足更广泛开发者...
3. 准备GAE项目结构,包括`appengine-web.xml`配置文件。 4. 将GWT编译后的静态资源和GAE项目结构打包成WAR文件。 5. 使用Google App Engine SDK部署WAR文件到GAE。 在`Gwt.html`文件中,可能是GWT应用的启动页面,...
### GWT快速开发知识点详解 #### 一、GWT简介 **Google Web Toolkit (GWT)** 是由Google推出的一款开源的Java开发框架,主要用于构建高度交互式的Web应用程序,特别是那些类似Google Maps和Gmail这样的AJAX应用。...
基于Google App Engine(GAE)的Java和GWT应用开发_Google App Engine Java and GWT Application Development Nov.2010
GWT-api文档是关于GWT库的一份详细参考资料,涵盖了GWT框架的各种API、类、接口和方法,对于理解和使用GWT进行开发至关重要。 GWT的核心特性包括: 1. **Java到JavaScript的编译**:GWT将Java源代码通过编译器转换...
gwt 1.6.4 for windows gwt 1.6.4 for windows
综上所述,入门教程涉及到了安装与配置Eclipse开发环境、安装Google App Engine插件、创建和配置Web应用项目以及编译时的Java版本兼容性问题,这些知识点对于想要开始使用Google App Engine开发Web应用的开发者来说...
Google App Engine(GAE)是谷歌提供的一种云计算平台,它允许开发者构建并托管Web应用程序,无需管理和维护服务器硬件。这个平台支持多种编程语言,包括Python、Java、Go和PHP,为开发者提供了强大的服务,如数据...
中文名: 基于Google App Engine(GAE)的Java和GWT应用开发 原名: Google App Engine Java and GWT Application Development 作者: Daniel Guermeur, Amy Unruh 资源格式: PDF 版本: 文字版 出版社: Packt ...
提供的“GWT-API.chm”和“GWT-API.chw”文件很可能是GWT的API帮助文档,包含了GWT框架的所有类、接口、方法和注解的详细信息。这些文档是开发者学习和查找GWT相关功能的重要参考,比如Widget库(包含各种UI组件)...
首先,EXT-GWT2.0.1是EXT-GWT(GWT-Ext)的一个版本,它是基于GWT的组件库,提供了丰富的用户界面组件,如表格、树形视图、菜单等,使得开发者可以构建出具有桌面级用户体验的Web应用。EXT-GWT的API和DOC文档对于...
标题中的"gwt-dev-plugin-x86-对ie浏览器使用"指的是一个特定的GWT开发插件,适用于x86架构的机器,并且是专为Internet Explorer(IE)浏览器设计的。在GWT的早期版本中,为了实现Java到JavaScript的编译和在浏览器...
阅读并分析该博客可以帮助你解决具体问题,同时学习到更多关于GWT AppEngine开发的技巧。 在标签中提到的“源码”和“工具”,暗示了这篇博客可能包括实际的代码示例以及可能使用的工具或库,这些都有助于你理解和...
3. **确认插件信息**:返回安装对话框,中心区域应已列出可选插件和SDK,勾选Google Plugin for Eclipse及相关的SDK复选框,这将安装插件、Google App Engine Java SDK和Google Web Toolkit SDK,然后点击“下一步”...
它使用带有纯 Maven 配置的 Google Web Toolkit,适用于希望在 Google App Engine 之上构建的开发人员,使用 Google 的 HRD、Schemaless Datastore,而无需向 IDE 添加框架配置或插件。 该项目不是示例应用程序,...