2

LinkedIn を Java Web アプリケーションに統合しようとしていますが、リンクインからPersonオブジェクトをフェッチしようとすると、次の例外が発生します。認証/ログイン/アクセストークンの取得のプロセスは正常に機能しています。しかし、リンクされたオブジェクトにアクセスしているときに、いくつかの問題に直面しています。

以下はコード スニペットです。

LinkedInRequestToken requestToken = (LinkedInRequestToken) req.getSession().getAttribute("requestToken");
LinkedInOAuthService oauthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(appkey, secretKey);
LinkedInAccessToken accessToken = oauthService.getOAuthAccessToken(requestToken, oauth_verifier);

LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(appId, secretKey);
LinkedInApiClient client = factory.createLinkedInApiClient(accessToken.getToken(), accessToken.getTokenSecret());

コードが正常に機能するまで、しかし私が言うとき、

Person person = client.getProfileForCurrentUser();

この例外が発生しています:

com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Package "com.google.code.linkedinapi.schema" is missing jaxb.properties file.
Have you copied this from the generated source directory or include it in the classpath?
this problem is related to the following location:
at com.google.code.linkedinapi.schema.ObjectFactory

LinkedIn API に次の依存関係を使用しています

<dependency>
    <groupId>com.googlecode.linkedin-j</groupId>
    <artifactId>linkedin-j-core</artifactId>
    <version>1.0.416</version>
</dependency>
4

2 に答える 2

0

maven に加えて、linkedin-j jar をビルド パスに追加する必要もあります。jar をダウンロードするためのリンクは次のとおりですhttp://www.java2s.com/Code/Jar/l/Downloadlinkedinjjar.htm @milind_db

于 2016-06-28T06:17:18.303 に答える