tags:

views:

378

answers:

1

Hello,

I'm working on my first GWT-based Java project for a school assignment. It's a chat application and the client polls the server for new events, while the server keeps an timer for each user to detect inactivity.

The following problem occurs at runtime:

Dec 8, 2009 7:41:17 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /GAEChat/chat
java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)
 at java.security.AccessControlContext.checkPermission(Unknown Source)
 at java.security.AccessController.checkPermission(Unknown Source)
 at java.lang.SecurityManager.checkPermission(Unknown Source)
 at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:151)
 at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:176)
 at java.lang.ThreadGroup.checkAccess(Unknown Source)
 at java.lang.Thread.init(Unknown Source)
 at java.lang.Thread.<init>(Unknown Source)
 at java.util.TimerThread.<init>(Unknown Source)
 at java.util.Timer.<init>(Unknown Source)
 at java.util.Timer.<init>(Unknown Source)
 at gaechat.server.ChatServiceImpl.<init>(ChatServiceImpl.java:22)
 at sun.reflect.GeneratedConstructorAccessor14.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.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
 at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
 at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
 at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:121)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
 at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
 at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
 at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:352)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
 at org.mortbay.jetty.Server.handle(Server.java:313)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
 at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
 at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

Here's the code repository. The problem seems to be in server/ChatServiceImpl.java.

Am I doing something wrong? I'm stuck.

+2  A: 

As this is a school assignment try disabling the SecurityManager first.

Updated: It should be disabled unless you had a -Djava.security.manager set somewhere. See How to disable Java security manager?

BTW, you might be interested in this link ;) The page has the source code available for download.

Iker Jimenez
Thanks for pointing me to the book. Seems like a wonderful resource! Now if I can only figure out how to disable the SecurityManager... :)
Dan
Are you getting that error when running in hosted mode? have you tried deploying the war folder in a standard tomcat installation to see if you are still getting the same error?
Iker Jimenez
Thanks for all the help. I've temporarily commented out the part with the timer so I can get something done. I will try to disable the security manager when I bring the inactivity timer back.
Dan
For extra points on your assignment instead of just sending a request every X seconds have a look at http://en.wikipedia.org/wiki/Push_technology#Long_pollingI believe it is being used in the application I linked you before, it might be called hanging RPC request or something similar.
Iker Jimenez