2012-05-16 12 views
1

我使用RestEasy的客戶端框架,並與下面的代碼WARNRestEasy的:WARN的NoClassDefFoundError DocumentProvider

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> 

回答

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.html,不再需要調用該方法RegisterBuiltin.register(ResteasyProviderFactory.getInstance());

+2

嗨,歡迎來到SO!在提供答案時,爲答案提供支持鏈接是個好主意。 – Brian

+0

感謝您的回答,歡迎來到SO!這指向我http://docs.jboss.org/resteasy/2.0.0.GA/userguide/html/Migration_from_older_versions.html,其中提到'RegisterBuiltin.register(ResteasyProviderFactory.getInstance())'的調用是不再需要! – Thor