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

Getting Stack over flow error #425

Closed
emilpradeep opened this issue Jan 13, 2017 · 20 comments
Closed

Getting Stack over flow error #425

emilpradeep opened this issue Jan 13, 2017 · 20 comments
Assignees

Comments

@emilpradeep
Copy link

emilpradeep commented Jan 13, 2017

E/AndroidRuntime: FATAL EXCEPTION: Thread-1415
Process: com.example, PID: 5182
java.lang.StackOverflowError
at com.android.org.conscrypt.OpenSSLCipher.getOutputSize(OpenSSLCipher.java:201)
at com.android.org.conscrypt.OpenSSLCipher.engineGetOutputSize(OpenSSLCipher.java:213)
at javax.crypto.Cipher.getOutputSize(Cipher.java:402)
at com.android.org.conscrypt.ConnectionState.getMinFragmentSize(ConnectionState.java:69)
at com.android.org.conscrypt.SSLRecordProtocol.getMinRecordSize(SSLRecordProtocol.java:134)
at com.android.org.conscrypt.SSLEngineImpl.unwrap(SSLEngineImpl.java:434)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:383)
at org.java_websocket.SSLSocketChannel2.unwrap(SSLSocketChannel2.java:150)
at org.java_websocket.SSLSocketChannel2.readRemaining(SSLSocketChannel2.java:254)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:220)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_websocket.SSLSocketChannel2.read(SSLSocketChannel2.java:241)
at org.java_web

@marci4
Copy link
Collaborator

marci4 commented Mar 15, 2017

hey @emilpradeep,

could you tell me which version you use?
So I can try to reproduce it

Greetings
marci4

@marci4 marci4 self-assigned this Mar 15, 2017
@simonchius
Copy link

I am getting this issue too, I am using this version (org.java-websocket:Java-WebSocket:1.3.0).
Can anyone help?

@marci4
Copy link
Collaborator

marci4 commented Mar 24, 2017

Hello @simonchius,
is it possible for you to send me your code please?

Right now I cannot reproduce it :(

Also try to build the jar directly from the sources. I merged some fixes there.

Greetings
marci4

@emilpradeep
Copy link
Author

@marci4 @simonchius please refer to #190 . I fixed the issue with @Erhannis solution

@marci4
Copy link
Collaborator

marci4 commented Mar 24, 2017

@emilpradeep do I understand you correct that this issue is fixed right now using the lastest sources?

Greetings
marci4

@emilpradeep
Copy link
Author

yes, the issue is fixed for me.

@marci4
Copy link
Collaborator

marci4 commented Mar 24, 2017

Yes :)
Thx for the feedback =)

Greetings
marci4

@simonchius
Copy link

So as my understanding, If i update to latest version, this issue will be fixed. Am i right?

@marci4
Copy link
Collaborator

marci4 commented Mar 24, 2017

Right now there is no update available in the maven repository (I don't have access to it).

So you need to build the jar directly from the sources (see README)

Greetings

@marci4
Copy link
Collaborator

marci4 commented Apr 3, 2017

@simonchius I updated the readme with the new maven repository etc

Please check it out :)

Greetings
marci4

@simonchius
Copy link

@marci4 Thanks for the update, I will check out.

@simonchius
Copy link

screen shot 2017-04-04 at 9 14 07 am

@marci4 It seems org.java-websocket:java-websocket:1.3.2 is not resolved. Can you please check that?

@marci4
Copy link
Collaborator

marci4 commented Apr 4, 2017

Hello @simonchius,

a different user mentioned here that you maybe need to clear the cache of your IDE and restart it
Check here

Hope this fixes it for you.
Greetings
marci4

@simonchius
Copy link

Hi @marci4

I tried clear cache and restarting Android Studio. Nothing is working. Still not working.

@marci4
Copy link
Collaborator

marci4 commented Apr 4, 2017

hello @simonchius,

could you maybe add the following line to the start of your build
apply plugin:'java'

If this is not working, could you please send me your full build script.

Greetings
marci4

@simonchius
Copy link

Hi @marci4

apply plugin:'java' is not compatible with Android.

You can check my build script

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.0'

defaultConfig {
    applicationId "com.xxxx.xxxxxxxxxxxxxx"

    minSdkVersion 19
    targetSdkVersion 23
    versionCode 35
    versionName "1.1.0"
    multiDexEnabled true;

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
}

}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/fullauth-api-java-client-1.1.1.jar')
compile project(':FeedsLibrary')
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'org.java-websocket:java-websocket:1.3.2'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.android.gms:play-services-location:9.0.2'
compile 'com.google.firebase:firebase-crash:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
}

apply plugin: 'com.google.gms.google-services'

@marci4
Copy link
Collaborator

marci4 commented Apr 5, 2017

Hello @emilpradeep

please add the following lines to your build script

repositories { maven { url "http://clojars.org/repo" } }

Greetings
marci4

@simonchius
Copy link

Hi @marci4,

Issue with building gradle is fixed,

But setWebSocketFactory and DefaultSSLWebSocketClientFactory not found

mWebSocketClient.setWebSocketFactory( new DefaultSSLWebSocketClientFactory( sslContext ) );

Since I am using wss, It was throwing SSL exception, So I added SSL Context manually like below

SSLContext sslContext = null;
try {
sslContext = SSLContext.getInstance( "TLS" );
sslContext.init( null, null, null ); // will use java's default key and trust store which is sufficient unless you deal with self-signed certificates
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
}

    mWebSocketClient.setWebSocketFactory( new DefaultSSLWebSocketClientFactory( sslContext ) );

Now setWebSocketFactory and DefaultSSLWebSocketClientFactory not found..

Pls check this.

@marci4
Copy link
Collaborator

marci4 commented Apr 6, 2017

Hello,
The code changed a bit with the internal commits.

Check this example when you wanna use a ssl context.
https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/SSLClientExample.java

Greetings
Marci4

@marci4
Copy link
Collaborator

marci4 commented May 8, 2017

Issue is clearly solved.

Closing issue.
Greetings
marci4

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

No branches or pull requests

3 participants