Hello Everyone!! I am using LakeFS Java client ```...
# help
u
Hello Everyone!! I am using LakeFS Java client
Copy code
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?
u
Hi @Omkar Patil, The actions documentation includes a brief explanation. Which call are you attempting to perform?
u
@Ariel Shaqed (Scolnicov) Now I am trying to login in LakeFS with Accesskey and SecretID
u
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.
u
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. 🙂
u
I want to login into LakeFS using my access key and secret access key using LakeFS java client
u
Cool! This is how we do it in lakeFSFS. Does the example help?
u
Copy code
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
u
Can you share the error that this writes to output?
u
Sorry. I think your base path is incorrect.
u
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 134128,146 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus star tup failure
u
Copy code
defaultClient.setBasePath("<http://localhost/api/v1/>");
might be better
u
So you're also running into an issue with the version of okhttp.
u
Can you share your pom.xml (or other build config file), please?
u
```<?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> </system…
u
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)
u
what should I change in my pom.xml and can't we use LakeFS client to consume the APIs?
u
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...
u
Where can I find this:
Copy code
<quarkus.platform.version>2.13.3.Final</quarkus.platform.version>
? Maven Central only goes up to 2.13.2.Final.
u
Even after changing to this version I am getting the same error
u
Sorry, I'm still reading.
u
io.lakefsapi client0.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.
u
which other version can be suitable?
u
I'd guess we at least need a similar major version, so 4? But I do not honestly know whether OkHttp follow semantic versioning.
u
Perhaps we can try with an explicit request for this version?
Copy code
<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>
u
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
u
This is a new error
u
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?
u
how I can open a bug?
u
could you please guide me?
u
Sure! Go to https://github.com/treeverse/lakeFS/issues/new and fill in title and description 🙂 It will be fine, not to worry!
u
Is there any other way to implement this?
u
I take it you need to use Quarkus, right?
u
yes I am using Quarkus
u
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.
u
ok
u
Thank you for your help