Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@ApplicationException with Java 1.7

I have web service with method that throw my custom exeption.

@WebMethod void someMethod(...) throws MyException   

MyException class is annotated with @ApplicationException

@ApplicationException  
class public MyException extends Exception {...}   

I was build my project using maven, JDK 1.6 and jaxws-maven-plugin for generating WSDL, and all worked well.
But now I want do the same with JDK 1.7, and now I get error

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  

Any ideas?

Different is that with JDK 1.6 class MyExceptionBean was generated like

public class MyExceptionBean {

    private String message;

but with JDK 1.7

public class MyExceptionBean {

    private String message;
    private Throwable[] suppressed;  

jaxws-maven-plugin

<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
like image 597
Ilya Avatar asked Sep 13 '12 09:09

Ilya


1 Answers

There is issue of jaxws-maven-plugin and java 7 :-(
issue tracker

with version 2.2 works well

<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
like image 138
Ilya Avatar answered Oct 25 '22 11:10

Ilya