本文介绍了JAX-RS请求拦截器缺少依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是拦截器代码,这是我是否收到这些错误的唯一区别.
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() );
}
这是我遇到的错误
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]
Wildfly加载时缺少什么?
What's missing that wildfly is having problems loading?
推荐答案
似乎与@PreMatching
有关,但这并不能真正解决问题,因此可能无法回答我的确切问题,但这确实(在一定程度上)完成了我要完成的工作.
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;
}
这篇关于JAX-RS请求拦截器缺少依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!