我有带有抛出我的自定义异常的方法的 Web 服务。
@WebMethod void someMethod(...) throws MyException
MyException
类被注释@ApplicationException
@ApplicationException
class public MyException extends Exception {...}
maven
我使用,JDK 1.6
和生成 WSDL来构建我的项目jaxws-maven-plugin
,并且一切正常。
但是现在我想对 做同样的事情JDK 1.7
,现在我得到了错误
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
at java.lang.StackTraceElement
at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
at java.lang.Throwable
at private java.lang.Throwable[] com.MyPackage.MyExceptionBean.suppressed
at com.MyPackage.MyExceptionBean
有任何想法吗?
不同的是,与 JDK 1.6 类 MyExceptionBean 的生成方式类似
public class MyExceptionBean {
private String message;
但使用 JDK 1.7
public class MyExceptionBean {
private String message;
private Throwable[] suppressed;
jaxws-maven-插件
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>