Closed skanel closed 6 years ago
Maybe something wrong with the settings in application.properties
Is the path for fcm.service-account-file
correct?
fcm.service-account-file=<path to json file>
good , now i get a new message:
2018-06-11 14:21:27.548 ERROR 3728 --- [pool-1-thread-1] com.qmexpress : Joke object : Sending chuck joke... 2018-06-11 14:21:27.563 ERROR 3728 --- [pool-1-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
Try the latest firebase sdk 6.2.0
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.2.0</version>
If that does not work try an older version
<version>5.10.0</version>
I have tried to clone your repos and run , get the same message, but application is running mean we can access to http://localhost:8080/index.hml
and one more thing how we test the endpoint /register
The repository on GitHub uses 6.1.0. Did you try 6.2.0 or 5.10.0?
to test the endpoint you have to open the browser and point it to the index.html page.
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 24.576 s [INFO] Finished at: 2018-06-11T16:05:31+07:00 [INFO] ------------------------------------------------------------------------ 2018-06-11 16:05:31.786 INFO 5000 --- [ Thread-8] onfigReactiveWebServerApplicationContext : Closing org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext@32210b60: startup date [Mon Jun 11 16:05:20 ICT 2018]; root of context hierarchy 2018-06-11 16:05:31.794 INFO 5000 --- [ Thread-8] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown Sending chuck joke... 2018-06-11 16:05:32.032 INFO 5000 --- [ Thread-8] r.ipc.netty.tcp.BlockingNettyContext : Stopped HttpServer on /0:0:0:0:0:0:0:0:8080 2018-06-11 16:05:32.063 ERROR 5000 --- [pool-1-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist. at com.google.firebase.FirebaseApp.getInstance(FirebaseApp.java:169) ~[firebase-admin-5.10.0.jar:na] at com.google.firebase.FirebaseApp.getInstance(FirebaseApp.java:140) ~[firebase-admin-5.10.0.jar:na] at com.google.firebase.messaging.FirebaseMessaging.getInstance(FirebaseMessaging.java:121) ~[firebase-admin-5.10.0.jar:na] at ch.rasc.swpush.fcm.FcmClient.send(FcmClient.java:52) ~[classes/:na] at ch.rasc.swpush.PushChuckJokeService.sendPushMessage(PushChuckJokeService.java:47) ~[classes/:na] at ch.rasc.swpush.PushChuckJokeService.sendChuckQuotes(PushChuckJokeService.java:32) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171] at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_171] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_171] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_171] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_171] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
Maybe something wrong with the service account json file. Does it look similar to this?
{
"type": "service_account",
"project_id": "demoproj",
"private_key_id": "7ba",
"private_key": "-----BEGIN PRIVATE KEY----------END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-c2gco@d",
"client_id": "10523",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-c2gc"
}
my file is look like this.
when I run the app I get this message, do you have any idea?