Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using in Android causes a "No static field" #362

Open
hannesa2 opened this issue Dec 16, 2022 · 6 comments
Open

Using in Android causes a "No static field" #362

hannesa2 opened this issue Dec 16, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@hannesa2
Copy link

In an Android Gradle project using
implementation 'org.jfrog.artifactory.client:artifactory-java-client-services:2.13.0'
I run with

        val artifactory: Artifactory = ArtifactoryClientBuilder.create()
            .setUrl("https://artifactory.server.info")
            .build()

into this

    java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes4.dex)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:151)
        at org.jfrog.artifactory.client.httpClient.http.HttpBuilderBase.createConnectionMgr(HttpBuilderBase.java:359)
        at org.jfrog.artifactory.client.httpClient.http.HttpBuilderBase.configConnectionManager(HttpBuilderBase.java:344)
        at org.jfrog.artifactory.client.httpClient.http.HttpBuilderBase.build(HttpBuilderBase.java:78)
        at org.jfrog.artifactory.client.ArtifactoryClientBuilder.createClientBuilder(ArtifactoryClientBuilder.java:174)
        at org.jfrog.artifactory.client.ArtifactoryClientBuilder.build(ArtifactoryClientBuilder.java:196)
        at info.hannes.appUpdate.AppUpdateHelper.requestArtifactoryVersions(AppUpdateHelper.kt:159)

Does someone has an idea how to get rid of it ?

@hannesa2 hannesa2 added the bug Something isn't working label Dec 16, 2022
@hannesa2 hannesa2 changed the title Uning in Android causes a Uning in Android causes a "No static field" Dec 16, 2022
@hannesa2 hannesa2 changed the title Uning in Android causes a "No static field" Using in Android causes a "No static field" Dec 17, 2022
@hannesa2
Copy link
Author

Running the sample from https://github.com/jfrog/project-examples/tree/master/artifactory-client-java-examples/gradle-example
I run into this issue #203

Exception in thread "main" org.apache.http.client.HttpResponseException: status code: 400, reason phrase: {
  "errors" : [ {
    "status" : 400,
    "message" : "This REST API is available only in Artifactory Pro (see: jfrog.com/artifactory/features). If you are already running Artifactory Pro please make sure your server is activated with a valid license key.\n"
  } ]
}
	at org.jfrog.artifactory.client.impl.ArtifactoryImpl.newHttpResponseException(ArtifactoryImpl.java:229)
	at org.jfrog.artifactory.client.impl.ArtifactoryImpl.put(ArtifactoryImpl.java:336)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap.invoke(PojoMetaMethodSite.java:213)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
	at org.jfrog.artifactory.client.impl.RepositoriesImpl.create(RepositoriesImpl.groovy:37)
	at org.jfrog.example.ClientExample.createNewRepository(ClientExample.java:103)
	at org.jfrog.example.ClientExample.main(ClientExample.java:49)

That's why this is obsolete now

@yahavi
Copy link
Member

yahavi commented Dec 18, 2022

@hannesa2,
Thanks for reporting this issue!
For some reason, the AllowAllHostnameVerifier class is missing from the Apache HTTP client in your classpath. However, we couldn't reproduce this issue.
I believe that upgrading the httpclient to 5 may possibly resolve this issue - https://github.com/jfrog/artifactory-client-java/blob/2.13.0/build.gradle#L62

Would you like to contribute code to the Artifactory Java client project? Alternatively, could you please provide a minimal reproducer?

We are looking forward to your response.

@hannesa2
Copy link
Author

Sure, I can provide a pull request which point this out.
In the meantime I run into this

@automationhoda1
Copy link

Hi,

About the Firefox the Signup with Google spins, can you please write in which environment do you work(Is it windows/ mac (which macOS name?) and which Firefox browser version?

@hannesa2
Copy link
Author

Hi,

About the Firefox the Signup with Google spins, can you please write in which environment do you work(Is it windows/ mac (which macOS name?) and which Firefox browser version?

=> #363

@hannesa2
Copy link
Author

hannesa2 commented Feb 3, 2023

In version 2.13.1 the error still exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants