我成功运行了我的应用程序并在我的服务器上注册了一个设备,因此我得到了“ 1个设备已注册”和“发送消息”按钮。但是,当我点击“发送消息”按钮时,我收到以下错误:
我正在使用tomcat和Android示例项目,如下所示: http://developer.android.com/google/gcm/server.html
HTTP Status 500 - Servlet.init() for servlet SendAllMessagesServlet threw exception
type Exception report
message Servlet.init() for servlet SendAllMessagesServlet threw exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet SendAllMessagesServlet threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.IllegalArgumentException: argument cannot be null
com.google.android.gcm.server.Sender.nonNull(Sender.java:553)
com.google.android.gcm.server.Sender.<init>(Sender.java:88)
com.google.android.gcm.demo.server.SendAllMessagesServlet.newSender(SendAllMessagesServlet.java:62)
com.google.android.gcm.demo.server.SendAllMessagesServlet.init(SendAllMessagesServlet.java:53)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.41 logs.
请有人帮忙请
答案 0 :(得分:0)
问题是API密钥。 所以我得到一个新的api密钥并用新的密钥切换旧密钥并且它可以工作:)
答案 1 :(得分:0)
json-simple-1.1.jar应该复制到Web应用程序的WEB-INF / lib文件夹中。这是解决方案:)