JAXB 给我: java.lang.IllegalArgumentException: is parameter must not be null
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/657091/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JAXB gives me: java.lang.IllegalArgumentException: is parameter must not be null
提问by SCdF
I am doing this using JAXB to unmarshall some XML into Java objects:
我正在使用 JAXB 将一些 XML 解组为 Java 对象:
My code looks a little like this:
我的代码看起来有点像这样:
InputStream testMsg = getClass().getResourceAsStream("TestDocumentEvent.xml");
Unmarshaller unmarshaller = JAXBContext.newInstance(DocumentEvent.class).createUnmarshaller();
DocumentEvent unmarshalled = (DocumentEvent) unmarshaller.unmarshal(testMsg);
However, when I run this code I get an exception:
但是,当我运行此代码时,出现异常:
java.lang.IllegalArgumentException: is parameter must not be null
What's going on?
这是怎么回事?
采纳答案by SCdF
This is because the InputStream
you are passing to the unmarshaller ('is' parameter, geddit) is null, check that the resource name is correct.
这是因为InputStream
您传递给解组器('is' 参数,geddit)为空,请检查资源名称是否正确。