java服务端集成的时候报错

sdk_java
jpush
sdk
error
标签: #<Tag:0x00007fb839e67960> #<Tag:0x00007fb839e677a8> #<Tag:0x00007fb839e67668> #<Tag:0x00007fb839e67528>

(小下和) #1

第一次用极光然后我在项目下创建了
jpush类(这个是在博客和官方文档上拿过来的)


public class Jdpush {
	    
protected static final Logger LOG = LoggerFactory.getLogger(Jdpush.class);  
public static final String TITLE = "你好";  
public static final String ALERT = "你好";  
public static final String MSG_CONTENT = "测试";  
public static final String REGISTRATION_ID = "13456";  
public static final String TAG = "tag_api";  
  
public  static JPushClient jpushClient=null; 

@SuppressWarnings("deprecation")
public static void testSendPush(String appKey ,String masterSecret){  
    jpushClient = new JPushClient(masterSecret, appKey, 3);
   //生成推送的内容,这里我们先测试全部推送  
   PushPayload payload=buildPushObject_all_alias_alert();  
   try {  
       System.out.println(payload.toString());  
       PushResult result = jpushClient.sendPush(payload);  
       System.out.println(result+"................................");    
       LOG.info("Got result - " + result);  
         
   } catch (APIConnectionException e) {  
       LOG.error("Connection error. Should retry later. ", e);       
   } catch (APIRequestException e) {  
       LOG.error("Error response from JPush server. Should review and fix it. ", e);  
       LOG.info("HTTP Status: " + e.getStatus());  
       LOG.info("Error Code: " + e.getErrorCode());  
       LOG.info("Error Message: " + e.getErrorMessage());  
       LOG.info("Msg ID: " + e.getMsgId());  
       }  
   } 
  /*
    * 快捷地构建推送对象:所有平台,所有设备,内容为 ALERT 的通知。 
    */
 public static PushPayload buildPushObject_all_all_alert() {  
     return PushPayload.alertAll(ALERT);  
 } 

 /*
  * 构建推送对象:所有平台,推送目标是别名为 "alias1",通知内容为 ALERT。
  */
 public static PushPayload buildPushObject_all_alias_alert() {  
    return PushPayload.newBuilder()  
   .setPlatform(Platform.all())//设置接受的平台  
   .setAudience(Audience.all())//Audience设置为all,说明采用广播方式推送,所有用户都可以接收到  
   .setNotification(Notification.alert(ALERT))  
   .build();  
  } 
  /*
  * 构建推送对象:平台是 Android
* 目标是 tag 为 "tag1" 的设备,内容是 Android 通知 ALERT,并且标题为 TITLE。
* 
*/
  public static PushPayload buildPushObject_android_tag_alertWithTitle() {  
   return PushPayload.newBuilder()  
   .setPlatform(Platform.android())  
   .setAudience(Audience.all())  
   .setNotification(Notification.android(ALERT, TITLE, null))  
   .build();  
}  

 public static PushPayload buildPushObject_android_and_ios() {  
   return PushPayload.newBuilder()  
   .setPlatform(Platform.android_ios())  
   .setAudience(Audience.tag("tag1"))  
   .setNotification(Notification.newBuilder()  
           .setAlert("alert content")  
           .addPlatformNotification(AndroidNotification.newBuilder()  
                 .setTitle("Android Title").build())  
           .addPlatformNotification(IosNotification.newBuilder()  
                 .incrBadge(1)  
                 .addExtra("extra_key", "extra_value").build())  
           .build())  
   .build();  
} 

/*
* 构建推送对象:平台是 iOS,推送目标是 "tag1", "tag_all" 的交集,
* 推送内容同时包括通知与消息 - 通知信息是 ALERT,角标数字为 5,通知声音为 "happy",
* 并且附加字段 from = "JPush";消息内容是 MSG_CONTENT。通知是 APNs 推送通道的,
* 消息是 JPush 应用内消息通道的。APNs 的推送环境是“生产”(如果不显式设置的话,Library 会默认指定为开发)
*/
public static PushPayload buildPushObject_ios_tagAnd_alertWithExtrasAndMessage() {  
   return PushPayload.newBuilder()  
       .setPlatform(Platform.ios())  
       .setAudience(Audience.tag_and("tag1", "tag_all"))  
       .setNotification(Notification.newBuilder()  
               .addPlatformNotification(IosNotification.newBuilder()  
               .setAlert(ALERT)  
               .setBadge(5)  
               .setSound("happy")  
               .addExtra("from", "JPush")  
               .build())  
               .build())  
        .setMessage(Message.content(MSG_CONTENT))  
        .setOptions(Options.newBuilder()  
                .setApnsProduction(true)  
                .build())  
        .build();  
}  
  
/*
* 构建推送对象:平台是 Andorid 与 iOS,推送目标是 ("tag1" 与 "tag2" 的并集)交
* ("alias1" 与 "alias2" 的并集),推送内容是 - 内容为 MSG_CONTENT 的消息,
* 并且附加字段 from = JPush。
*/
public static PushPayload buildPushObject_ios_audienceMore_messageWithExtras() {  
   return PushPayload.newBuilder()  
       .setPlatform(Platform.android_ios())  
       .setAudience(Audience.newBuilder()  
               .addAudienceTarget(AudienceTarget.tag("tag1", "tag2"))  
               .addAudienceTarget(AudienceTarget.alias("alias1", "alias2"))  
               .build())  
       .setMessage(Message.newBuilder()  
               .setMsgContent(MSG_CONTENT)  
               .addExtra("from", "JPush")  
               .build())  
       .build();  
 } 
}

然后在controller里面创建了jpush方法

public void jpush() {
 // 设置好账号的ACCESS_KEY和SECRET_KEY
    String appKey = "1b****2*************";
    String masterSecret = "6***a9******************";
    Jdpush.testSendPush(appKey, masterSecret);    
}

直接调用
调用的时候报错:

ERROR 2017-07-14 11:08:04,192 cn.jiguang.common.connection.NativeHttpClient.http-bio-8080-exec-7 Your request params is invalid. Please check them according to error message.

ERROR 2017-07-14 11:08:04,200 com.weiwend.jdpush.Jdpush.http-bio-8080-exec-7 Error response from JPush server. Should review and fix it. 
{}

INFO 2017-07-14 11:08:04,208 com.weiwend.jdpush.Jdpush.http-bio-8080-exec-7 HTTP Status: 400
INFO 2017-07-14 11:08:04,208 com.weiwend.jdpush.Jdpush.http-bio-8080-exec-7 Error Code: 1011
INFO 2017-07-14 11:08:04,208 com.weiwend.jdpush.Jdpush.http-bio-8080-exec-7 Error Message: cannot find user by this audience
INFO 2017-07-14 11:08:04,208 com.weiwend.jdpush.Jdpush.http-bio-8080-exec-7 Msg ID: 4241206476

我该如何处理呢?


#2