无法找到拦截器 ContentTypeSetterPreProcessorInterceptor 的 public 构造函数

Unable to find a public constructor for interceptor ContentTypeSetterPreProcessorInterceptor

我正在使用 REST ESay API,当我在我的 REST 服务代码中添加该方法时,启动码头服务器时出现以下错误。目的是用自定义字符集覆盖内容类型。请帮我解决这个issue.The方法是:

@Provider
@ServerInterceptor
public class ContentTypeSetterPreProcessorInterceptor implements
PreProcessInterceptor {
public ServerResponse preProcess(HttpRequest request,
ResourceMethod method) throws Failure, WebApplicationException
    { 
       request.setAttribute(InputPart.DEFAULT_CONTENT_TYPE_PROPERTY,
       "*/*; charset=UTF-8"); return null;
    }
}

这是堆栈跟踪:

03:11:08.232(02/06) INFO  org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap : Adding scanned @Provider: com.lexisnexis.csa.fwu.rest.service.FWUploadService$ContentTypeSetterPreProcessorInterceptor
    03:11:08.233(02/06) INFO  org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap : Adding scanned resource: com.lexisnexis.csa.fwu.rest.service.FWUploadService
    2015-02-06 03:11:08.796:WARN::Failed startup of context o.e.j.w.WebAppContext{/,file:/C:/Users/SHANMUK3/workspace/LN_CSA_FWU_SRVC_COMP/target/LN_CSA_FWU_SRVC_COMP/},C:\Users\SHANMUK3\workspace\LN_CSA_FWU_SRVC_COMP\target\LN_CSA_FWU_SRVC_COMP.war
    java.lang.RuntimeException: Unable to find a public constructor for interceptor class com.lexisnexis.csa.fwu.rest.service.FWUploadService$ContentTypeSetterPreProcessorInterceptor
        at org.jboss.resteasy.core.interception.InterceptorRegistry$PerMethodInterceptorFactory.<init>(InterceptorRegistry.java:109)
        at org.jboss.resteasy.core.interception.InterceptorRegistry.register(InterceptorRegistry.java:234)
        at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:792)
        at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:743)
        at org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:505)
        at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:305)
        at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:225)
        at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:28)
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:640)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:229)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1208)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:586)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:449)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:164)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89)
        at org.eclipse.jetty.server.Server.doStart(Server.java:258)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
        at com.lxnx.ols.rsf.http.server.HttpServer.start(HttpServer.java:205)
        at com.lxnx.ols.rsf.http.server.AbstractRestServer.start(AbstractRestServer.java:250)
        at com.lxnx.ols.rsf.http.server.AbstractRestServer.run(AbstractRestServer.java:193)
        at com.lexisnexis.fwu.service.DrsFWUServer.main(DrsFWUServer.java:28)
    2015-02-06 03:11:08.875:INFO::Started SelectChannelConnector@0.0.0.0:8088 STARTING
    03:11:08.891(02/06) INFO  RSF : [main] ******* DrsFWU running on RETDAYV-7610098:8088 *******

我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>LN_CSA_FWU_SRVC_COMP</display-name>
 <servlet>
        <servlet-name>resteasy-servlet</servlet-name>
        <servlet-class>
            org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>resteasy-servlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>resteasy.scan</param-name>
        <param-value>true</param-value>
    </context-param>

    <listener>
      <listener-class>
         org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
      </listener-class>
   </listener>
</web-app>

pom.xml:

    <dependencies>
            <dependency>
                <groupId>commons-httpclient</groupId>
                <artifactId>commons-httpclient</artifactId>
                <version>3.1</version>
            </dependency>
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>1.2.1</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId> 
                <artifactId>commons-io</artifactId>
                <version>2.3</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.1.1</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-jaxrs</artifactId>
                <version>2.3.1.GA</version>
            </dependency>
            <dependency>
                <groupId>net.sf.scannotation</groupId>
                <artifactId>scannotation</artifactId>
                <version>1.0.2</version>
            </dependency>
            <!-- JAXB provider -->
            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-jaxb-provider</artifactId>
                <version>2.3.1.GA</version>
            </dependency>
            <!-- Multipart support -->
            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-multipart-provider</artifactId>
                <version>2.3.1.GA</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpmime</artifactId>
                <version>4.2.5</version>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpcore</artifactId>
                <version>4.2.4</version>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>fluent-hc</artifactId>
                <version>4.2.5</version>
            </dependency>

这个:

com.lexisnexis.csa.fwu.rest.service.FWUploadService$ContentTypeSetterPreProcessorInterceptor 

表示ContentTypeSetterPreProcessorInterceptor是一个内在的class。将内部 class 定义为 static 或使其成为顶级 class.

非静态内部 class 没有空构造函数。