AppSensei
AppSensei

Reputation: 8400

JAXBException, Unmarshalling an XML Document

I'm getting this exception: Default constructor cannot handle exception type JAXBException thrown by implicit super constructor. Must define an explicit constructor

enter image description here

enter image description here

Upvotes: 1

Views: 555

Answers (1)

bdoughan
bdoughan

Reputation: 148977

JAXBContext.newInstance throws a checked exception. You won't be able to directly set this on a field. You will need to move it inside your constructor and surround it with a try/catch block.

Upvotes: 1

Related Questions