0

I am using a *.p12 (private key) File to connect to my google analytics data as follows.

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

This is in a gwtp application which I built using below options:

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

When I deploy the code to Tomcat, it gets corrupted or becomes invalid. See the below screenshot:

enter image description here

In logs, I can also find this error:

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

I would appreciate any advice on how to work this around.

Iam Riz
  • 117
  • 1
  • 14

1 Answers1

0

Oh, I should have looked for the answer harder. It's rather not a Tomcat issue, but a problem that needs to be handled in Maven. My colleague directed me to the answer found here. Below worked for me.

<build>
  ...
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-resources-plugin</artifactId>                
      <configuration>
        <nonFilteredFileExtensions>
          <nonFilteredFileExtension>p12</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
      </configuration>
    </plugin>
  </plugins>
</build>
Community
  • 1
  • 1
Iam Riz
  • 117
  • 1
  • 14