【问题标题】:Java GWT: File becomes invalid when deployed to TomcatJava GWT:部署到 Tomcat 时文件无效
【发布时间】:2016-05-31 11:38:27
【问题描述】:

我正在使用 *.p12(私钥)文件连接到我的谷歌分析数据,如下所示。

        GoogleCredential credential = new GoogleCredential.Builder()
                .setTransport(httpTransport)
                .setJsonFactory(jsonFactory)
                .setServiceAccountId(serviceAccountMail)
                .setServiceAccountPrivateKeyFromP12File(new File(getRequest().getServletContext().getRealPath(keyFileLocation),keyFile))
                .setServiceAccountScopes(AnalyticsScopes.all()).build();

这是在我使用以下选项构建的 gwtp 应用程序中:

clean install -Dstrict -Denvironment=dev -Denv.applicationProfile=dev -DskipTests=true

当我将代码部署到 Tomcat 时,它会损坏或失效。请看下面的截图:

在日志中,我也可以找到这个错误:

 DerInputStream.getLength(): lengthTag=111, too big.

对于如何解决此问题的任何建议,我将不胜感激。

【问题讨论】:

  • 为什么要标记 GWT?
  • @AndreiVolgin,已经删除了 gwt 标签。我目前正在开发一个 GWTP 应用程序,所以我认为这是一个 gwt 编译问题。我发现这是一个 Maven 问题。

标签: java maven google-analytics maven-resources-plugin


【解决方案1】:

哦,我应该更努力地寻找答案。这不是 Tomcat 的问题,而是需要在 Maven 中处理的问题。我的同事指导我找到here 的答案。下面对我有用。

<build>
  ...
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-resources-plugin</artifactId>                
      <configuration>
        <nonFilteredFileExtensions>
          <nonFilteredFileExtension>p12</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
      </configuration>
    </plugin>
  </plugins>
</build>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-12
    • 1970-01-01
    • 2013-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-06
    相关资源
    最近更新 更多