Open manishjindal opened 1 month ago
Hi manishjindal, how did you compile the example? Could you please provide the complete command you've used for javac
with classpaths? Also please note that the class is envelopeaead.EnvelopeAeadExample
Following is project structure:
├── pom.xml
├── src
│ └── main
│ └── java
│ └── envelopeaead
│ └── EnvelopeAeadExample.java
└── target
├── classes
│ └── envelopeaead
│ └── EnvelopeAeadExample.class
├── encrypt-file-1.0-SNAPSHOT.jar
├── generated-sources
│ └── annotations
├── maven-archiver
│ └── pom.properties
└── maven-status
└── maven-compiler-plugin
└── compile
└── default-compile
├── createdFiles.lst
└── inputFiles.lst
and following are the content of my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your-group-id</groupId>
<artifactId>encrypt-file</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>11</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.39.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-kms</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
</dependency>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>tink</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>tink-gcpkms</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And I am using following command to compile the code:
mvn clean install
And using following command to run :
java -cp target/classes envelopeaead.EnvelopeAeadExample
Error: Unable to initialize main class envelopeaead.EnvelopeAeadExample
Caused by: java.lang.NoClassDefFoundError: com/google/crypto/tink/aead/AeadParameters
Help us help you
We'd like to know more about your Tink deployment.
Describe the bug:
I am trying to use the example
https://github.com/tink-crypto/tink-java-gcpkms/blob/main/examples/envelopeaead/EnvelopeAeadExample.java
but after adding all the dependencies it is showing following error:What was the expected behavior?
It should run the example without any issues
How can we reproduce the bug? Just compile and run the code and you should be able to reproduce this very easily.
Do you have any debugging information?
What version of Tink are you using? 1.13.0
Can you tell us more about your development environment?
java --version
openjdk 18.0.2.1 2022-08-18 OpenJDK Runtime Environment (build 18.0.2.1+1-1) OpenJDK 64-Bit Server VM (build 18.0.2.1+1-1, mixed mode, sharing)
Is there anything else you'd like to add?
Provide any additional context about the problem.