|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
How to inject my own ScriptSessionManager implementation in Spring?Hi,
I am trying to put DWR and Spring together on Google App Engine (GAE). I follow the instructions http://www.codercorp.com/blog/spring/configuring-dwr-30-with-spring-using-annotations.html that configures a Spring DispatcherServlet and maps all DWR-related request to a DwrController. Here is a snippet of my spring config xml: <context:annotation-config /> <aop:aspectj-autoproxy proxy-target-class="false" /> <dwr:configuration /> <dwr:annotation-config /> <dwr:url-mapping /> <dwr:controller id="dwrController" debug="true" /> <context:component-scan base-package="com.my.package.name" scoped-proxy="interfaces" /> To walk around the thread-creation limitation on GAE, I have implemented my own ScriptSessionManager (following this thread: http://www.nabble.com/DWR3RC1-threads-td23074328.html). However, I don't know how to inject my own ScriptSessionManager implementation to DWR through Spring configuration. In that thread the example <servlet> <servlet-name>dwr-invoker</servlet-name> <display-name>DWR Servlet</display-name> <description>Direct Web Remoter Servlet</description> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> <init-param> <param-name>org.directwebremoting.extend.ScriptSessionManager</param-name> <param-value>foo.bar.MyScriptSessionManager</param-value> </init-param> </servlet> does not work since I use Spring DispatcherServlet rather than DwrServlet. Can someone help? Thanks in advance. |
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?Hi,
By the way, I tried in my spring config xml: <dwr:controller id="dwrController" debug="true"> <dwr:config-param name="org.directwebremoting.extend.ScriptSessionManager" value="foo.bar.MyScriptSessionManager"/> </dwr:controller> But I still get the error: "java.lang.NoClassDefFoundError: javax.swing.event.EventListenerList is a restricted class." caused by DefaultScriptSessionManager. What am I doing wrong?
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?Have you tried adding the parameter to <dwr:controller/>?
Regards
On Fri, Oct 23, 2009 at 3:29 AM, pinecone_web <brandon.shwu@...> wrote:
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?unfortunately GAE does not allow javax.swing.event.EventListenerList. You will need to implement a script session manager that does not use this class.
2009/10/23 pinecone_web <brandon.shwu@...>
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?Yes, I know. I just don't know how to inject my MyScriptSessionManager (I tried
<dwr:controller id="dwrController" debug="true"> <dwr:config-param name="org.directwebremoting.extend.ScriptSessionManager value="foo.bar.MyScriptSessionManager"/> </dwr:controller> ) After looking into the code, I found the cause: Even I provid the MyScriptSessionManager as a config parameter of DwrController, the DefaultScriptSessionManager will STILL BE INITIATED by the DefaultContainer since it is specified in "default.properties." I have removed the mapping from ScriptSessionManager to DefaultScriptSessionManager from this file and the error message disappears. However, this approach requires recompilning. Any other way which does not require recompiling?
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?This sounds like a bug as the DefaultScriptSessionManager class should not be loaded into memory if you provide your own implementation (unless of course you have extended this class). Do you have a stack trace?
2009/10/23 pinecone_web <brandon.shwu@...>
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?Hi Lance,
Here it is: java.lang.NoClassDefFoundError: javax.swing.event.EventListenerList is a restricted class. Please see the Google App Engine developer's guide for more details. [java] at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) [java] at org.directwebremoting.impl.DefaultScriptSessionManager.<init>(DefaultScriptSessionManager.java:533) [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [java] at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance_(Runtime.java:112) [java] at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:132) [java] at org.directwebremoting.impl.DefaultContainer.addParameter(DefaultContainer.java:101) [java] at org.directwebremoting.spring.SpringContainer.addParameter(SpringContainer.java:68) [java] at org.directwebremoting.impl.StartupUtil.setupDefaults(StartupUtil.java:508) [java] at org.directwebremoting.impl.StartupUtil.setupDefaultContainer(StartupUtil.java:244) [java] at org.directwebremoting.spring.DwrController.afterPropertiesSet(DwrController.java:189) [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) [java] ... 55 more Please let me know if you have done a fix.
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?It seems like StartupUtil.java loads all of the classes in defaults.properties an then the overrides are applied which is not ideal. As a workaround, you might be able to put your own defaults.properties at
WEB-INF/classes/org/directwebremoting/defaults.properties The at least you won't need to rebuild the jar... let me know if this works. 2009/10/25 pinecone_web <brandon.shwu@...>
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?Ya, that's exactly what I am doing right now to prevent recompiling.
Thank you very much :).
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?I've raised a bug for this http://bugs.directwebremoting.org/jira/browse/DWR-428
2009/10/26 pinecone_web <brandon.shwu@...>
|
|
|
Re: How to inject my own ScriptSessionManager implementation in Spring?Please post back with your progress on getting DWR working in GAE as there are other users who will be interested with your experiences. In particular, I am interested in hearing how you handle the following cases:
1. Synchronization (adding script sessions to a distributed list). Since each request can be considered to be on a separate JVM, the synchronized keyword may not work as expected, how do handle this? Do you use a bigtable transaction? Do you store the list in bigtable / memcache?
2. Threading (such as cleaning up the script sessions). Do you use a cron job or are you making use of the new worker API which is currently only experimental / sandbox?
Cheers,
Lance.
2009/10/26 Lance Java <lance.java@...> I've raised a bug for this http://bugs.directwebremoting.org/jira/browse/DWR-428 |
| Free embeddable forum powered by Nabble | Forum Help |