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

Caused by: javax.net.ssl.SSLHandshakeException: No name matching www.okx.com found #4928

Open
a1265137718 opened this issue Aug 1, 2024 · 2 comments

Comments

@a1265137718
Copy link

here is the Stack Trace

org.knowm.xchange.exceptions.ExchangeException: javax.net.ssl.SSLHandshakeException: No name matching www.okx.com found
at org.knowm.xchange.BaseExchange.applySpecification(BaseExchange.java:115)
at org.knowm.xchange.okex.OkexExchange.applySpecification(OkexExchange.java:49)
at org.knowm.xchange.ExchangeFactory.createExchange(ExchangeFactory.java:130)
at org.knowm.xchange.okex.OkexExchangeIntegration.testOpenPosition(OkexExchangeIntegration.java:85)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: javax.net.ssl.SSLHandshakeException: No name matching www.okx.com found
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1329)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1204)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1151)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:178)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1581)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:329)
at si.mazi.rescu.HttpTemplate.receive(HttpTemplate.java:145)
at si.mazi.rescu.RestInvocationHandler.receiveAndMap(RestInvocationHandler.java:156)
at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:113)
at com.sun.proxy.$Proxy19.getInstruments(Unknown Source)
at org.knowm.xchange.okex.service.OkexMarketDataServiceRaw.lambda$getOkexInstruments$0(OkexMarketDataServiceRaw.java:38)
at org.knowm.xchange.client.ResilienceUtils$DecorateCallableApi.call(ResilienceUtils.java:86)
at org.knowm.xchange.okex.service.OkexMarketDataServiceRaw.getOkexInstruments(OkexMarketDataServiceRaw.java:47)
at org.knowm.xchange.okex.OkexExchange.remoteInit(OkexExchange.java:102)
at org.knowm.xchange.BaseExchange.applySpecification(BaseExchange.java:113)
... 30 more
Caused by: java.security.cert.CertificateException: No name matching www.okx.com found
at java.base/sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:225)
at java.base/sun.security.util.HostnameChecker.match(HostnameChecker.java:98)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:459)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:434)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:233)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1313)
... 55 more

here is the code

  @Test
  public void testOpenPosition() throws Exception {
    if (API_KEY != null && SECRET_KEY != null && PASSPHRASE != null) {
      ExchangeSpecification spec =
          ExchangeFactory.INSTANCE
              .createExchange(OkexExchange.class)
              .getDefaultExchangeSpecification();
      spec.setApiKey(API_KEY);
      spec.setSecretKey(SECRET_KEY);
      spec.setExchangeSpecificParametersItem(OkexExchange.PARAM_PASSPHRASE, PASSPHRASE);

      final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(spec);

      exchange.getTradeService().getOpenPositions().getOpenPositions().forEach(System.out::println);
    }
  }
@a1265137718
Copy link
Author

API_KEY, SECRET_KEY, PASSPHRASE has been correct setted

@rizer1980
Copy link
Contributor

Hi, @a1265137718
Most likely this is an error at the operating system level and not Java.
It is also possible that you have a proxy somewhere in Java.
Check the accessibility of the site through the console:
dig www.okx.com
ping www.okx.com
wget https://www.okx.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants