yangboz / linkedin-j

Automatically exported from code.google.com/p/linkedin-j
0 stars 0 forks source link

LinkedInOAuthServiceException #83

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I try to get request token.
My source code is:

 LinkedInApiConsumer consumer = new LinkedInApiConsumer(Constants.API_KEY,
                Constants.API_SECRET);

  oauthService  = LinkedInOAuthServiceFactory.getInstance  ().createLinkedInOAuthService(consumer);

    try{

            requestToken = oauthService.getOAuthRequestToken(Constants.OAUTH_CALLBACK_URL);

        } catch(LinkedInOAuthServiceException e) {

            e.printStackTrace();

        } 

But I've got LinkedInOAuthServiceException.

This is what i've got in logcat :

W/System.err(15342): 
com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException: 
oauth.signpost.exception.OAuthCommunicationException: Communication with the 
service provider failed: https://api.linkedin.com/uas/oauth/requestToken

W/System.err(15342):    at 
com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthReques
tToken(LinkedInOAuthServiceImpl.java:159)

W/System.err(15342):    at 
com.linkedin.LinkedInActivity.onCreate(LinkedInActivity.java:52)

W/System.err(15342):    at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

W/System.err(15342):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)

W/System.err(15342):    at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)

W/System.err(15342):    at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)

W/System.err(15342):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)

W/System.err(15342):    at android.os.Handler.dispatchMessage(Handler.java:99)

W/System.err(15342):    at android.os.Looper.loop(Looper.java:123)

W/System.err(15342):    at 
android.app.ActivityThread.main(ActivityThread.java:3687)

W/System.err(15342):    at java.lang.reflect.Method.invokeNative(Native Method)

W/System.err(15342):    at java.lang.reflect.Method.invoke(Method.java:507)

W/System.err(15342):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)

W/System.err(15342):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)

W/System.err(15342):    at dalvik.system.NativeStart.main(Native Method)

W/System.err(15342): Caused by: 
oauth.signpost.exception.OAuthCommunicationException: Communication with the 
service provider failed: https://api.linkedin.com/uas/oauth/requestToken

W/System.err(15342):    at 
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:21
4)

W/System.err(15342):    at 
oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.
java:69)

W/System.err(15342):    at 
com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthReques
tToken(LinkedInOAuthServiceImpl.java:148)

W/System.err(15342):    ... 14 more

W/System.err(15342): Caused by: java.io.FileNotFoundException: 
https://api.linkedin.com/uas/oauth/requestToken

W/System.err(15342):    at 
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.get
InputStream(HttpURLConnectionImpl.java:521)

W/System.err(15342):    at 
org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl.g
etInputStream(HttpsURLConnectionImpl.java:258)

W/System.err(15342):    at 
oauth.signpost.basic.HttpURLConnectionResponseAdapter.getContent(HttpURLConnecti
onResponseAdapter.java:18)

W/System.err(15342):    at 
oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvi
der.java:228)

W/System.err(15342):    at 
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:18
9)

W/System.err(15342):    ... 16 more

D/dalvikvm(15342): threadid=1: still suspended after undo (sc=1 dc=1)

D/dalvikvm(15342): GC_CONCURRENT freed 1279K, 58% free 2830K/6727K, external 
1990K/2108K, paused 2ms+2ms

D/dalvikvm(15123): GC_EXPLICIT freed 20K, 54% free 2663K/5703K, external 
1596K/2108K, paused 69ms

D/dalvikvm(15342): Debugger has detached; object registry had 790 entries

I/dalvikvm(15342): ignoring registerObject request in thread=1

I/dalvikvm(15342): ignoring registerObject request in thread=1

D/AndroidRuntime(15342): Shutting down VM

W/dalvikvm(15342): threadid=1: thread exiting with uncaught exception 
(group=0x40015578)

E/AndroidRuntime(15342): FATAL EXCEPTION: main

E/AndroidRuntime(15342): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.linkedin/com.linkedin.LinkedInActivity}: 
java.lang.NullPointerException

E/AndroidRuntime(15342):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)

E/AndroidRuntime(15342):    at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)

E/AndroidRuntime(15342):    at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)

E/AndroidRuntime(15342):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)

E/AndroidRuntime(15342):    at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(15342):    at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(15342):    at 
android.app.ActivityThread.main(ActivityThread.java:3687)

E/AndroidRuntime(15342):    at java.lang.reflect.Method.invokeNative(Native 
Method)

E/AndroidRuntime(15342):    at java.lang.reflect.Method.invoke(Method.java:507)

E/AndroidRuntime(15342):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)

E/AndroidRuntime(15342):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)

E/AndroidRuntime(15342):    at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(15342): Caused by: java.lang.NullPointerException

E/AndroidRuntime(15342):    at 
com.linkedin.LinkedInActivity.onCreate(LinkedInActivity.java:60)

E/AndroidRuntime(15342):    at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(15342):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)

E/AndroidRuntime(15342):    ... 11 more

W/ActivityManager(  129):   Force finishing activity 
com.linkedin/.LinkedInActivity

Original issue reported on code.google.com by misha.4i...@gmail.com on 18 Nov 2011 at 4:04

GoogleCodeExporter commented 9 years ago
I had the same issue because i had my time 8 minutes ahead, but when i changed 
back to the normal time it worked as i read in:
http://stackoverflow.com/questions/8562584/android-linkedin-integration-error-on
-device-and-emulator

Ashok's answer

Original comment by ibai.usu...@gmail.com on 19 Jun 2012 at 1:19

GoogleCodeExporter commented 9 years ago
even i'm facing the same problem but my time is correct, how to correct this 
error?

Original comment by divyamon...@gmail.com on 6 Feb 2013 at 11:30

GoogleCodeExporter commented 9 years ago
please check timezone and time should be proper and for Authentication issue 
this may solve http://stackoverflow.com/a/13510881/727432 for accessing 
permissions for new updated linkedin api

Original comment by ashok200...@gmail.com on 6 Feb 2013 at 11:42

GoogleCodeExporter commented 9 years ago
I was facing the same issue because i accessed n/w on main thread just use aync 
task or
StrictMode.ThreadPolicy policy = new 
StrictMode.ThreadPolicy.Builder().permitAll().build();

StrictMode.setThreadPolicy(policy);

Original comment by opt...@gmail.com on 15 Feb 2014 at 12:06

GoogleCodeExporter commented 9 years ago
I added strict mode but still persist this problem. I was working before and 
one day its stopped working
?

Original comment by owaisfor...@gmail.com on 9 Jul 2015 at 8:40