在java中集成LinkedIn时出错

在java中集成LinkedIn时出错,java,annotations,linkedin,linkedin-j,Java,Annotations,Linkedin,Linkedin J,我正试图将LinkedIn集成到我的java web应用程序中,但当我试图从LinkedIn获取Person对象时,出现了以下异常。 身份验证/登录/获取accesstoken的过程运行良好且成功。 但在访问linkedin对象时,我面临一些问题 以下是代码片段: LinkedInRequestToken requestToken = (LinkedInRequestToken) req.getSession().getAttribute("requestToken"); LinkedInOAu

我正试图将LinkedIn集成到我的java web应用程序中,但当我试图从LinkedIn获取Person对象时,出现了以下异常。 身份验证/登录/获取accesstoken的过程运行良好且成功。 但在访问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>

com.googlecode.linkedin-j
linkedin-j-core
1.0.416

版本1.0.416缺少jax.properties文件

见:

我遵循的步骤是: 1.签出src并检索core/src/main/java/com/google/code/linkedinapi/schema/jaxb.properties 2.mkdir-p mkdir-p src/main/resources/com/google/code/linkedinapi/schema/
cp jaxb.properties src/main/resources/com/google/code/linkedinapi/schema
3.如果您将它放在当前路径中,它可能会起作用,但是这个修复对我来说很有效。

除了maven,您还需要添加linkedin-j jar来构建路径。这里是下载jar@milind\u db的链接