当前位置:网站首页>WebService client request failed can not create a secure xmlinputfactory

WebService client request failed can not create a secure xmlinputfactory

2022-06-23 23:15:00 lang20150928

webService Client request failed :can not create a secure xmlinputfactory

Corresponding cxf Version is

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <cxf.version>3.2.14</cxf.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-parent</artifactId>
                <version>${cxf.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf</artifactId>
                <version>${cxf.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

 Insert picture description here
Find the corresponding location of the source code (org.apache.cxf.staxutils.StaxUtils Class 338 That's ok )
 Insert picture description here
From the above source code is not difficult to see , If allowInsecureParser Parameter is true Words , You won't get into the logic of throwing exceptions . and allowInsecureParser Parameters are set during class initialization . The approximate source code is as follows

public static final String ALLOW_INSECURE_PARSER =
    "org.apache.cxf.stax.allowInsecureParser";
    
private static boolean allowInsecureParser;

static{
    
	// ...
	String s = SystemPropertyAction.getPropertyOrNull(ALLOW_INSECURE_PARSER);
	if (!StringUtils.isEmpty(s)) {
    
	    allowInsecureParser = "1".equals(s) || Boolean.parseBoolean(s);
	}
	// ...
}

It is not difficult to see from the above that if ALLOW_INSECURE_PARSER The corresponding value cannot be empty , Also for 1 perhaps true when ,allowInsecureParser by true.
Set system parameters -Dorg.apache.cxf.stax.allowInsecureParser=1 Start again ,webservice Request no error .

原网站

版权声明
本文为[lang20150928]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206231927301096.html