0

I want my Enunciate report to contain Json Example for all the model classes, to test it I modified the enunciate configuraion to include json example and changed my model class from

    @XmlRootElement(name = "member-response")
    public class MemberResponse

to

    @JsonRootType
    @JsonName("MemberResponse")
    @XmlRootElement
    public class MemberResponse

And then built the maven project and ran

mvn -o clean pre-site site:site site:stage -Prest-reports -PskipQuality -DskipTests=true -U 

Getting the below class cast exception

(com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType) -

Why is @JsonRootType not being recognized by enunicate.? Kindly suggest

[ERROR] Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.27:docs (default) on project endeavour-application-resource: Problem assembling the enunciate app. com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.27:docs (default) on project XXXXXXX-application-resource: Problem assembling the enunciate app.

Caused by: java.lang.ClassCastException: com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType
    at com.sun.tools.apt.mirror.declaration.AnnotationMirrorImpl.getAnnotationType(AnnotationMirrorImpl.java:100)
    at net.sf.jelly.apt.decorations.declaration.DecoratedAnnotationMirror.<init>(DecoratedAnnotationMirror.java:49)
    at net.sf.jelly.apt.decorations.DeclarationDecorator.decorate(DeclarationDecorator.java:362)
    at net.sf.jelly.apt.decorations.DeclarationDecorator.decorateAnnotationMirrors(DeclarationDecorator.java:113)
    at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotationMirrors(DecoratedDeclaration.java:213)
Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
Srikanth Balaji
  • 2,638
  • 4
  • 18
  • 31

1 Answers1

0

The Above error stopped coming once i removed the Jackson jars from the exclusion list of enunciate dependency.

        <dependency>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>enunciate-rt</artifactId>
        <exclusions>
            <!--For Enunciate Reporting to Include Json Examples - Commenting this
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-jaxrs</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-xc</artifactId>
            </exclusion>-->
Srikanth Balaji
  • 2,638
  • 4
  • 18
  • 31