Enunciate Issue = Assembling the enunciate app. com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType

不羁的心 提交于 2019-12-12 02:19:26

问题


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)

回答1:


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>-->


来源:https://stackoverflow.com/questions/30669016/enunciate-issue-assembling-the-enunciate-app-com-sun-tools-apt-mirror-type-cl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!