我正在尝试将 LinkedIn 集成到我的 Java Web 应用程序中,但是当我尝试从linkedin中获取Person对象时出现以下异常。授权/登录/获取访问令牌的过程运行良好且成功。但是在访问linkedin对象时,我遇到了一些问题。
以下是代码片段:
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>