两个基于Resteasy的WAR,一个不扫描提供商?

时间:2013-02-12 20:04:33

标签: eclipse maven tomcat jackson resteasy

我在Eclipse中有2个m2e管理的项目,目标是Tomcat 7.每个项目都有相同的配置,除了POM中的artifactId和web.xml中的display-name(其中一个配置的大部分来自于其他)。

在第一个问题上,当我“在服务器上运行”时,所有Resteasy类都会被注册,并且@Providers会被扫描并进行重新设置。

另一方面,Web服务器已注册,但没有证据表明扫描正在进行。有没有人遇到过这样的情况?我很想知道这两个项目有什么不同。

工作日志:

INFO: Reloading Context with name [/itworks] has started
Feb 12, 2013 12:48:57 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned @Provider: xxx.BadRequestHandler
Feb 12, 2013 12:48:57 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned @Provider: org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper
Feb 12, 2013 12:48:57 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned @Provider: org.codehaus.jackson.jaxrs.JsonParseExceptionMapper
Feb 12, 2013 12:48:57 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned @Provider: org.codehaus.jackson.jaxrs.JacksonJsonProvider
Feb 12, 2013 12:48:57 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned @Provider: org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider
Feb 12, 2013 12:48:57 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: xxx.Hashmask
Feb 12, 2013 12:48:57 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: xxx.HelloWorld
Feb 12, 2013 12:48:57 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/itworks] is completed

非工作日志:

INFO: Reloading Context with name [/noworkie] has started
Feb 12, 2013 12:56:30 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: yyy.HelloWorld
Feb 12, 2013 12:56:30 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: yyy.MongoTest
Feb 12, 2013 12:56:30 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/noworkie] is completed

1 个答案:

答案 0 :(得分:1)

尝试将此参数添加到项目的web.xml中:

<context-param>
    <param-name>resteasy.use.deployment.sensitive.factory</param-name>
    <param-value>false</param-value>
</context-param>

它帮助我解决了Jboss上的类似问题。我在resteasy jira issue.找到了这个解决方案 在resteasy中看起来已知问题......