我这样做是使用JAXB将一些XML解组为Java对象:
我的代码看起来有点像这样:
InputStream testMsg = getClass().getResourceAsStream("TestDocumentEvent.xml");
Unmarshaller unmarshaller = JAXBContext.newInstance(DocumentEvent.class).createUnmarshaller();
DocumentEvent unmarshalled = (DocumentEvent) unmarshaller.unmarshal(testMsg);
Run Code Online (Sandbox Code Playgroud)
但是,当我运行此代码时,我得到一个异常:
java.lang.IllegalArgumentException: is parameter must not be null
Run Code Online (Sandbox Code Playgroud)
这是怎么回事?
SCd*_*CdF 26
这是因为InputStream您传递给unmarshaller('is'参数,geddit)为null,请检查资源名称是否正确.
| 归档时间: |
|
| 查看次数: |
25736 次 |
| 最近记录: |