无法在eclipse中启动google web app,安全限制将无法完全模拟

时间:2014-03-20 00:14:21

标签: eclipse google-app-engine compiler-errors

当我尝试使用GAE在我的Google网络应用程序项目中运行自动生成的代码时,出现以下错误:

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

有没有人知道如何解决这个问题?

代码:

@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");
    }
}

3 个答案:

答案 0 :(得分:33)

神游,

我遇到了完全相同的问题,我发现我的eclipse正在使用JRE 8(版本1.8)。我不打算这样做,当我把它改为1.7时,这解决了这个问题。

编辑:窗口 - >偏好 - > Java - >已安装的JRE。检查jre7以使其成为默认值。

相关说明:App Engine安装说明说使用1.7(但不要说你不能使用1.8):https://developers.google.com/appengine/docs/java/gettingstarted/installing

答案 1 :(得分:0)

您是否检查过项目中是否存在App Engine SDK?

GWT error

如果没有,请转到 窗口 - >偏好 - > Google - > App Engine 并添加它。

答案 2 :(得分:0)

在我的情况下,除了Kevin回答中提到的内容之外,我还必须在运行配置中将java的值修改为1.7。

enter image description here