问题描述
当我尝试使用 GAE 在我的 google web 应用程序项目中运行自动生成的代码时,我收到以下错误:
When I try to run the auto generated code in my google web app project using GAE I get the following error:
Mar 19, 2014 5:21:28 PM com.google.appengine.tools.development.agent.AppEngineDevAgent premain
SEVERE: Unable to load the App Engine dev agent. Security restrictions will not be completely emulated.
java.lang.RuntimeException: Unexpected exception during cast.
at com.google.apphosting.utils.clearcast.ClearCast$CasterImpl.cast(ClearCast.java:385)
at com.google.apphosting.utils.clearcast.ClearCast.staticCast(ClearCast.java:252)
at com.google.apphosting.utils.clearcast.ClearCast.staticCast(ClearCast.java:263)
at com.google.appengine.tools.development.agent.AppEngineDevAgent.premain(AppEngineDevAgent.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.lang.IllegalAccessException: Class com.google.apphosting.utils.clearcast.ClearCast$CasterImpl can not access a member of class com.google.appengine.tools.development.agent.$Proxy0 with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(Unknown Source)
at java.lang.reflect.AccessibleObject.checkAccess(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.google.apphosting.utils.clearcast.ClearCast$CasterImpl.cast(ClearCast.java:383)
... 9 more
有人知道如何解决这个问题吗?
Does anyone have any clue how to fix this?
代码:
@SuppressWarnings("serial")
public class Lab7Servlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
}
}
推荐答案
iQue,
我遇到了完全相同的问题,我发现我的 eclipse 使用的是 JRE 8(版本 1.8).不是故意的,改到1.7的时候,问题就解决了.
I encountered exactly the same problem, and I discovered that my eclipse was using JRE 8 (version 1.8). I didn't intend this, and when I changed it to 1.7, this solved the problem.
窗口 -> 首选项 -> Java -> 已安装的 JRE.检查 jre7 以使其默认.
Window -> Preferences -> Java -> Installed JREs. Checked jre7 to make it default.
相关说明:App Engine 安装说明说使用 1.7(但不要说不能使用 1.8):https://developers.google.com/appengine/docs/java/gettingstarted/installing
Relevant note: The App Engine installation instructions say to use 1.7 (but don't say you can't use 1.8): https://developers.google.com/appengine/docs/java/gettingstarted/installing
这篇关于无法在 Eclipse 中启动 google web app,安全限制将无法完全模拟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!