警告:未找到提供程序 com.sun.xml.internal.bind.v2.ContextFactory

2024-02-27

我在 JSF 应用程序中集成了一些 Web 服务Jersey。一切正常,甚至 OAuth 识别也正常。但!当启动我的网络服务器时,我总是收到此错误:

INFO: Scanning for root resource and provider classes in the packages:
  com.mysite.webService
INFO: Root resource classes found:
  class com.mysite.webService.Accounts
INFO: No provider classes found.

INFO: Initiating Jersey application, version 'Jersey: 1.17 01/17/2013 03:31 PM'
SEVERE: The provider class, class com.sun.jersey.oauth.server.OAuthProviderInjectionProvider, could not be instantiated. Processing will continue but the class will not be utilized
java.lang.RuntimeException: No OAuthProvider implementation found in the list of providers.
    at com.sun.jersey.oauth.server.OAuthProviderInjectionProvider.<init>(OAuthProviderInjectionProvider.java:71)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

在另一个上下文中:使用 Maven 的独立 Java 应用程序

在 pom.xml 中,jaxb 是使用以下行定义的:

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.1</version>
</dependency>

项目编译成功,但是运行时,收到同样的异常 (java.lang.ClassNotFoundException:com.sun.xml.bind.v2.ContextFactory)

在 jaxb-api 依赖项之前添加此行解决了问题

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.1.2</version>
</dependency>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

警告:未找到提供程序 com.sun.xml.internal.bind.v2.ContextFactory 的相关文章

随机推荐