1

我正在将此链接用于带有 jsf 的 google 应用程序引擎,因此当我在 eclipse 上运行时出现此错误,因此提供所需的解决方案链接是 http://www.mkyong.com/google-app-engine/google-app-engine -jsf-2-示例/

    java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass
     (IsolatedAppClassLoader.java:207)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at org.mortbay.util.Loader.loadClass(Loader.java:91)
    at org.mortbay.util.Loader.loadClass(Loader.java:71)
    at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73)
    at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:242)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    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:197)
    at com.google.appengine.tools.development.AbstractContainerService.startup
    (AbstractContainerService.java:241)
    at com.google.appengine.tools.development.DevAppServerImpl.start
    (DevAppServerImpl.java:148)
    at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply
    (DevAppServerMain.java:310)
    at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
    at com.google.appengine.tools.development.DevAppServerMain.<init>
     (DevAppServerMain.java:249)
     at com.google.appengine.tools.development.DevAppServerMain.main
     (DevAppServerMain.java:225)

  Sep 06, 2012 10:58:55 AM com.google.appengine.tools.development.ApiProxyLocalImpl log
     SEVERE: javax.servlet.ServletContext log: unavailable
      javax.servlet.UnavailableException: javax.faces.webapp.FacesServlet
    at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:79)
    at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:242)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    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:197)
    at com.google.appengine.tools.development.AbstractContainerService.startup
     (AbstractContainerService.java:241)
    at com.google.appengine.tools.development.DevAppServerImpl.start
    (DevAppServerImpl.java:148)
    at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply
    (DevAppServerMain.java:310)
    at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
    at com.google.appengine.tools.development.DevAppServerMain.
    <init>(DevAppServerMain.java:249)
    at com.google.appengine.tools.development.DevAppServerMain.main
    (DevAppServerMain.java:225)

     Sep 06, 2012 10:58:55 AM com.google.apphosting.utils.jetty.JettyLogger warn
   WARNING: failed Faces Servlet: java.lang.NullPointerException
    Sep 06, 2012 10:58:55 AM com.google.apphosting.utils.jetty.JettyLogger warn
   WARNING: Failed startup of context
   com.google.appengine.tools.development.DevAppEngineWebAppContext@1dc94ea
    {/,C:\Documents and Settings\Shilendra Sharma\workspace\Shilu\war}
     java.lang.NullPointerException
    at java.lang.Class.isAssignableFrom(Native Method)
    at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    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:197)
    at com.google.appengine.tools.development.AbstractContainerService.startup
    (AbstractContainerService.java:241)
    at com.google.appengine.tools.development.DevAppServerImpl.start
    (DevAppServerImpl.java:148)
    at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply
    (DevAppServerMain.java:310)
    at com.google.appengine.tools.util.Parser$ParseResult.applyArgs
    (Parser.java:48)
    at com.google.appengine.tools.development.DevAppServerMain.
    <init>(DevAppServerMain.java:249)
    at com.google.appengine.tools.development.DevAppServerMain.main
    (DevAppServerMain.java:225)


   so any one help me for it work properly

应用程序 shilendra

4

1 回答 1

1

JSF 2 正在使用 GAE 不支持的“javax.naming.InitialContext”。

要解决这个问题:

  • 您需要获取 JSF 源代码的副本。复制 WebConfiguration.java
  • 使用“javax.naming.InitialContext”类的注释方法
  • 但是等等,我已经修改了最新的(jsf 2.2.12),这里是:WebConfiguration.java
  • 将它放在包 com.sun.faces.config 中。

现在,您新创建的 WebConfiguration.java 类将重载原始 WebConfiguration.java。

于 2016-01-06T10:17:55.407 回答