我已經創建了使用Prediction Api 1.5v的Google應用引擎項目。當我在本地平均本地主機上運行它時,它對我很好:8888使用Google o2Auth使用客戶端ID和客戶端密碼進行身份驗證。但當我遇到它生活會給出一個錯誤的java.security.AccessControlException:訪問被拒絕
java.security.AccessControlException:訪問被拒絕(「java.io.FilePermission中的」「/基/數據/家/應用/秒〜charn-項目/ 1.369216781240579013/.credentials」 「寫」)
我o2auth的代碼是
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(Database.class.getResourceAsStream(「/ client_secrets.json」))); System.out.println(「cl」+ clientSecrets.getDetails()。getClientSecret());
if (clientSecrets.getDetails().getClientId().startsWith("Enter")
|| clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
System.out.println(
"Enter Client ID and Secret from https://code.google.com/apis/console/?api=prediction "
+ "into prediction-cmdline-sample/src/main/resources/client_secrets.json");
System.exit(1);
}
// set up file credential store
FileCredentialStore credentialStore = new FileCredentialStore(
new File(System.getProperty("user.home"), ".credentials/prediction.json"), JSON_FACTORY);
// set up authorization code flow
System.out.println("cre"+credentialStore);
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
httpTransport, JSON_FACTORY, clientSecrets,
Collections.singleton(PredictionScopes.PREDICTION)).setCredentialStore(credentialStore)
.build();
// authorize
return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
可能的問題是在這條線
FileCredentialStore credentialStore =新FileCredentialStore( 新文件(System.getProperty( 「的user.home」), 「.credentials/prediction.json」), JSON_FACTORY);