如何解决由JAXB语句引起的异常?

时间:2018-12-23 10:02:55

标签: java android xml jaxb

这是我要运行的代码,但当前在此行引发异常:

try {
        File file = new File(getFilesDir().getPath() + "/" + name + ".xml");
        JAXBContext jaxbContext = JAXBContext.newInstance(Restaurant.class);
        Marshaller marshaller = jaxbContext.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        marshaller.marshal(r, file);

    } catch (JAXBException e) {
        e.printStackTrace();
    }  

我在此行引发异常:

JAXBContext jaxbContext = JAXBContext.newInstance(Restaurant.class);

我将日志复制到pastebin(https://pastebin.com/WRjXbub7

我正在尝试将对象序列化为XML文件。我的代码中没有出现红色标记或任何东西,所以我不知道问题出在哪里。谢谢!

0 个答案:

没有答案