警告:找不到提供程序com.sun.xml.internal.bind.v2.ContextFactory [英] WARNING: Provider com.sun.xml.internal.bind.v2.ContextFactory not found

查看:1060
本文介绍了警告:找不到提供程序com.sun.xml.internal.bind.v2.ContextFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过Jersey在JSF应用程序中集成了一些Web服务.一切正常,即使OAuth标识也可以正常工作.但!启动我的网络服务器时,我总是会收到此错误:

I have integrated within a JSF app a few webservices through Jersey. Everything works fine, even the OAuth identification is working. BUT! When starting my webserver, I ALWAYS get this error :

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)

(edit2:现在已解决)

和此警告:

...

WARNING: Provider com.sun.xml.internal.bind.v2.ContextFactory not found
javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory not found
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory not found by com.sun.jersey.glassfish.v3.osgi.jersey-gf-server [157]]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:148)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:361)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)
    at com.sun.jersey.server.impl.wadl.WadlApplicationContextImpl.<init>(WadlApplicationContextImpl.java:95)

这是我与web.xml相关的条目:

<servlet>
    <servlet-name>Jersey Web Application</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>my.site.webService</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Jersey Web Application</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

我的课看起来像这样:

@Path("/rest")
public class MyClass {

    @GET 
    @Path("/{id}/results")
    @Produces("application/json")
    public String getResults(@Context HttpContext hc, @PathParam("id")) {
        //...
    }
}

我正在Glassfish 2.1.2.2上的Majorra 2.1.20上使用PrimeFaces 3.4.1Jersey 1.17作为插件.如果这会影响任何事情,请在Eclipse Juno中开发.

I am using Majorra 2.1.20 on Glassfish 2.1.2.2 with PrimeFaces 3.4.1 and Jersey 1.17 as addons. Developping in Eclipse Juno if this affects anything.

这并不妨碍我就Web服务而言一切正常.但是每次我在Glassfish上重新发布内容时,都会显示错误.

This does not prevent me from having everything in working order with regards to webservices. But everytime I republish something on Glassfish, the error shows up.

如下面的答案中所述,此问题应已根据 JIRA错误在版本1.7中修复JERSEY-709 .但是我在1.17版中表现很好,而且我仍然对此感到满意.

As mentioned in an answer below, this should have been fixed in version 1.7 according to JIRA bug JERSEY-709. But I am very well on v. 1.17 and I'm still getting this.

我还添加了一个警告,警告我即将进入堆栈跟踪.如果这样可以帮助确定问题!

I have also added a Warning I am getting within the stack trace. If this can help determine the issue!

搜索网络:我发现如下所述,更新我的OAuthClient.jar确实解决了第一个error.我还在得到WARNING: Provider com.sun.xml.internal.bind.v2.ContextFactory not found.

As answered below, updating my OAuthClient.jar did solve the first error. I am STILL getting the WARNING: Provider com.sun.xml.internal.bind.v2.ContextFactory not found.

在我认为是

Tried updating JAXB after what I thought would be a lead on this question. This did not lead to anything successful. Same warning. When removing the Jersey bits in my web.xml this warning stops showing (just to confirm this is really initiating the issue).

推荐答案

升级到Jersey 1.18时,该错误已消失.

This error has gone away when upgrading to Jersey 1.18.

请参见 https://java.net/jira/browse/JERSEY-1932

要将Glassfish升级到Jersey 1.18,请参见: https://jersey.java. net/nonav/documentation/1.18/glassfish.html

To upgrade Glassfish to Jersey 1.18 see : https://jersey.java.net/nonav/documentation/1.18/glassfish.html

这篇关于警告:找不到提供程序com.sun.xml.internal.bind.v2.ContextFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆