【发布时间】:2016-02-15 09:11:45
【问题描述】:
我是 GWT 应用程序的新手,现在正在处理它。我有一个似乎很简单的问题,但我已经好几个小时没有解决它了。我想通过这行代码通过 P12 密钥文件访问谷歌分析数据。
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId(serviceAccountMail)
.setServiceAccountPrivateKeyFromP12File(new File("src/main/webapp/WEB-INF/key","XXXXXX-77b2f9138e9612309473.p12"))
.setServiceAccountScopes(AnalyticsScopes.all()).build();
如果我将上面的代码简单地作为 Java 应用程序运行来测试,代码可以正常工作。但是当我将 GWT 应用程序部署到 tomcat 并让它运行时。我遇到了以下错误。
Mon Feb 15 16:04:41 GMT+800 2016 mp.client.XXAsyncCallback WARNING:
ERROR:Type 'java.io.FileNotFoundException' was not included in the set of
types which can be serialized by this SerializationPolicy or its Class
object could not be loaded. For security purposes, this type will not
be serialized.
: instance = java.io.FileNotFoundException: XXXXXX-77b2f9138e9612309473.p12
(The system cannot find the file specified) from Service_Proxy.getData
任何即时帮助将不胜感激。谢谢。
【问题讨论】: