Open dlorch opened 12 years ago
Ambiguous method overloading for method com.notnoop.apns.ApnsServiceBuilder#withCert. Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between: [class java.io.InputStream, class java.lang.String] [class java.lang.String, class java.lang.String] Around line 24 of ApnsFactoryBean.groovy 21: Object getObject() { 22: def apnsService = APNS.newService() 23: if(certificateResourcePath){ 24: apnsService = apnsService.withCert(this.getClass().getResourceAsStream(certificateResourcePath), password) 25: } else if(pathToCertificate){ 26: apnsService = apnsService.withCert(pathToCertificate, password) 27: } else {
Adding getClassLoader() to the following line in org/epseelon/grails/apns/ApnsFactoryBean.groovy solved the problem for me:
if(certificateResourcePath){ apnsService = apnsService.withCert(this.getClass().getClassLoader().getResourceAsStream(certificateResourcePath), password) } else if(pathToCertificate){ ...
File apns-dev.p12 in src/java, the following lines in Config
environments { development { apns { certificateResourcePath = "apns-dev.p12" password = "secret" environment = "sandbox" } } test { apns { pathToCertificate = "apns-dev.p12" password = "secret" environment = "sandbox" } } production { apns { pathToCertificate = "apns-dev.p12" password = "secret" environment = "production" } } }
$ grails --version Grails version: 2.0.4
$ java -version java version "1.6.0_29" Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
Another workaround for this is just to preface your paths with a /. Eg, pathToCertificate = "/apns-dev.p12"
Error
Solution
Adding getClassLoader() to the following line in org/epseelon/grails/apns/ApnsFactoryBean.groovy solved the problem for me:
My Configuration
File apns-dev.p12 in src/java, the following lines in Config
My Setup
$ grails --version Grails version: 2.0.4
$ java -version java version "1.6.0_29" Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)