Java Schemagen on Ubuntu error: SEVERE: null

109 Views Asked by At

I'm using ubuntu 18.04 with java

>> java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.18.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.18.04, mixed mode, sharing)

installed by sudo apt install default-jre (but I don't think that it is the problem)

and I have installed schemagen using apt as suggested here.

The version of schemagen is 2.3.0.1.

I have launched schemagen Moon.java but I have this error:

Sep 10, 2021 5:54:25 PM com.sun.tools.jxc.SchemaGenerator run
SEVERE: null
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:166)
    at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:91)
    at com.sun.tools.jxc.SchemaGenerator.main(SchemaGenerator.java:82)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.tools.jxc.SchemaGeneratorFacade.main(SchemaGeneratorFacade.java:60)
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: class com.sun.tools.javac.code.Attribute$UnresolvedClass cannot be cast to class com.sun.tools.javac.code.Attribute$Class (com.sun.tools.javac.code.Attribute$UnresolvedClass and com.sun.tools.javac.code.Attribute$Class are in module jdk.compiler of loader 'app')
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:163)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
    at com.sun.tools.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:266)
    ... 12 more
Caused by: java.lang.ClassCastException: class com.sun.tools.javac.code.Attribute$UnresolvedClass cannot be cast to class com.sun.tools.javac.code.Attribute$Class (com.sun.tools.javac.code.Attribute$UnresolvedClass and com.sun.tools.javac.code.Attribute$Class are in module jdk.compiler of loader 'app')
    at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor.visitArray(AnnotationProxyMaker.java:192)
    at jdk.compiler/com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:327)
    at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor.getValue(AnnotationProxyMaker.java:167)
    at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateValue(AnnotationProxyMaker.java:145)
    at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.getAllReflectedValues(AnnotationProxyMaker.java:104)
    at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateAnnotation(AnnotationProxyMaker.java:90)
    at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateAnnotation(AnnotationProxyMaker.java:81)
    at jdk.compiler/com.sun.tools.javac.code.AnnoConstruct.getAnnotation(AnnoConstruct.java:185)
    at com.sun.tools.jxc.ap.InlineAnnotationReaderImpl.getClassAnnotation(InlineAnnotationReaderImpl.java:75)
    at com.sun.tools.jxc.ap.InlineAnnotationReaderImpl.getClassAnnotation(InlineAnnotationReaderImpl.java:67)
    at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:287)
    at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:227)
    at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:375)
    at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:390)
    at com.sun.tools.jxc.api.impl.j2s.JavaCompilerImpl.bind(JavaCompilerImpl.java:95)
    at com.sun.tools.jxc.ap.SchemaGenerator.process(SchemaGenerator.java:110)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:980)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:896)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1222)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1335)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1258)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
    ... 15 more


This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 See https://javaee.github.io/jaxb-v2/ Any modifications to this file will be lost upon recompilation of the source schema. Generated on: 2020

I'm not able to understand the reason. Have you some ideas to fix it?

0

There are 0 best solutions below