Spring引导cxf架构位置属性

时间:2018-02-19 12:19:02

标签: java spring-boot cxf

我正在使用带弹簧启动的cxf,我的EndpointImpl如下:

@Bean
    public Endpoint serviceEndpoint() throws IOException {
        EndpointImpl endpoint = new EndpointImpl(springBus(), nameWSImpl());

        Map<String, Object> properties = new HashMap<>();
        properties.put("schema-validation-enabled", false);
        properties.put("mtom-enabled", true);
        endpoint.setProperties(properties);

        endpoint.setDataBinding(new XmlBeansDataBinding());
        JaxWsServiceFactoryBean jrxw = new JaxWsServiceFactoryBean();
        jrxw.setWrapped(false);
        endpoint.setServiceFactory(jrxw);

        List<String> schemaLocations = new ArrayList<String>();
        schemaLocations.add("classpath:/xsd/schema-types.xsd");

        endpoint.setSchemaLocations(schemaLocations);

        endpoint.publish("/NamesWSService");
        return endpoint;
    }

当我运行MyApp.jar时,我遇到了以下错误,我的xsd似乎正确,我在其中导入了另一个xsd:

<xs:import namespace="http://..../1.0" schemaLocation="schema-mn.xsd"/>
  

引起:javax.xml.ws.WebServiceException:   org.apache.cxf.service.factory.ServiceConstructionException:有   读取架构类路径时出错:/xsd/schema-types.xsd。在   org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)at at   org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)at at   pakge.configuration.WebServiceConfig.serviceEndpoint(WebServiceConfig.java:82)     在   pakge.configuration.WebServiceConfig $$ EnhancerBySpringCGLIB $$ 94ee36aa.CGLIB $ serviceEndpoint $ 0()     在   pakge.configuration.WebServiceConfig $$ EnhancerBySpringCGLIB $$ 94ee36aa $$ FastClassBySpringCGLIB $$ 8f1a2871.invoke()     在   org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)     在   org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)     在   pakge.configuration.WebServiceConfig $$ EnhancerBySpringCGLIB $$ 94ee36aa.serviceEndpoint()     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)at   org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)     ...省略了27个常见帧

我该如何处理这个错误?

0 个答案:

没有答案