JAX-RS请求拦截器缺少依赖项

时间:2014-02-23 23:43:14

标签: java jax-rs resteasy wildfly

这是拦截器代码,这是我是否得到这些错误的唯一区别。

package com.lm.infrastructure;

import java.io.IOException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.PreMatching;
import javax.ws.rs.ext.Provider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


@Provider
@PreMatching
class RequestLogger implements ContainerRequestFilter {

@Override
public void filter( ContainerRequestContext crc ) throws IOException {
    log.warn( "crc = {}", crc );
}
public final Logger log = LoggerFactory.getLogger( this.getClass() );
}

以下是我遇到的错误

 JBAS014775:    New missing/unsatisfied dependencies:
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".WeldBootstrapService (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".WeldInstantiator, service jboss.undertow.deployment.default-server.default-host./NornLM, JBAS014799: ... and 6 more ] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".WeldStartService (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator, JBAS014799: ... and 4 more ] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."com.sun.faces.config.ConfigureListener".CREATE (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."com.sun.faces.config.ConfigureListener".START] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."com.sun.faces.config.ConfigureListener".START] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".CREATE (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".START] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".START] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".CREATE (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService] 
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".CREATE (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".START]
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService]
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".START]
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldTerminalListener".CREATE (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldTerminalListener".START]
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldTerminalListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService]
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldTerminalListener".START]
  service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService]
  service jboss.undertow.deployment.default-server.default-host./NornLM (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".deploymentCompleteService]
  service jboss.undertow.deployment.default-server.default-host./NornLM.UndertowDeploymentInfoService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./NornLM]

野生蝇在装载时遇到什么问题?

1 个答案:

答案 0 :(得分:0)

它似乎与@PreMatching有关,这并没有真正解决这个问题,所以可能不是我确切问题的答案,但这确实(在某种程度上)确实做了我想要的完成。

package com.lm.infrastructure;

import java.io.IOException;
import javax.inject.Inject;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;

@Provider
public class RequestResponseFilter implements ContainerRequestFilter, ContainerResponseFilter {

    @Override
    public void filter( ContainerRequestContext requestContext ) throws IOException {
        log.warn( "> {} {} {}",
                requestContext.getRequest().getMethod(),
                requestContext.getUriInfo().getAbsolutePath(),
                IOUtils.readLines( requestContext.getEntityStream() )
        );
        System.out.println( "Cookies: " + requestContext.getCookies() );
    }

    @Override
    public void filter( ContainerRequestContext requestContext, ContainerResponseContext responseContext ) throws IOException {
        log.warn( "Entity: {}", responseContext.getEntity() );
    }

    @Inject
    Logger log;
}