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

WatsonServices: Unable to find acceptable protocols #603

Closed
joralemarti opened this issue Mar 6, 2017 · 15 comments
Closed

WatsonServices: Unable to find acceptable protocols #603

joralemarti opened this issue Mar 6, 2017 · 15 comments
Labels

Comments

@joralemarti
Copy link

joralemarti commented Mar 6, 2017

Hello, I'm testing the Watson Conversation Services:

Using Netbeans, IBM JAVA SDK 1.8, java-sdk-3.5.3-jar-with-dependencies.jar

I got this error when I tried the following:

ConversationService service = new ConversationService("2017_02_03"); 
service.setUsernameAndPassword("XXXXXXXXX", "XXXXXX"); 
MessageRequest newMessage = new MessageRequest.Builder()
  .inputText("This is some sample text")
  .build(); 

MessageResponse newresponse = service.message(
  "XXXXXXXXXXXXXXXXXXXXXXX",
  newMessage)
.execute();

WARNING: Exception on MessageDispatcher: java.lang.RuntimeException: java.net.UnknownServiceException: Unable to find acceptable protocols. isFallback=false, modes=[ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_2, TLS_1_1, TLS_1_0], supportsTlsExtensions=true), ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_0], supportsTlsExtensions=true), ConnectionSpec()], supported protocols=[TLSv1] at com.ibm.watson.developer_cloud.service.WatsonService$1.execute(WatsonService.java:182)
Thanks in advance.

@bruceadams
Copy link

@germanattanasio
Copy link
Contributor

This is a duplicate of #610

@ShubhamSharmaCSE
Copy link

Please can anyone provide me about the details of how to tackle this issue, I have a submission of my final year project this week but this error is not letting us test our project .

Thanks.

@bruceadams
Copy link

@ShubhamSharmaCSE The easiest workaround is to use OpenJDK or Oracle Java instead of IBM Java. Can you do that?

@asidd
Copy link

asidd commented Mar 22, 2017

Here is an update from a customer who is using Oracle JDK but faces this issue:

We are using Oracle Java JDK.
At runtime – when the application gets pushed to bluemix It uses – IBM JDK

buildpack-v3.8-20170308-1507
ibmjdk-1.8.0_20170215
liberty-17.0.0_1

We are seeing this issue – only when deploying new war file
Existing apps continue to work. Can you let us know what could be issue.

Thanks

@tahir-mehmood
Copy link

I am also facing same issue when I try to deploy a modified application. It gives me below error :

2017-03-22T15:20:23.06+0500 [APP/0] OUT 10:20:23.040 [Thread-20] ERROR com.ibm.watson.apis.conversation_enhanced.listener.SetupThread - Error ini
tializing Collectionjava.net.UnknownServiceException: Unable to find acceptable protocols. isFallback=false, modes=[ConnectionSpec(cipherSuites=[TLS_E
CDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DH
E_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA
], tlsVersions=[TLS_1_2, TLS_1_1, TLS_1_0], supportsTlsExtensions=true), ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECD
HE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_E
CDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AE
S_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_0], supportsTlsExtens
ions=true), ConnectionSpec()], supported protocols=[TLSv1, TLSv1.1, TLSv1.2]

What can be wrong ? What should I do ? I want to do some updates to my existing application. And when I do it, can't get it back up.

@germanattanasio
Copy link
Contributor

@asidd The customer needs to specify a different buildpack, See #610 (comment)

@joralemarti
Copy link
Author

joralemarti commented Mar 30, 2017

I solved my issue , modifying the WatsonService.java in this way.

  protected OkHttpClient configureHttpClient() {
    ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.COMPATIBLE_TLS)  
    .tlsVersions(TlsVersion.TLS_1_0)
    .cipherSuites(
          CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
          CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
          CipherSuite.TLS_DHE_RSA_WITH_AES_128_GCM_SHA256)
    .allEnabledTlsVersions()
    .supportsTlsExtensions(false)
    .allEnabledCipherSuites()
    .build();

    final OkHttpClient.Builder builder = new OkHttpClient.Builder();

    final CookieManager cookieManager = new CookieManager();
    cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);

    builder.cookieJar(new JavaNetCookieJar(cookieManager));

    builder.connectTimeout(60, TimeUnit.SECONDS);
    builder.writeTimeout(60, TimeUnit.SECONDS);
    builder.readTimeout(90, TimeUnit.SECONDS);
    builder.connectionSpecs(Collections.singletonList(spec));

    return builder.build();
  }

Thanks to all.

@coxd
Copy link

coxd commented Mar 30, 2017

@bruceadams @joralemarti has identified the key element that I missed when trying this approach: .allEnabledCipherSuites(). This overrides the cleansing of the cipher suites by OkHttp and uses the explicit set you enable in the sample socket.

@germanattanasio
Copy link
Contributor

germanattanasio commented Mar 31, 2017

In #626 I'm updating the okhttp version to be okhttp-3.7.0-SNAPSHOT

If someone can validate that the java-sdk-3.7.1-SNAPSHOT from sonatype: https://oss.sonatype.org/content/repositories/snapshots/com/ibm/watson/developer_cloud/java-sdk/3.7.1-SNAPSHOT/ fixes the IBM JDK issue then I will release the jar to maven.

@coxd
Copy link

coxd commented Mar 31, 2017

@germanattanasio:

All we need to do is this to continue to use 3.6.0 and which will work for all JDKs:

ConnectionSpec spec = 
    new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
        .allEnabledCipherSuites()
        .build();	  

builder.connectionSpecs(Collections.singletonList(spec));

See my comment in your gist for the explanation/justification.

@coxd
Copy link

coxd commented Mar 31, 2017

@joralemarti

Thank you again for pointing out the obvious. You will notice above I do not explicitly set any cipher suites. Forgetting about the basic problem that IBM JDK and Oracle names mismatch that has caused all of this - .allEnabledCipherSuites() clears the suites you've just set.

@jtviegas
Copy link

jtviegas commented Mar 31, 2017

hello All,
we are taking the jars from maven central with gradle,
3.7.1 still not in maven central, do you have an idea if it will be there soon?

thanking you in advance

@jtviegas
Copy link

jtviegas commented Apr 3, 2017

saw that now, 3.7.1 already in maven central, thank you !!!

@pieterjanverbruggen
Copy link

Hi all,

I still have this issue when deploying to Watson. In Netbeans it seems to work fine though.. Below the error but let me first give you the versions of the POM file

<parent>
        <groupId>net.wasdev.maven.parent</groupId>
        <artifactId>java7-parent</artifactId>
        <version>1.4</version>
    </parent>

    <groupId>net.wasdev.wlp.sample</groupId>
    <artifactId>MyFirstDutchChatbot</artifactId>
    <version>1.0</version>
    <packaging>war</packaging>

    <name>MyApp</name>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://raw.github.com/WASdev/sample.servlet/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-servlet_3.0_spec</artifactId>
                <version>1.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-servlet_3.0_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.ibm.watson.developer_cloud</groupId>
            <artifactId>java-sdk</artifactId>
            <version>3.7.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.4.4</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160212</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.ews-java-api</groupId>
            <artifactId>ews-java-api</artifactId>
            <version>2.0</version>
        </dependency>
    </dependencies>

Error 500: java.lang.RuntimeException: java.net.UnknownServiceException: Unable to find acceptable protocols. isFallback=false, modes=[ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_2, TLS_1_1, TLS_1_0], supportsTlsExtensions=true), ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_0], supportsTlsExtensions=true), ConnectionSpec()], supported protocols=[TLSv1, TLSv1.1, TLSv1.2]

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

No branches or pull requests

9 participants