Title
o

Omkar Patil

10/20/2022, 7:41 AM
Hello Everyone!! I am using LakeFS Java client
ActionsApi apiInstance = new ActionsApi(defaultClient);
    String repository = "repository_example"; // String | 
    String runId = "runId_example"; // String |
but Here I am not able to understand about what is runID?
a

Ariel Shaqed (Scolnicov)

10/20/2022, 7:43 AM
Hi @Omkar Patil, The actions documentation includes a brief explanation. Which call are you attempting to perform?
o

Omkar Patil

10/20/2022, 7:45 AM
@Ariel Shaqed (Scolnicov) Now I am trying to login in LakeFS with Accesskey and SecretID
a

Ariel Shaqed (Scolnicov)

10/20/2022, 7:49 AM
Cool! I'd start by verifying some simple call works (I like RepositoriesApi.listRepositories, it has easy parameters), then move to ewhat you really want to do.
That lets me separate the annoying stuff of getting a client working in my test setup from the important stuff of making the client do what I need to do. 🙂
o

Omkar Patil

10/20/2022, 7:51 AM
I want to login into LakeFS using my access key and secret access key using LakeFS java client
a

Ariel Shaqed (Scolnicov)

10/20/2022, 7:56 AM
Cool! This is how we do it in lakeFSFS. Does the example help?
o

Omkar Patil

10/20/2022, 8:03 AM
ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("<http://localhost/api/v1/auth/login>");


    AuthApi apiInstance = new AuthApi(defaultClient);
    LoginInformation loginInformation = new LoginInformation(); // LoginInformation |
    loginInformation.setAccessKeyId("my_access_key_ID");
    loginInformation.setSecretAccessKey("my_secret_access_key");
    try {
        AuthenticationToken result = apiInstance.login(loginInformation);
        System.out.println(result);
    } catch (ApiException e) {
       System.out.println(e.getMessage());
    }
I am using this code but I am getting an error
a

Ariel Shaqed (Scolnicov)

10/20/2022, 8:14 AM
Can you share the error that this writes to output?
Sorry. I think your base path is incorrect.
o

Omkar Patil

10/20/2022, 8:16 AM
ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error running Quarkus: java.lang.reflect.InvocationTargetExceptio n at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType)' at io.lakefs.clients.api.ApiClient.serialize(ApiClient.java:850) at io.lakefs.clients.api.ApiClient.buildRequest(ApiClient.java:1103) at io.lakefs.clients.api.ApiClient.buildCall(ApiClient.java:1052) at io.lakefs.clients.api.AuthApi.loginCall(AuthApi.java:3851) at io.lakefs.clients.api.AuthApi.loginValidateBeforeCall(AuthApi.java:3858) at io.lakefs.clients.api.AuthApi.loginWithHttpInfo(AuthApi.java:3897) at io.lakefs.clients.api.AuthApi.login(AuthApi.java:3878) at org.acme.Main.main(Main.java:26) ... 6 more 2022-10-20 13:41:28,146 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus star tup failure
a

Ariel Shaqed (Scolnicov)

10/20/2022, 8:16 AM
defaultClient.setBasePath("<http://localhost/api/v1/>");
might be better
So you're also running into an issue with the version of okhttp.
Can you share your pom.xml (or other build config file), please?
o

Omkar Patil

10/20/2022, 8:17 AM
<?xml version="1.0"?>
<project xsi:schemaLocation="<http://maven.apache.org/POM/4.0.0> <https://maven.apache.org/xsd/maven-4.0.0.xsd>" xmlns="<http://maven.apache.org/POM/4.0.0>"
    xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.acme</groupId>
  <artifactId>lakefsclientJava</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <properties>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <maven.compiler.release>17</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
    <quarkus.platform.version>2.13.3.Final</quarkus.platform.version>
    <skipITs>true</skipITs>
    <surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${quarkus.platform.group-id}</groupId>
        <artifactId>${quarkus.platform.artifact-id}</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-arc</artifactId>
    </dependency>
    <dependency>
      <groupId>io.lakefs</groupId>
      <artifactId>api-client</artifactId>
      <version>0.83.3</version>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-reactive</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>${quarkus.platform.group-id}</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus.platform.version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
              <goal>generate-code</goal>
              <goal>generate-code-tests</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
        <configuration>
          <compilerArgs>
            <arg>-parameters</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <systemPropertyVariables>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
            <maven.home>${maven.home}</maven.home>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <systemPropertyVariables>
                <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                <maven.home>${maven.home}</maven.home>
              </systemPropertyVariables>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <properties>
        <skipITs>false</skipITs>
        <quarkus.package.type>native</quarkus.package.type>
      </properties>
    </profile>
  </profiles>
</project>
a

Ariel Shaqed (Scolnicov)

10/20/2022, 8:20 AM
The lakeFS client is auto-generated from the swagger definition. It ends up using OkHttp v. 4.9.1. Could you look at using that same version in your code? (Otherwise we're going to have to shade, which can get messy)
o

Omkar Patil

10/20/2022, 8:21 AM
what should I change in my pom.xml and can't we use LakeFS client to consume the APIs?
a

Ariel Shaqed (Scolnicov)

10/20/2022, 8:22 AM
We'd need to dig into whichever other library first brings it in. I'm having a look, starting with things with "rest" in their name...
Where can I find this:
<quarkus.platform.version>2.13.3.Final</quarkus.platform.version>
? Maven Central only goes up to 2.13.2.Final.
o

Omkar Patil

10/20/2022, 8:27 AM
Even after changing to this version I am getting the same error
a

Ariel Shaqed (Scolnicov)

10/20/2022, 8:30 AM
Sorry, I'm still reading.
io.lakefs:api-client:0.83.3 wants OkHttp3 v. 4.9.1, but
mvn dependency:tree
om your POM says that it ends up with 3.14.9. I am not sure why.
o

Omkar Patil

10/20/2022, 8:36 AM
which other version can be suitable?
a

Ariel Shaqed (Scolnicov)

10/20/2022, 8:36 AM
I'd guess we at least need a similar major version, so 4? But I do not honestly know whether OkHttp follow semantic versioning.
Perhaps we can try with an explicit request for this version?
<dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.9.1</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>logging-interceptor</artifactId>
            <version>4.9.1</version>
        </dependency>
o

Omkar Patil

10/20/2022, 8:41 AM
After adding this in my pom.xml I am getting this error ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error running Quarkus: java.lang.reflect.InvocationTargetExceptio n at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.NoSuchFieldError: Companion at okhttp3.internal.Util.<clinit>(Util.kt:71) at okhttp3.internal.concurrent.TaskRunner.<clinit>(TaskRunner.kt:309) at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:41) at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:47) at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.kt:471) at io.lakefs.clients.api.ApiClient.initHttpClient(ApiClient.java:117) at io.lakefs.clients.api.ApiClient.initHttpClient(ApiClient.java:113) at io.lakefs.clients.api.ApiClient.<init>(ApiClient.java:86) at io.lakefs.clients.api.Configuration.<clinit>(Configuration.java:18) at org.acme.Main.main(Main.java:19) ... 6 more
This is a new error
a

Ariel Shaqed (Scolnicov)

10/20/2022, 8:59 AM
We're still in JVM dependency hell, this time it looks like a Kotlin implementation detail from okhttp. Could you please open a bug, and I will find some Java expert to help me on this?
o

Omkar Patil

10/20/2022, 9:21 AM
how I can open a bug?
could you please guide me?
a

Ariel Shaqed (Scolnicov)

10/20/2022, 9:31 AM
Sure! Go to https://github.com/treeverse/lakeFS/issues/new and fill in title and description 🙂 It will be fine, not to worry!
o

Omkar Patil

10/20/2022, 9:45 AM
Is there any other way to implement this?
a

Ariel Shaqed (Scolnicov)

10/20/2022, 9:46 AM
I take it you need to use Quarkus, right?
o

Omkar Patil

10/20/2022, 10:04 AM
yes I am using Quarkus
a

Ariel Shaqed (Scolnicov)

10/20/2022, 10:09 AM
I am not sure why we get this retro dependency in there. I will keep digging, but an issue might help me close the loop faster on fixing this.
o

Omkar Patil

10/20/2022, 10:43 AM
ok
Thank you for your help