简体   繁体   中英

Unmarshalling error after obfuscation

I am getting following exception whenever I try to unmarshal xml file with my obfuscated jar file.

javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"XCaliberMessage"). Expected elements are (none)

If jar file is not obfuscated then it works fine.

Here is My code:

fileName = "/xcalSmartChk/test-job.xml";
                File f = new File(fileName);
                JAXBContext jc = JAXBContext.newInstance(UploadTestResultXml.class);
                Unmarshaller u = jc.createUnmarshaller();


                UploadTestResultXml xMssg = (UploadTestResultXml) u.unmarshal(f);
                Marshaller m = jc.createMarshaller();
                m.marshal(xMssg, bodyElement);

Note: I have also keep classes related to this function while obfuscating.

Can somebody tell me where I am going wrong?

在RGS文件中添加以下条目以保留注释

.option Annotations 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM