Java APNS證書錯誤,顯示“ DerInputStream.getLength():lengthTag = 109,太大。”
我遇到了同樣的問題,但是只有當您使用 我的解決方案才能為您提供幫助。
Maven資源過濾(讓您在資源文件中包含變量)可能會使您的二進制文件混亂-并且證書對修改尤其敏感。
通常,不應過濾二進制內容。但是我不能僅僅禁用資源過濾,因為我有一些包含變量的.properties文件。因此解決方案是 。
<build> [...] <resources><resource> <directory>src/main/resources</directory> <filtering>true</filtering> <excludes><exclude>**/*.p12</exclude> </excludes></resource><resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes><include>**/*.p12</include> </includes></resource> </resources> [...]</build>
有關Maven資源過濾的更多信息:http : //maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
解決方法當我嘗試使用Java APNS將推送通知發送到iOS時,收到以下錯誤消息:
com.notnoop.exceptions.InvalidSSLConfig:java.io.IOException:DerInputStream.getLength():lengthTag= 109,太大。
我已經嘗試將證書轉換為個人信息交換(.p12),也遇到相同的錯誤。任何人都知道問題以及如何解決?
這是我的Java代碼:
ApnsService service = APNS.newService() .withCert('src/net/notification/ck.jks','******') .withSandboxDestination() .build();String payload = APNS.newPayload().alertBody(record.getSendMsg()).build();String token = record.getToken();service.push(token,payload);
謝謝。
