1

我正在使用 RestEasy 客户端框架并具有WARN以下代码:

RegisterBuiltin.register(ResteasyProviderFactory.getInstance());

// [WARN] org.jboss.resteasy.logging.impl.Log4jLogger-103: NoClassDefFoundError:
//   Unable to load builtin provider:     
//   org.jboss.resteasy.plugins.providers.DocumentProvider

根据GrepCode ,这个类应该在resteasy-jaxrs模块中。这只是一个警告,但我在 Google 上只找到了一些提示,不知道我是否应该忽略它或找到解决方案,因为它只是一个警告而不是 CNFE。以下代码可以正常工作。

<dependencyManagement>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-bom</artifactId>
        <version>2.3.1.GA</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency> 
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
    </dependency>
</dependencies>
4

1 回答 1

2

要避免此警告,请尝试以下操作:

public class SomeClass
{       
  static {ResteasyProviderFactory.setRegisterBuiltinByDefault(false);}

  public static void main(String[] args) {}
}

更新根据http://docs.jboss.org/resteasy/2.0.0.GA/userguide/html/Migration_from_older_versions.htmlRegisterBuiltin.register(ResteasyProviderFactory.getInstance());不再需要方法调用!

于 2013-04-23T22:41:30.127 回答