7 Replies Latest reply on Sep 3, 2009 9:44 AM by nbelaevski

    Is it easy to have a version of RichFaces working on GAE?

      I heard that RichFaces uses awt which is not supported on Google App Engine so we cannot use RichFaces there.

      Is there anyway to have a version of RF that works on GAE? I just need ajax features of RichFaces.

      Thank you.

        • 1. Re: Is it easy to have a version of RichFaces working on GAE
          ilya_shaikovsky

          works on such compatibility discussed only for 4.x branch.. we will not made such changes in 3.3.x because this branch curretnly under stabilization works only.

          • 2. Re: Is it easy to have a version of RichFaces working on GAE

            Will RF work on GAE if I do like this (right now I'm having some problems, maybe in web.xml, that if I use the ajax4jsf filter, all standard jsf tags, like <h:outputText>, isn't rendered, i.e. if I view the source code, I still see <h:outputText value="..."/>):

            - download the source code, build components which do not use java.awt, e.g. core, jQuery, message, suggestionbox ...
            - use the jar files build above with richfaces-api-3.3.1.GA.jar and richfaces-impl-3.3.1.GA.jar

            ?

            I haven't got enough time to play with it a lot. If anybody goes this way and doesn't make any success because of some hurdle that I haven't anticipated yet, please tell me so that I don't waste my time.

            Thank you.

            • 3. Re: Is it easy to have a version of RichFaces working on GAE
              nbelaevski

              Hi,

              You can try the following:

              1. Remove graphics resources from all resources-config.xml files
              2. Use "plain" or "NULL" skin

              • 4. Re: Is it easy to have a version of RichFaces working on GAE

                No luck. I used plain skin and only the core and message components from the ui directory.

                The errors on GAE are

                #
                
                 1.
                 09-02 11:16PM 02.693 /index.jsf 500 4472ms 6319cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090809 Firefox/3.5.2 (Swiftfox),gzip(gfe)
                 See details
                
                 68.196.94.203 - - [02/Sep/2009:23:16:07 -0700] "GET /index.jsf HTTP/1.1" 500 0 - "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090809 Firefox/3.5.2 (Swiftfox),gzip(gfe)" "jsfexample1.appspot.com"
                
                 2.
                 I 09-02 11:16PM 04.453
                
                 javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext
                
                 3.
                 I 09-02 11:16PM 06.531
                
                 com.sun.faces.config.ConfigureListener contextInitialized: Initializing Mojarra (1.2_13-b01-FCS) for context ''
                
                 4.
                 W 09-02 11:16PM 07.152
                
                 Failed startup of context com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@1c45731{/,/base/data/home/apps/jsfexample1/4.336070046792708930}
                 com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! access denied (java.lang.RuntimePermission getClassLoader)
                 at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:215)
                 at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:196)
                 at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
                 at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
                 at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
                 at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
                 at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
                 at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
                 at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:190)
                 at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:167)
                 at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
                 at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:235)
                 at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:4823)
                 at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:4821)
                 at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
                 at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:359)
                 at com.google.net.rpc.impl.Server$2.run(Server.java:820)
                 at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
                 at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:516)
                 at com.google.net.rpc.impl.Server.startRpc(Server.java:775)
                 at com.google.net.rpc.impl.Server.processRequest(Server.java:348)
                 at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:436)
                 at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
                 at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
                 at com.google.net.async.Connection.handleReadEvent(Connection.java:428)
                 at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:762)
                 at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
                 at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
                 at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
                 at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:374)
                 at java.lang.Thread.run(Unknown Source)
                 Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
                 at java.security.AccessControlContext.checkPermission(Unknown Source)
                 at java.security.AccessController.checkPermission(Unknown Source)
                 at java.lang.SecurityManager.checkPermission(Unknown Source)
                 at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
                 at org.ajax4jsf.resource.ResourceBuilderImpl.<clinit>(ResourceBuilderImpl.java:104)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                 at java.lang.reflect.Constructor.newInstance(Unknown Source)
                 at java.lang.Class.newInstance0(Unknown Source)
                 at java.lang.Class.newInstance(Unknown Source)
                 at org.ajax4jsf.resource.InternetResourceBuilder.getInstance(InternetResourceBuilder.java:167)
                 at org.ajax4jsf.renderkit.ChameleonRenderKitFactory.<init>(ChameleonRenderKitFactory.java:62)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                 at java.lang.reflect.Constructor.newInstance(Unknown Source)
                 at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Constructor_.newInstance(Constructor_.java:60)
                 at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:519)
                 at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:405)
                 at javax.faces.FactoryFinder.access$400(FactoryFinder.java:135)
                 at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:717)
                 at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239)
                 at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:186)
                 at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:131)
                 at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:205)
                 ... 30 more
                
                 5.
                 C 09-02 11:16PM 07.159
                
                 Uncaught exception from servlet
                 javax.servlet.UnavailableException: Initialization failed.
                 at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:199)
                 at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:167)
                 at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
                 at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:235)
                 at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:4823)
                 at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:4821)
                 at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
                 at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:359)
                 at com.google.net.rpc.impl.Server$2.run(Server.java:820)
                 at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
                 at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:516)
                 at com.google.net.rpc.impl.Server.startRpc(Server.java:775)
                 at com.google.net.rpc.impl.Server.processRequest(Server.java:348)
                 at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:436)
                 at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
                 at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
                 at com.google.net.async.Connection.handleReadEvent(Connection.java:428)
                 at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:762)
                 at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
                 at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
                 at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
                 at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:374)
                 at java.lang.Thread.run(Unknown Source)

                The errors came from the line 104 of org.ajax4jsf.resource.ResourceBuilderImpl which is
                try {
                
                 ClassLoader systemCL = ClassLoader.getSystemClassLoader();
                
                 thread.setContextClassLoader(systemCL);
                
                 ImageIO.setUseCache(false);
                
                 } finally {
                
                 thread.setContextClassLoader(initialTCCL);
                
                 }
                
                (the ClassLoader.getSystemClassLoader() is on the line 104).

                Does anybody have any suggestions?

                Thank you.

                • 5. Re: Is it easy to have a version of RichFaces working on GAE
                  nbelaevski

                  Ok, this won't work. Then the only solution seems to remove java.awt.* using classes, all references to them and rebuild RF from sources. Another way - JIRA RFC for GAE version of RF.

                  • 6. Re: Is it easy to have a version of RichFaces working on GAE

                    I'll try that. In the mean time, could you explain why we need to do this

                    ClassLoader.getSystemClassLoader()
                    ? Is the result of ClassLoader.getSystemClassLoader the same as Thread.getCurrentThread().getContextClassLoader() in a normal situation? In GAE, ClassLoader.getSystemClassLoader() throws a permission exception while Thread.getCurrentThread().getContextClassLoader() might not.

                    • 7. Re: Is it easy to have a version of RichFaces working on GAE
                      nbelaevski