I can't understand why this JAXB IllegalAnnotationException is thrown

后端 未结 12 1776
渐次进展
渐次进展 2020-12-13 02:03

This is my XML file:


    
    
    
                   


        
12条回答
  •  余生分开走
    2020-12-13 02:52

    In my case, I was able to find the problem by temporarily catching the exception, descending into causes as needed (based on how deep the IllegalAnnotationException was), and calling getErrors() on it.

        try {
            // in my case, this was what gave me an exception
            endpoint.publish("/MyWebServicePort");
        // I got a WebServiceException caused by another exception, which was caused by the IllegalAnnotationsException
        } catch (WebServiceException e) {
            // Incidentally, I need to call getCause().getCause() on it, and cast to IllegalAnnotationsException before calling getErrors()
            System.err.println(((com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException)e.getCause().getCause()).getErrors());
        }
    

提交回复
热议问题