RestletFrameworkServlet missing from M5 and snapshot builds

12 messages Options
Embed this post
Permalink
Cedric Hurst

RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
Hi.  I'm attempting to set up a Spring-backed Restlet web application hosted in the GAE.  I'd like to make use of the RestletFrameworkServlet, which is currently in the trunk of the svn: http://restlet.tigris.org/source/browse/restlet/trunk/modules/org.restlet.ext.spring/src/org/restlet/ext/spring/RestletFrameworkServlet.java?view=log

However, this class does not exist in the spring ext modules of either the M5 or SNAPSHOT build.  I'd be happy to build this class on my own from trunk, but I wanted to see if this particular class was left out of the builds for a reason.  Is it no longer meant to be used?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412200
Ben R Vesco

Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
Cedric Hurst

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
Ah, yes.  Thanks for pointing me to that post, Ben.  I've swapped my ext.spring jar from the GAE with the one provided in the JEE version.  I'll test it out tonight to see if the Servlet class works inside GAE.  If it does, perhaps we should consider including it in the GAE distribution of Restlet?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412233
jlouvel

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
Hi Cedric,

Please let us know if the Spring extension works fine on GAE and we'll
include it in the Restlet edition for GAE for the next snapshot!

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



-----Message d'origine-----
De : Cedric Hurst [mailto:[hidden email]]
Envoyé : mercredi 28 octobre 2009 20:41
À : [hidden email]
Objet : RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Ah, yes.  Thanks for pointing me to that post, Ben.  I've swapped my
ext.spring jar from the GAE with the one provided in the JEE version.  I'll
test it out tonight to see if the Servlet class works inside GAE.  If it
does, perhaps we should consider including it in the GAE distribution of
Restlet?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24122
33

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412520
Cedric Hurst

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
This seems to run fine in my local environment, but when I attempt to run directly on the app engine and access a URI mapped to my RestletFrameworkServlet, I get the following error...

avax.servlet.ServletException: java.lang.SecurityException: Google App Engine does not support subclasses of java.util.logging.Logger: org/restlet/ext/servlet/internal/ServletLogger
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:437)
        at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
        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:191)
        at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
        at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
        at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
        at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
        at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
        at com.google.net.rpc.impl.Server$2.run(Server.java:814)
        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:769)
        at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
        at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
        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:436)
        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:396)
        at java.lang.Thread.run(Unknown Source)

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412907
webpost

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
So, after a quick patch to the ServerAdapter class in ext.servlet, replacing references to ServletLogger with references to java.util.logging.Logger, I was able to get past this error.  Unfortunately, now when I attempt to configure the SpringRouter, I get the following error:

org.springframework.web.servlet.FrameworkServlet initServletBean: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'root' defined in ServletContext resource [/WEB-INF/rest-servlet.xml]: Cannot create inner bean 'org.restlet.ext.spring.SpringFinder#56d6cf' of type [org.restlet.ext.spring.SpringFinder] while setting bean property 'attachments' with key [TypedStringValue: value [/categories], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.restlet.ext.spring.SpringFinder#56d6cf' defined in ServletContext resource [/WEB-INF/rest-servlet.xml]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.java:383)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:161)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1299)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1061)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:543)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:387)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:447)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:342)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:308)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
        at javax.servlet.GenericServlet.init(GenericServlet.java:215)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
        at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
        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:191)
        at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
        at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
        at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
        at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
        at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
        at com.google.net.rpc.impl.Server$2.run(Server.java:814)
        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:769)
        at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
        at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
        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:436)
        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:396)
        at java.lang.Thread.run(Unknown Source)

GAE provides its own version of ASM in its classloader, and some of the features required by lookup-method driven beans do not seem to be available.  Here is my configuration:

<context:component-scan base-package="com.mysite.restlet" />
         <bean id="root" class="org.restlet.ext.spring.SpringRouter">
                <property name="attachments">
                        <map>
                                <entry key="/categories">
                                        <bean class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method name="createResource" bean="categoryListResource" />
                                        </bean>
                                </entry>
                        </map>
                </property>
        </bean>
       
I was considering a few alternate approaches to wiring the resources.  Right now, I'm leaning toward trying to define the resource as a request-scoped bean and injecting that bean into the router, but I'm not sure if that would have any unforseen side effects.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413883
Cedric Hurst

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
As I was afraid, the request scope will not work within the context of a SpringRouter.  I receive the following error:

org.springframework.web.servlet.FrameworkServlet initServletBean: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'root' defined in ServletContext resource [/WEB-INF/rest-servlet.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:543)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:387)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:447)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:342)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:308)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
        at javax.servlet.GenericServlet.init(GenericServlet.java:215)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
        at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
        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:191)
        at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
        at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
        at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
        at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
        at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
        at com.google.net.rpc.impl.Server$2.run(Server.java:814)
        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:769)
        at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
        at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
        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:436)
        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:396)
        at java.lang.Thread.run(Unknown Source)

Here is my config:

 <bean id="root" class="org.restlet.ext.spring.SpringRouter">
                <property name="attachments">
                        <map>
                                <entry key="/categories">
                                        <bean
                                                id="categoryListResource"
                                                class="com.mysite.restlet.resources.CategoryListResource"
                                                scope="request"
                                        />
                                </entry>
                        </map>
                </property>
        </bean>

Essentially, I'm trying to leverage Spring's DI facilities to wire up my Restlet resources with the Spring beans that interact with a JDO-backed data store in GAE.  Has anyone had any success with this in GAE thusfar?  If not, are there any suggestions on other DI frameworks (Guice, etc), that may work better for Restlets on GAE?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413894
Tim Peierls

Re: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
If you're injecting only ServerResources and not Restlets, Guice might work for you -- GAE says it supports Guice 2. If you must have XML configuration, though, Guice is probably not the way to go.

I haven't packaged the Restlet-Guice integration nicely, but you can download the zip archive of sources, which includes an example. See my blog entry:


I probably should put these sources in the public domain explicitly.

I'm supposed to be working on an actual Restlet extension for Guice, but it's hard finding time...

--tim

On Mon, Nov 2, 2009 at 12:27 PM, Cedric Hurst <[hidden email]> wrote:
As I was afraid, the request scope will not work within the context of a SpringRouter.  I receive the following error:

org.springframework.web.servlet.FrameworkServlet initServletBean: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'root' defined in ServletContext resource [/WEB-INF/rest-servlet.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:543)
       at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:387)
       at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:447)
       at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:342)
       at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:308)
       at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
       at javax.servlet.GenericServlet.init(GenericServlet.java:215)
       at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
       at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
       at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
       at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
       at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
       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:191)
       at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
       at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
       at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
       at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
       at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
       at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
       at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
       at com.google.net.rpc.impl.Server$2.run(Server.java:814)
       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:769)
       at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
       at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
       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:436)
       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:396)
       at java.lang.Thread.run(Unknown Source)

Here is my config:

 <bean id="root" class="org.restlet.ext.spring.SpringRouter">
               <property name="attachments">
                       <map>
                               <entry key="/categories">
                                       <bean
                                               id="categoryListResource"
                                               class="com.mysite.restlet.resources.CategoryListResource"
                                               scope="request"
                                       />
                               </entry>
                       </map>
               </property>
       </bean>

Essentially, I'm trying to leverage Spring's DI facilities to wire up my Restlet resources with the Spring beans that interact with a JDO-backed data store in GAE.  Has anyone had any success with this in GAE thusfar?  If not, are there any suggestions on other DI frameworks (Guice, etc), that may work better for Restlets on GAE?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413894

Tim Peierls

Re: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
On Mon, Nov 2, 2009 at 12:38 PM, Tim Peierls <[hidden email]> wrote:
I'm supposed to be working on an actual Restlet extension for Guice, but it's hard finding time...

I mean a Guice extension for Restlet. 

--tim
jlouvel

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
In reply to this post by webpost
Hi Cedric,

Regarding the ServletLogger issue, this is new to us, maybe due to a GAE
upgrade. I've entered an issue to fix this:

"GAE does not support subclasses of java.util.logging.Logger"
http://restlet.tigris.org/issues/show_bug.cgi?id=934

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]]
Envoyé : lundi 2 novembre 2009 17:58
À : [hidden email]
Objet : RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

So, after a quick patch to the ServerAdapter class in ext.servlet, replacing
references to ServletLogger with references to java.util.logging.Logger, I
was able to get past this error.  Unfortunately, now when I attempt to
configure the SpringRouter, I get the following error:

org.springframework.web.servlet.FrameworkServlet initServletBean: Context
initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'root' defined in ServletContext resource
[/WEB-INF/rest-servlet.xml]: Cannot create inner bean
'org.restlet.ext.spring.SpringFinder#56d6cf' of type
[org.restlet.ext.spring.SpringFinder] while setting bean property
'attachments' with key [TypedStringValue: value [/categories], target type
[null]]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.restlet.ext.spring.SpringFinder#56d6cf' defined in
ServletContext resource [/WEB-INF/rest-servlet.xml]: Instantiation of bean
failed; nested exception is java.lang.NoSuchMethodError:
org.objectweb.asm.ClassWriter.<init>(I)V
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eInnerBean(BeanDefinitionValueResolver.java:281)
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:120)
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eManagedMap(BeanDefinitionValueResolver.java:383)
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:161)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1299)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1061)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
stractBeanFactory.java:289)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSi
ngleton(DefaultSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abst
ractBeanFactory.java:286)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:188)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst
antiateSingletons(DefaultListableBeanFactory.java:543)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFac
toryInitialization(AbstractApplicationContext.java:730)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(Abstr
actApplicationContext.java:387)
        at
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext
(FrameworkServlet.java:447)
        at
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(F
rameworkServlet.java:342)
        at
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkSe
rvlet.java:308)
        at
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:12
7)
        at javax.servlet.GenericServlet.init(GenericServlet.java:215)
        at
org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
        at
org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
        at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
        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(AppVe
rsionHandlerMap.java:191)
        at
com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersi
onHandlerMap.java:168)
        at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:127)
        at
com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239
)
        at
com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingReque
st(RuntimePb.java:5135)
        at
com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingReque
st(RuntimePb.java:5133)
        at
com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApp
licationHandler.java:24)
        at
com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
        at com.google.net.rpc.impl.Server$2.run(Server.java:814)
        at
com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56
)
        at
com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpan
Builder.java:516)
        at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
        at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
        at
com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.ja
va:437)
        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:436)
        at
com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.ja
va: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:3
96)
        at java.lang.Thread.run(Unknown Source)

GAE provides its own version of ASM in its classloader, and some of the
features required by lookup-method driven beans do not seem to be available.
Here is my configuration:

<context:component-scan base-package="com.mysite.restlet" />
         <bean id="root" class="org.restlet.ext.spring.SpringRouter">
                <property name="attachments">
                        <map>
                                <entry key="/categories">
                                        <bean
class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method
name="createResource" bean="categoryListResource" />
                                        </bean>
                                </entry>
                        </map>
                </property>
        </bean>
       
I was considering a few alternate approaches to wiring the resources.  Right
now, I'm leaning toward trying to define the resource as a request-scoped
bean and injecting that bean into the router, but I'm not sure if that would
have any unforseen side effects.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24138
83

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2414058
Thierry Boileau

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
In reply to this post by Cedric Hurst
Hello Cedric,

I've successfully tested to log from a Restlet and a ServerResource instance using the current snapshot. The following instruction simply logs a trace as expected:
getLogger().warning("This is a test");

Could you try it and tell if it still fails for you?

Best regards,
Thierry Boileau

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2414334
Cedric Hurst

RE: Re: RestletFrameworkServlet missing from M5 and snapshot builds

Reply Threaded More More options
Print post
Permalink
Hi, Thierry... I have not yet had a chance to test this out, but I plan to this weekend.  In the meantime, I wanted to clarify the particular scenario which was causing the error.  On the latest Google App Engine code (1.2.6, I believe), I was using the Spring extension to instantiate a RestletFrameworkServlet.  I received the error about a forbidden extension of java.util.logging.Logger after deploying to GAE and attempting to access to mapped url.  I checked out the Restlet servlet extension from SVN and replaced references to ServletLogger with the java.util.logging.Logger, and I no longer received the error.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2414765