Google Engine应用程序 - InitialContext是受限制的类

时间:2016-05-16 02:33:15

标签: android eclipse initial-context

我正在使用Eclipse和Google Engine应用来公开我的服务器,我有错误:

 
java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google  App Engine developer's guide for more details.
    at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:52)
    at com.sun.faces.config.WebConfiguration.processJndiEntries(WebConfiguration.java:646)
    at com.sun.faces.config.WebConfiguration.(WebConfiguration.java:128)
    at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:188)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:164)
    at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:224)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:273)
    at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:283)
    at com.google.appengine.tools.development.AutomaticInstanceHolder.startUp(AutomaticInstanceHolder.java:26)
    at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:87)
    at com.google.appengine.tools.development.Modules.startup(Modules.java:105)
    at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:258)
    at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
    at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:213)
    at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:211)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:211)
    at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:277)
    at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
    at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:225)
    at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:216)

我找到了这个决议:

http://www.mkyong.com/google-app-engine/gae-jsf-javax-naming-initialcontext-is-a-restricted-class/

我这样做了,我在自己的项目中添加了WebConfiguration.java但是我仍然面临着这个问题,也许我的类不是项目在访问WebConfiguration时读取的那个,也许它正在阅读“古老而错误”文件包含2个无法读取的方法,因为这会产生错误。

有人能帮帮我吗?

非常感谢你:)

1 个答案:

答案 0 :(得分:0)

您应该将WebConfiguration.java放在正确的包中(com.sun.faces.config)。 根据你发布的stacktrace,仍然会调用不兼容的方法processJndiEntries,所以不使用你的类。