JAX-RS Request interceptor missing dependencies

你说的曾经没有我的故事 提交于 2020-01-04 06:28:59

问题


Here's the intereceptor code, which is the only difference in whether I get these errors.

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() );
}

Here are the errors I'm getting

 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]

What's missing that wildfly is having problems loading?


回答1:


It seems to have something to do with @PreMatching, this doesn't really fix that, so may not be an answer to my exact question, but this does do (to an extent) what I was trying to accomplish.

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;
}


来源:https://stackoverflow.com/questions/21976323/jax-rs-request-interceptor-missing-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!