I have followed this guide to use Google Vision Api, but I have always the following error:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "shutdownHooks")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:442)
at java.lang.Runtime.addShutdownHook(Runtime.java:209)
at com.google.common.util.concurrent.MoreExecutors$Application.addShutdownHook(MoreExecutors.java:223)
I have done all the steps in this video to use Service Account, but I can not translate the following code,which is for Storage, to be used for Vision Api:
private volatile static Storage instance = null;
InputStream authFile = null;
authFile = new FileInputStream(new File("WEB-INF/myJsonServiceAccount.json"));
instance = StorageOptions.newBuilder().setCredentials(ServiceAccountCredentials.fromStream(authFile))
.build().getService();
How should I use Service account for Vision Api ?