极光推送,报错,为什么

dongchaofsdfds 2015-06-23 10:58:19
public static void main(String[] args) {
// testSendPush();
String masterSecret = "注册的,可以使用的";
// 应用的appKey,同样在网站上申请
String appKey = "注册的,可以使用的";
// 建立JpushClient类,用来发送消息的对象
JPushClient client = new JPushClient(masterSecret, appKey);
try {
// client.sendNotificationAll("hello world");

// client.sendMessageAll("this is a message");
PushPayload payload = PushPayload.newBuilder().setPlatform(
Platform.android_ios()).setNotification(
Notification.alert("jPush is useful!!")).setAudience(
Audience.alias("123456")).build();//123456是alias
client.sendPush(payload);

} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIRequestException e) {
e.printStackTrace();
}

}





报错:
at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:208)
at cn.jpush.api.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:72)
at cn.jpush.api.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:64)
at cn.jpush.api.push.PushClient.sendPush(PushClient.java:111)
at cn.jpush.api.JPushClient.sendPush(JPushClient.java:88)
at cn.jpush.api.examples.PushExample.main(PushExample.java:56)
...全文
16627 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
城墙内外 2018-12-25
  • 打赏
  • 举报
回复
jPushClient.getAliasDeviceList(alias, "ios,android").registration_ids;
查看alias 是否绑定,没有绑定,就会报这个错,客户端设置有问题
mukei1 2017-11-20
  • 打赏
  • 举报
回复
{} at cn.jiguang.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:235) at cn.jiguang.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:99) at cn.jiguang.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:86) at cn.jpush.api.push.PushClient.sendPush(PushClient.java:163) 我也遇到了,请问怎么解决的??
倩兮哟 2017-09-13
  • 打赏
  • 举报
回复
我也碰到这个问题了。。。提示:{"errcode":1002,"errmsg":"app_key doesn't provide"} 楼主怎么解决的 啊。。
hello___everyone 2017-09-13
  • 打赏
  • 举报
回复
引用 10 楼 hello___everyone 的回复:
Error response from JPush server. Should review and fix it. {} at cn.jiguang.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:235) at cn.jiguang.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:99) at cn.jiguang.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:86) at cn.jpush.api.push.PushClient.sendPush(PushClient.java:163) at cn.jpush.api.JPushClient.sendPush(JPushClient.java:193) at net.huadong.idev.util.JiguangPush.push(JiguangPush.java:78) at net.huadong.idev.gis.resources.CCoordinateResource.ezuiSave(CCoordinateResource.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke (ResourceMethodInvocationHandlerFactory.java:81) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run (AbstractJavaResourceMethodDispatcher.java:151) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke (AbstractJavaResourceMethodDispatcher.java:171) at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch (JavaResourceMethodDispatcherProvider.java:195) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch (AbstractJavaResourceMethodDispatcher.java:104) at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:406) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:350) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106) at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:219) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:83) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at net.huadong.idev.tpl.privilege.filter.LoginFilter.doFilter(LoginFilter.java:205) 同问
补充{"error": {"message": "Only Support POST Method", "code": 1001}}
hello___everyone 2017-09-13
  • 打赏
  • 举报
回复
Error response from JPush server. Should review and fix it.
{}
at cn.jiguang.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:235)
at cn.jiguang.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:99)
at cn.jiguang.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:86)
at cn.jpush.api.push.PushClient.sendPush(PushClient.java:163)
at cn.jpush.api.JPushClient.sendPush(JPushClient.java:193)
at net.huadong.idev.util.JiguangPush.push(JiguangPush.java:78)
at net.huadong.idev.gis.resources.CCoordinateResource.ezuiSave(CCoordinateResource.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke

(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run

(AbstractJavaResourceMethodDispatcher.java:151)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke

(AbstractJavaResourceMethodDispatcher.java:171)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch

(JavaResourceMethodDispatcherProvider.java:195)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch

(AbstractJavaResourceMethodDispatcher.java:104)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:406)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:350)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:219)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at net.huadong.idev.tpl.privilege.filter.LoginFilter.doFilter(LoginFilter.java:205)






同问
weixin_39435961 2017-07-07
  • 打赏
  • 举报
回复
引用 5 楼 oh_Maxy 的回复:
at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:208) 这一行上面没有报错信息了?
求支援
weixin_39435961 2017-07-07
  • 打赏
  • 举报
回复
同样的问题 [main] WARN cn.jpush.api.common.connection.NativeHttpClient - Got error response - responseCode:400, responseContent:{"msg_id": 20266198413435051, "error": {"message": "cannot find user by this audience", "code": 1011}} [main] ERROR cn.jpush.api.common.connection.NativeHttpClient - Your request params is invalid. Please check them according to error message. Exception in thread "main" {} at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:232) at cn.jpush.api.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:94) at cn.jpush.api.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:81) at cn.jpush.api.push.PushClient.sendPush(PushClient.java:119) at cn.jpush.api.JPushClient.sendPush(JPushClient.java:142) at com.concise.jpush.service.PushSjService.main(PushSjService.java:152) 推送时 .all()群发是没有问题的 左右appkey那些是一定没错的 就是用alias的时候出现这个错误
p869414247 2015-07-09
  • 打赏
  • 举报
回复
说你key不对吧 你看看极光推送你申请接口的key什么的!
oh_Maxy 2015-06-24
  • 打赏
  • 举报
回复
at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:208) 这一行上面没有报错信息了?
oh_Maxy 2015-06-23
  • 打赏
  • 举报
回复
你这错误只是说在哪个地方出现的,最终要的异常类型没给出
dongchaofsdfds 2015-06-23
  • 打赏
  • 举报
回复
我是服务器端向手机端发送,服务器自己新建的一个工程,引入的JPush的例子,手机端在JPush提供的网页平台上发送没有问题,手机可以收到,可是在我这里就出现这样的问题,是不是我哪里还没配置好呢?求教大神
dongchaofsdfds 2015-06-23
  • 打赏
  • 举报
回复
cn.jpush.api.common.connection.NativeHttpClient int status = conn.getResponseCode(); status返回值是400 可是我是按照例子来的,没有做更改啊,怎么会是400呢?
dongchaofsdfds 2015-06-23
  • 打赏
  • 举报
回复
引用 1 楼 oh_Maxy 的回复:
你这错误只是说在哪个地方出现的,最终要的异常类型没给出
{"msg_id": 3249497161, "error": {"message": "app_key does not exist", "code": 1008}}

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧