Apache CXF Web Services: невозможно создать безопасную XMLInputFactory (добавьте woodstox или allowinsecure в true) - PullRequest
0 голосов
/ 22 апреля 2020

Ниже приведены maven зависимости:

<dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-security</artifactId>
        <version>3.3.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>3.1.11</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>3.1.11</version>
    </dependency>

после вышеуказанной ошибки я поставил следующее:

   <!-- https://mvnrepository.com/artifact/org.codehaus.woodstox/woodstox-core-asl -->
    <dependency>
        <groupId>org.codehaus.woodstox</groupId>
        <artifactId>woodstox-core-asl</artifactId>
        <version>4.0.8</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.codehaus.woodstox/stax2-api -->
    <dependency>
        <groupId>org.codehaus.woodstox</groupId>
        <artifactId>stax2-api</artifactId>
        <version>3.0.0</version>
    </dependency>

Я также добавил следующее свойство:

enter image description here

Тем не менее я получаю следующую ошибку:

Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
    at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:162)
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
    at javax.xml.ws.Service.<init>(Unknown Source)
    at humanresources.HumanResourcesService.<init>(HumanResourcesService.java:50)
    at com.evry.integrator.HumanResourcesUtil.getHumanResourcePort(HumanResourcesUtil.java:81)
    at com.evry.integrator.initializer.MyMain.main(MyMain.java:93)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:87)
    at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:217)
    at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:160)
    ... 6 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory, you should either add woodstox or set org.apache.cxf.stax.allowInsecureParser system property to true if an unsafe mode is acceptable.
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:244)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:165)
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:85)
    ... 8 more
Caused by: java.lang.RuntimeException: Cannot create a secure XMLInputFactory, you should either add woodstox or set org.apache.cxf.stax.allowInsecureParser system property to true if an unsafe mode is acceptable.
    at org.apache.cxf.staxutils.StaxUtils.createXMLInputFactory(StaxUtils.java:333)
    at org.apache.cxf.staxutils.StaxUtils.getXMLInputFactory(StaxUtils.java:273)
    at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1786)
    at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1689)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:231)
    ... 10 more

есть идеи, где я делаю это неправильно?

...