我已经创建了使用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);