Your request params is invalid. Please check them according to error message. java 服务

jpush
标签: #<Tag:0x00007fb83f9654e8>

(侠岚) #1
{"platform":"all","audience":{"registration_id":["4A6D045FB7538C9DE0531B1EA8C013C8","5935DB8662F2E30FE05860AA8C0BCE6"]},"notification":{"android":{"alert":"有新的挂牌房源更新,再不来看别人就抢走了。","extras":{"type":"sale","orderId":"3768998"},"builder_id":1,"title":"有新的挂牌房源更新,再不来看别人就抢走了。"},"ios":{"alert":"有新的挂牌房源更新,再不来看别人就抢走了。","extras":{"type":"sale","orderId":"3768998"},"badge":"0","sound":"default"}},"message":{"msg_content":"有新的挂牌房源更新,再不来看别人就抢走了。","extras":{"type":"sale","orderId":"3768998"}},"options":{"sendno":915231216,"time_to_live":0,"apns_production":false}}


[ERROR] 2018-08-14 14:23:06 NativeHttpClient@(NativeHttpClient.java:203):Your request params is invalid. Please check them according to error message.
[ERROR] 2018-08-14 14:23:06 JPusher@(JPusher.java:242):Should review the error, and fix the request
{}
	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:160)
	at cn.jpush.api.JPushClient.sendPush(JPushClient.java:193)
	at com.dp.app.core.common.tools.JPusher.sendAll(JPusher.java:235)
	at com.dp.app.core.common.tools.JPusher.main(JPusher.java:56)

#2

请根据详细的报错来排查问题,catch 具体的错误码code和Message

根据当前参数来看,你的registrationID值是错误非法的


(侠岚) #3
{"platform":"all","audience":{"alias":["4A6D045FB7538C9DE0531B1EA8C013C8","5935DB8662F2E30FE05860AA8C0BCE6"]},"notification":{"android":{"alert":"有新的挂牌房源更新,再不来看别人就抢走了。","extras":{"type":"sale","orderId":"3768998"},"builder_id":1,"title":"有新的挂牌房源更新,再不来看别人就抢走了。"},"ios":{"alert":"有新的挂牌房源更新,再不来看别人就抢走了。","extras":{"type":"sale","orderId":"3768998"},"badge":"0","sound":"default"}},"message":{"msg_content":"有新的挂牌房源更新,再不来看别人就抢走了。","extras":{"type":"sale","orderId":"3768998"}},"options":{"sendno":354246240,"time_to_live":0,"apns_production":false}}
[ERROR] 2018-08-14 14:53:09 NativeHttpClient@(NativeHttpClient.java:203):Your request params is invalid. Please check them according to error message.
[ERROR] 2018-08-14 14:53:09 JPusher@(JPusher.java:242):Should review the error, and fix the request
{}
	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:160)
	at cn.jpush.api.JPushClient.sendPush(JPushClient.java:193)
	at com.dp.app.core.common.tools.JPusher.sendAll(JPusher.java:235)
	at com.dp.app.core.common.tools.JPusher.main(JPusher.java:56)

原来audience是alias 对应我们应用的userid 是想按照userID去推送,现在一直报这个错误,用api中的样例也报这个错误。

	try {
			PushResult result = jpushClient.sendPush(payload);
			System.out.println("JPusher:" + result);
		} catch (APIConnectionException e) {
			log.error("Connection error, should retry later", e);

		} catch (APIRequestException e) {
			 // Should review the error, and fix the request
	    	log.error("Should review the error, and fix the request", e);
	    	log.info("HTTP Status: " + e.getStatus());
	    	log.info("Error Code: " + e.getErrorCode());
	    	log.info("Error Message: " + e.getErrorMessage());
		}

异常都捕捉了,但是catch不到。


#4

没有详细报错不好判断,大致猜测是你客户端的别名没设置成功,报错找不到目标


(侠岚) #5

public static PushPayload buildPushObject_all_all_alert() {
return PushPayload.alertAll(ALERT);
}
用上面api提供的这个生成PushPayload对象没问题,可以正常推送
但是同样是api中的样例 下面这个方法也提示那个错误。。
public static PushPayload buildPushObject_android_tag_alertWithTitle() {
return PushPayload.newBuilder().setPlatform(Platform.android())
.setAudience(Audience.tag(“tag1”))
.setNotification(Notification.android(ALERT, TITLE, null))
.build();
}


#6

那就说明你客户端别名和标签并没有设置成功,给他们推送找不到目标肯定会报错,请阅读

先设置你的别名和标签,后推送


(侠岚) #7

找到问题了,就是因为别名跟客户端没对应上。。。。谢谢您的指教。