Java org.apache.xml.security在Spring引导下不工作

Java org.apache.xml.security在Spring引导下不工作,java,eclipse,spring-boot,Java,Eclipse,Spring Boot,我正在尝试与org.apache.santuario合作 如果我在Spring Boot main方法中调用它,它将失败: 10:31:40.245 [main] ERROR org.apache.xml.security.Init - Bad: java.lang.IllegalArgumentException: InputStream cannot be null at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder

我正在尝试与org.apache.santuario合作

如果我在Spring Boot main方法中调用它,它将失败:

10:31:40.245 [main] ERROR org.apache.xml.security.Init - Bad: 
java.lang.IllegalArgumentException: InputStream cannot be null
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:117)
    at org.apache.xml.security.Init.init(Unknown Source)
    at ru.gosuslugi.dom.signature.demo.commands.SignCommand.<init>(SignCommand.java:55)
    at com.ric.web.Gisxn2Application.main(Gisxn2Application.java:18)
java.lang.IllegalArgumentException: InputStream cannot be null
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:117)
但如果我从非@SpringBootApplication-class主模块调用它,它工作得非常好。 我使用下一个Jvm参数来处理此程序:

-Dorg.apache.xml.security.resource.config=resource/tj-msxml.xml
有人能描述一下这个问题是什么,为什么会发生

Upd1:SignCommand:

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import xades4j.algorithms.EnvelopedSignatureTransform;
import xades4j.algorithms.ExclusiveCanonicalXMLWithoutComments;
import xades4j.production.*;
import xades4j.properties.DataObjectDesc;
import xades4j.providers.KeyingDataProvider;
import xades4j.providers.MessageDigestEngineProvider;
import xades4j.providers.impl.DirectKeyingDataProvider;

import java.security.KeyException;
import java.security.KeyStore;
import java.security.Provider;
import java.security.Security;
import java.security.cert.X509Certificate;

public class SignCommand implements Command {

    private SignParameters parameters;
    private XadesSigner signer;

    //конструктор
    public SignCommand(SignParameters parameters) {
        System.out.println("############ SIGNCOMMAND CONSTRUCTOR START!");
        org.apache.xml.security.Init.init();
        this.parameters = parameters;
    }

    //конструктор
    public SignCommand() throws Exception {
        // init Apache Santuario
        org.apache.xml.security.Init.init();  <--- here error
import org.apache.commons.io.FileUtils;
导入org.apache.commons.lang.StringUtils;
导入org.w3c.dom.Document;
导入org.w3c.dom.Element;
导入xades4j.algorithms.EnvelopedSignatureTransform;
导入xades4j.algorithms.ExclusiveCanonicalxml,不带注释;
进口xades4j.生产。*;
导入xades4j.properties.DataObjectDesc;
导入xades4j.providers.KeyingDataProvider;
导入xades4j.providers.MessageDigestEngineProvider;
导入xades4j.providers.impl.DirectKeyingDataProvider;
导入java.security.KeyException;
导入java.security.KeyStore;
导入java.security.Provider;
导入java.security.security;
导入java.security.cert.x509证书;
公共类SignCommand实现该命令{
私有签名参数;
私人签名人签名人;
//конструктор
公共SignCommand(SignParameters参数){
System.out.println(“SIGNCOMMAND构造函数启动!”);
org.apache.xml.security.Init.Init();
此参数=参数;
}
//конструктор
public SignCommand()引发异常{
//init Apache Santuario
org.apache.xml.security.Init.Init();
5.1.0.1最终版本
4.12
com.ric.web.SoapWebApplication
1.8
org.springframework.boot
spring启动程序父级
1.5.6.1发布
比尔
生物武器公约
0.0.2-快照
编译
org.springframework.boot
弹簧引导加载程序
假如
org.springframework.boot
弹簧靴起动器
org.springframework.boot
弹簧起动试验
测试
org.springframework.boot
弹簧启动安全
org.springframework.boot
弹簧靴自动配置
org.springframework.boot
弹簧启动装置
org.springframework
春季甲虫
org.springframework
春季方面
org.springframework
弹簧网
org.springframework
SpringWebMVC
org.apache.tomcat
卡塔琳娜雄猫
9.0.0.M6
javax.security.auth.message
javax.security.auth.message-api
1.1
org.springframework
弹簧试验
测试
org.ehcache
ehcache2
3.3.1
net.sf.ehcache
陶土
2.1.1
javax.cache
缓存api
c3p0
c3p0
0.9.1.2
org.projectlombok
龙目
假如
org.apache.commons
公共集合4
4
朱尼特
朱尼特
com.oracle
神谕
10.2.0.2.0
榴莲
榴莲
3.4.0
org.apache.httpcomponents
httpime
4.5.2
org.apache.httpcomponents
httpclient
4.5.2
com.beust
jcommander
1.48
公地io
公地io
2.4
org.bouncycastle
bcpkix-jdk15on
1.55
org.signserver.xades4j
xades4j
1.3.2-4签名服务器
com.sun.xml.ws
jaxws-rt
2.2.7
公地郎
公地郎
2.6
org.apache.maven.plugins
maven编译器插件
1.8
1.8
org.springframework.boot
springbootmaven插件
org.springframework.boot
弹簧引导加载程序
重新包装
org.springframework.boot
springbootmaven插件

我发现下一个Jvm参数:

-Dorg.apache.xml.security.resource.config=resource/tj-msxml.xml

每次运行程序时,主程序内部都会发生更改

为了找到它,我在主过程中写了下一行:

System.out.println("PROP1="+System.getProperty("org.apache.xml.security.resource.config"));
输出为“PROP1=resource/tj msxml.xml noverify” 这很奇怪,因为我期望“PROP1=resource/tjmsxml.xml”

我已使用以下方法更正了此问题:

System.setProperty("org.apache.xml.security.resource.config", "resource/tj-msxml.xml");

但是我对我的解决方案不满意,有人能纠正我吗?

我们必须看看这个
SignCommand
的作用。请看,我添加了SignCommand
System.out.println("PROP1="+System.getProperty("org.apache.xml.security.resource.config"));
System.setProperty("org.apache.xml.security.resource.config", "resource/tj-msxml.xml");