java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") when adding to project apns-0.1.5 jars

1,499 views
Skip to first unread message

Manolis Stylian

unread,
Jan 21, 2014, 11:12:45 AM1/21/14
to google-a...@googlegroups.com
Hello everybody, 
I take this exception when I try to load a servlet. My server is GAE. 
 
The code from the servlet is the following : 


import java.io.IOException;
import javax.servlet.http.*;

import com.notnoop.apns.APNS;
import com.notnoop.apns.ApnsService;

@SuppressWarnings("serial")
public class LastPushNotificationServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {

String payload = APNS.newPayload().alertBody("Push notification!").build();
String token = "be6XXXXXXXXXX";
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
    ApnsService service =
   APNS.newService()
   .withCert("CertificateName.p12", "XXXX")
   .withSandboxDestination()
   .build();

service.push(token, payload);
}
}

Is there any incompatibility with the APNS library? 
Any ideas?
If you need further details, let me know :)


Vinny P

unread,
Jan 24, 2014, 10:09:58 PM1/24/14
to google-a...@googlegroups.com
On Tue, Jan 21, 2014 at 10:12 AM, Manolis Stylian <styl...@gmail.com> wrote:
Is there any incompatibility with the APNS library? 
Any ideas?



It looks like this library uses threading, which is restricted on App Engine. You'll need to restructure the code to prevent threads from spawning. Here's an explanation of how to handle it: http://googleappenginetutorial.blogspot.jp/2013/04/java-apns-on-appengine.html

 
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Reply all
Reply to author
Forward
0 new messages