2012-09-06 55 views
1

我使用與JSF這個linkfor谷歌應用程序引擎,所以當我在Eclipse上運行,從而給渴望解決 鏈接我得到這個錯誤的錯誤是http://www.mkyong.com/google-app-engine/google-app-engine-jsf-2-example/谷歌應用程序引擎+ 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 
    c[email protected]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 

App shilendra

+0

此問題表明您沒有正確完成教程中所示的「2. JSF 2依賴項」步驟。 – BalusC

+0

好吧我可以理解這是不夠的谷歌應用程序引擎與本教程中的jsf –

回答

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。

+0

嗯我不太明白在哪裏把這個文件。我必須將JSF jar添加到我的項目中。那麼在哪?或者我把它放在我的項目源代碼中,並在我自己的項目中創建一個包「com.sun.face.config」?請幫助並解釋 – MobileMon

+0

不,只需製作一個新包:javax.naming.InitialContext。然後是一個新的類:WebConfiguration。然後將上述文件中的課程內容複製並粘貼到新課​​程中。 – Yster