Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Spring Boot应用程序的Weblogic上未触发Apache CXF日志侦听器_Java_Web Services_Spring Boot_Weblogic_Cxf - Fatal编程技术网

Java 在Spring Boot应用程序的Weblogic上未触发Apache CXF日志侦听器

Java 在Spring Boot应用程序的Weblogic上未触发Apache CXF日志侦听器,java,web-services,spring-boot,weblogic,cxf,Java,Web Services,Spring Boot,Weblogic,Cxf,我正在使用ApacheCXF在Spring引导应用程序上实现自底向上的Soap WS。在部署到Weblogic(12.2.1.3.0)上之前,一切正常。问题是我尝试使用的日志拦截器根本没有被超越 第一个问题实际上是WebService实现类上@Autowired注入上的空指针。为了解决这个问题,我使用了我在StackO上建立的一些变通方法。似乎weblogic启动了独立的上下文加载程序,一个用于spring和所有bean,另一个用于CXF。因此,当通过wsdl url调用webservice i

我正在使用ApacheCXF在Spring引导应用程序上实现自底向上的Soap WS。在部署到Weblogic(12.2.1.3.0)上之前,一切正常。问题是我尝试使用的日志拦截器根本没有被超越

第一个问题实际上是WebService实现类上@Autowired注入上的空指针。为了解决这个问题,我使用了我在StackO上建立的一些变通方法。似乎weblogic启动了独立的上下文加载程序,一个用于spring和所有bean,另一个用于CXF。因此,当通过wsdl url调用webservice impl类时,注入没有完成。解决此问题后,WS可以正常工作,但不会触发通过spring引导配置添加的日志拦截器。应用程序的一个重要特性是能够在数据库上存储soap请求响应。因此,拦截器链的工作非常重要

Spring启动配置类:

@Configuration
public class LmsReloadCXFWSConfig implements ServletContextInitializer{

    private static WebApplicationContext webApplicationContext;

    public static WebApplicationContext getCurrentWebApplicationContext() {
        return webApplicationContext;
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Bean
    public ServletRegistrationBean servletRegistration() {
        return new ServletRegistrationBean(new CXFServlet(), "/*");
    }

    @Bean
    public LoggingInInterceptor logInInterceptor() {
        return new LmsReloadWSInboundInterceptor();
    }
    @Bean
    public LoggingOutInterceptor  logOutInterceptor() {
        return new LmsReloadWSOutboundInterceptor();
    }

    @Bean(name=Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {   
        SpringBus springBus = new SpringBus();  
        return springBus;
    }

    @Bean
    public LmsReloadWebService lmsReloadWebService() {
        LmsReloadWebService lmsReloadWebService =  new LmsReloadWebServiceImpl();     
        return lmsReloadWebService;
    }

    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), lmsReloadWebService());   
        endpoint.getInInterceptors().add(logInInterceptor());
        endpoint.getOutInterceptors().add(logOutInterceptor());
        endpoint.publish("/Soap");
        return endpoint;
    }
}
两者都是扩展LogginInterceptor和LoggingOutInterceptor的自定义拦截器:

public class LmsReloadWSInboundInterceptor extends LoggingInInterceptor{
...
}

public class LmsReloadWSOutboundInterceptor extends LoggingOutInterceptor{    
...
}
Web服务接口和实现:

@WebService(name = "LmsServiceInterface", targetNamespace=LmsReloadUtil.LMSRELOAD_NAMESPACE_ORI)
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public interface LmsReloadWebService {
...
}

@WebService(portName = "LmsServicePort", serviceName = "Soap", targetNamespace = LmsReloadUtil.LMSRELOAD_NAMESPACE_ORI, endpointInterface = "com.dell.lms.reload.ws.LmsReloadWebService")
public class LmsReloadWebServiceImpl implements LmsReloadWebService {

    @Autowired
    private LmsReloadService lmsReloadService;

    @Autowired
    private LmsReloadLoggingService lmsReloadLoggingService;

    public LmsReloadWebServiceImpl() {
        AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
        WebApplicationContext currentContext = LmsReloadCXFWSConfig.getCurrentWebApplicationContext();
        bpp.setBeanFactory(currentContext.getAutowireCapableBeanFactory());
        bpp.processInjection(this);
    }   
    ...
}
我的pom.xml上的CXF版本是3.2.7

我需要做的是让这些拦截器工作,这样我就可以将请求和响应保存在数据库中。同样,当使用Eclipse中启动的spring boot tomcat执行应用程序时,该应用程序运行良好且完成。由于WebService Impl类上的自动连线问题,我认为这与weblogic对应用程序的部署方式有关。不同的上下文加载器


在上周调查这个问题时,发现了很多可能的解决方案,尝试了所有方法,但没有成功。

我看到Weblogic提供了两个WSDL url,一个由JAX_WS生成,一个由Spring生成(我相信),第一个是拦截器不起作用的。JAX-WS>我看到Weblogic提供了两个WSDL url,一个是由JAX_WS生成的,一个是由Spring生成的(我相信),第一个是拦截器无法工作的