I'm using Google Calendar client API and trying to authenticate with Google.
Following code is working in standalone application and not working in web application environment.
In case of web application,
setServiceAccountPrivateKeyFromP12File(File)
method is not able to find the path what i provided, I tried in many ways of answers given by stackexchange users.
But for me no use.Everytime it is showing only one message, File path (no such file or path).
Don't know what's wrong. Please help me to find a solution to this problem.
GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(Collections.singleton(CalendarScopes.CALENDAR))
.setServiceAccountPrivateKeyFromP12File(new File(CLIENT_SECRET)).build();
Here the private static final String CLIENT_SECRET="credentials/Test.p12"
;
I tried with ClassLoaders
,URL
but no use. always throwing the FileNotFoundException
.
My project is maven project and the code is in dependent jar file.