Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis fails because field of TypeInfoImpl has type incompatible with proxy of XmlSeeAlso #2720

Closed
Adelrisk opened this issue Jul 28, 2020 · 35 comments · Fixed by #3713
Closed
Assignees
Labels
bug native-image quarkus quarkus related issue

Comments

@Adelrisk
Copy link

Describe the issue
While building a native image using quarkus the analysis stage fails with the reason:

Error: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.xml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x00005C0F00005C10:!S:XmlSeeAlso$$ProxyImpl]>

In my project, I can only find com.sun.xml.bind.v2.model.impl.TypeInfoImpl in the jar org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile in my dependencies, which is only pulled in within the following top-level dependency:

 +- io.quarkus:quarkus-hibernate-orm-panache:jar:1.6.1.Final:compile
 |  +- io.quarkus:quarkus-hibernate-orm:jar:1.6.1.Final:compile
 |  |  +- org.hibernate:hibernate-core:jar:5.4.18.Final:compile
 |  |  |  +- net.bytebuddy:byte-buddy:jar:1.10.10:compile
 |  |  |  +- antlr:antlr:jar:2.7.7:compile
 |  |  |  +- org.dom4j:dom4j:jar:2.1.3:compile
 |  |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.1.0.Final:compile
 |  |  +- org.hibernate:hibernate-graalvm:jar:5.4.18.Final:compile
 |  |  +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
 |  |  |  +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
 |  |  |  \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
 |  |  +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec:jar:2.0.0.Final:compile
 |  |  +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
 |  |  +- org.hibernate:quarkus-local-cache:jar:0.1.0:compile
 |  |  |  \- com.github.ben-manes.caffeine:caffeine:jar:2.8.4:compile
 |  |  \- io.quarkus:quarkus-caffeine:jar:1.6.1.Final:compile
 |  +- io.quarkus:quarkus-hibernate-orm-panache-common:jar:1.6.1.Final:compile
 |  \- io.quarkus:quarkus-panache-common:jar:1.6.1.Final:compile

Even though I orient myself on #1178, I cannot track down the conflicting class in the graal codebase, or in my own. This part of this implementation of JAXB-API seems incompatible with graal.

Describe GraalVM and your environment:

  • GraalVM version: 20.1.0
  • JDK major version: 11.0.7
  • OS: Debian
  • Architecture: AMD64

More details

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.1.0 (Java Version 11.0.7)                                                                                                                    
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /home/myhome/tools/graalvm/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanage
r.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=
UTF-8 -H:DynamicProxyConfigurationFiles=proxies.json -H:DynamicProxyConfigurationFiles=proxies_resources.json -H:+TraceClassInitialization --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:
+JNI -jar identity-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie --no-server -H:-UseServic
eLoaderFeature -H:+StackTrace identity-1.0.0-SNAPSHOT-runner                                                                                                                                                                                                         
-H:IncludeAllTimeZones and -H:IncludeTimeZones are now deprecated. Native-image includes all timezonesby default.                                                                                                                                                    
[identity-1.0.0-SNAPSHOT-runner:134700]    classlist:  23,905.79 ms,  1.62 GB                                                                                                                                                                                        
[identity-1.0.0-SNAPSHOT-runner:134700]        (cap):   1,279.26 ms,  2.54 GB                                                                                                                                                                                        
[identity-1.0.0-SNAPSHOT-runner:134700]        setup:   3,521.45 ms,  2.54 GB                                                                                                                                                                                        
17:10:01,379 INFO  [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.1.5.Final                                                                                                                                                                           
17:10:01,597 INFO  [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.18.Final                                                                                                                                                                              
17:10:01,604 INFO  [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}                                                                                                                                                                
17:10:01,647 INFO  [org.hib.dia.Dialect] HHH000400: Using dialect: io.quarkus.hibernate.orm.runtime.dialect.QuarkusPostgreSQL10Dialect                                                                                                                               
17:10:58,398 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final                                                                                                                                                                                               
WARNING GR-10238: VarHandle for static field is currently not fully supported. Static field private static volatile java.lang.System$Logger jdk.internal.event.EventHelper.securityLogger is not properly marked for Unsafe access!                                  
[identity-1.0.0-SNAPSHOT-runner:134700]     (clinit):   2,120.21 ms,  6.77 GB                                                                                                                                                                                        
[identity-1.0.0-SNAPSHOT-runner:134700]   (typeflow): 107,127.73 ms,  6.77 GB                                                     
[identity-1.0.0-SNAPSHOT-runner:134700]    (objects):  70,590.48 ms,  6.77 GB                               
[identity-1.0.0-SNAPSHOT-runner:134700]   (features):   2,018.63 ms,  6.77 GB                                                
[identity-1.0.0-SNAPSHOT-runner:134700]     analysis: 194,886.87 ms,  6.77 GB                                                                                                                                                                                        
Error: Unsupported features in 3 methods                                                                                                                                                                                                                             
Detailed message:                                                                                                                                                                                                                                                    
Error: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.xml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x00005C0F00005C10:!S:XmlSeeAlso$$ProxyImpl]>
@Adelrisk
Copy link
Author

I just used exclusion to swap out the dependency for com.sun.xml.bind:jaxb-impl:2.3.3 and discovered it contains this class too. Not a quick work-around.

I'm willing to help tackle this problem, but I'm not yet clear what would be productive and meaningful.

@Adelrisk
Copy link
Author

Quarkus 1.9.1 was released, so I revisited this problem with GraalVM Version 20.2.0 (Java Version 11.0.8). This problem persists:

Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.xml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x000054B6000054B7:!S:XmlSeeAlso$$ProxyImpl]>

I'm still missing a sane approach to fixing, debugging or further analysing this problem. Suggestions are welcome!

@argenstijn
Copy link

what is the status of this issue?

@Adelrisk
Copy link
Author

My understanding of the issue is what can be perceived: GraalVM cannot compile XmlSeeAlso. There is no workaround.

@argenstijn
Copy link

cstancu, do you have any idea to support this in graalvm? If yes, do you happen to know when?

@argenstijn
Copy link

see quarkusio/quarkus@daec663

@xalmam
Copy link

xalmam commented Dec 5, 2020

hi, we also looking at GraalVM but XML + JAXB is used a lot in our backend services. This issue blocking us from switching to GraalVm and Quarkus. Is there a workaround for this?

@darkjeffbr
Copy link

hi, everyone!
We are also facing the same issue with quarkus native compilation. Does anyone have a workaround for this issue ?

@antonwiens
Copy link

Same here

@argenstijn
Copy link

argenstijn commented Mar 31, 2021

This issue is still here when using graalvm 21.0

@argenstijn
Copy link

Can we please have an update on this issue?

@argenstijn
Copy link

argenstijn commented Apr 2, 2021

@cstancu

I include a simpleJaxb project which can reproduce this error constantly:
using:
graalvm 21
quarkus 1.13.0
jaxb-extension
jaxb-bug.zip

@argenstijn
Copy link

argenstijn commented Apr 23, 2021

@TargetClass(className = "com.sun.xml.bind.v2.model.impl.TypeInfoImpl", onlyWith = Target_com_sun_xml_bind_v2_model_impl_TypeInfoImpl.Selector.class)
@Substitute
final class Target_com_sun_xml_bind_v2_model_impl_TypeInfoImpl {        
   
    static final class Selector implements BooleanSupplier {

        @Override
        public boolean getAsBoolean() {
            try {
                Class.forName("com.sun.xml.bind.v2.model.impl.TypeInfoImpl");
                return true;
            } catch (Exception e) {
                return false;
            }
        }
    }
}

This fixes the problem. But could it break something?

@Adelrisk. Does this fix the problem for you as well?

@zakkak zakkak added the quarkus quarkus related issue label Jun 15, 2021
@argenstijn
Copy link

Seems to be fixed in the lastest version (graalvm 21.0.x and quarkus 1.13.7). I guess the issue can be closed

@dufoli
Copy link

dufoli commented Aug 9, 2021

@argenstijn are you sure ? because we have still the issue with cxf...
I am analysing why but I still do not understand how it work...
maybe best is to add breakpoint on jaxb in different classes and check value.
upstream is set in constructor so it mean that one of subclass creation has a wrong parameter.
one of parameter is XMLSeeAlso annotation proxy (proxy.newProxyInstance) that must inherite XMLSeeAlso and Locatable. as proxy declaration said so. Maybe issue is really on graal because proxy do not inherite Locatable ???

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/ClassInfoImpl.java

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/ElementInfoImpl.java

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/EnumLeafInfoImpl.java

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/ArrayInfoImpl.java

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/RuntimeClassInfoImpl.java

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/RuntimeElementInfoImpl.java

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/RuntimeArrayInfoImpl.java

https://github.com/javaee/jaxb-v2/blob/45360860439ab14bccf020036306b69797ee1a9e/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/RuntimeEnumLeafInfoImpl.java
...

@dufoli
Copy link

dufoli commented Aug 9, 2021

I just see this PR : d72e67b#diff-5731194b93b5585f9ee61e07a1c72af18fd64a3a47dafcacb0fe155555b287ae
Maybe it can help with this. Can someone test on last master ?

@dufoli
Copy link

dufoli commented Aug 10, 2021

so sadly other patch do not resolve it.
Can someone test with this substitution to add log in order to debug it :

@TargetClass(className = "com.sun.xml.bind.v2.model.annotation.LocatableAnnotation")
final class Target_com_sun_xml_bind_v2_model_annotation_LocatableAnnotation implements InvocationHandler, Locatable, Location {

    //@Alias
    //private static Logger LOG = null;

    @Alias
    Target_com_sun_xml_bind_v2_model_annotation_LocatableAnnotation(Annotation core, Locatable upstream) {
    }

    @Substitute()
    public static <A extends Annotation> A create(A annotation, Locatable parentSourcePos) {
        Logger LOG = LogUtils.getL7dLogger(com.sun.xml.bind.v2.model.annotation.LocatableAnnotation.class);
        LOG.info("LocatableAnnotation.create");
        if (annotation == null)
            return null;
        Class<? extends Annotation> type = annotation.annotationType();
        LOG.info("LocatableAnnotation.create type:" + type);
        ClassLoader cl = null;
        Class c = Target_com_sun_xml_bind_v2_model_annotation_LocatableAnnotation.class;
        if (System.getSecurityManager() == null) {
            cl = c.getClassLoader();
        } else {
            cl = (ClassLoader) java.security.AccessController.doPrivileged(
                    new java.security.PrivilegedAction() {
                        public java.lang.Object run() {
                            return c.getClassLoader();
                        }
                    });
        }
        try {
            LOG.info("LocatableAnnotation.create before reflection");
            Class loadableT = Class.forName(type.getName(), false, cl);
            LOG.info("LocatableAnnotation.create after reflection");
            if (loadableT != type) {
                LOG.info("LocatableAnnotation.create failed reflection");
                return annotation; // annotation type not loadable from this class loader
            }

            return (A) Proxy.newProxyInstance(cl,
                    new Class[] { type, Locatable.class },
                    new Target_com_sun_xml_bind_v2_model_annotation_LocatableAnnotation(annotation, parentSourcePos));
        } catch (ClassNotFoundException e) {
            // annotation not loadable
            LOG.info("LocatableAnnotation.create annotation not loadable" + e.toString());
            return annotation;
        } catch (IllegalArgumentException e) {
            // Proxy.newProxyInstance throws this if it cannot resolve this annotation
            // in this classloader
            LOG.info("LocatableAnnotation.create cannot resolve this annotation" + e.toString());
            return annotation;
        }

    }

    @Alias
    private static final Map<Class, Quick> quicks = new HashMap<Class, Quick>();

    @Alias
    public com.sun.jdi.Location location() {
        return null;
    }

    @Alias
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        return null;
    }
}

@dufoli
Copy link

dufoli commented Aug 12, 2021

Ok, I share what I discover : the $$ProxyImpl is generated from AnnotationSubstitutionType.java

https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/annotation/AnnotationSubstitutionType.java

and 1TypeMObject come from
https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/typestate/SingleTypeState.java

So it seems to be a graal internal type that is passed instead of orginal one.
So I guess a AnnotationSubstitutionProcessor.resolve() is missing somewhere.

I have try to debug on jvm to see the type who arrive normaly and I have
Locatable Proxy previously created in LocatableAnnotation on another node.

@javax.xml.bind.annotation.XmlSeeAlso(value={io.quarkiverse.cxf.deployment.test.Banana.class})

So this Proxy
Proxy.newProxyInstance(cl,
new Class[]{ type, Locatable.class },
new LocatableAnnotation(annotation,parentSourcePos));
wrap the annotation XMLSeeAlso.

error is generated here : https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java
the checkUniverse check that type is compatible.
But I think that type is compatible. So maybe have to do with TypeState.forSubtraction return which need to be empty for proxy

public static TypeState forSubtraction(BigBang bb, TypeState s1, TypeState s2) {

@argenstijn
Copy link

Sorry, i am off for a few days. But in my case the error disappeared using the latest quarkus and graalvm version.

@dufoli
Copy link

dufoli commented Aug 12, 2021

the issue happend with quarkus 2.1.0-Final / quarkus 2.1.1-Final, GraalVM 21.2.0, quarkiverse cxf 0.9

@rognew
Copy link

rognew commented Aug 12, 2021

Have same issue with GraalVM 21.1.0, 21.2.0, quarkus 1.13.2.Final, 1.13.7.Final, 2.1.1.Fianl

@dufoli
Copy link

dufoli commented Aug 17, 2021

hmm maybe it is related to jdk version. if it disapear for some people and not for other.
I have check proxyGenerator on jdk and big change happend on some versions:

  • jdk16 use methodhandle on ProxyGenerator
  • jdk 14 new version but can use -Djdk.proxy.ProxyGenerator.v49=true to check if impact

@argenstijn @rognew what is your jdk version ?

@argenstijn
Copy link

Hi,

I can reproduce it again with my simple test project.

quarkus: 2.1.2.Final
linux graalvm: 21.2.0
JDK version : 11

And it works again when i have the following replacement:

@TargetClass(className = "com.sun.xml.bind.v2.model.impl.TypeInfoImpl", onlyWith = Target_com_sun_xml_bind_v2_model_impl_TypeInfoImpl.Selector.class)
@substitute
final class Target_com_sun_xml_bind_v2_model_impl_TypeInfoImpl {

static final class Selector implements BooleanSupplier {

    @Override
    public boolean getAsBoolean() {
        try {
            Class.forName("com.sun.xml.bind.v2.model.impl.TypeInfoImpl");
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}

}

@argenstijn
Copy link

@dougxc @olpaw @christianwimmer , any ideas?

@dufoli
Copy link

dufoli commented Aug 18, 2021

I do not get how the substitute fix the issue because no method/field are substitute. So it mean it is just that when a substitution is there, it have no issue of type...

we need a more simple reproducer.
Maybe something like:

public class Dog
    extends PetType
{
}
public class Cat
    extends PetType
{
}

@XmlSeeAlso({
    Dog.class,
    Cat.class
})
public class PetType {
}
@test
void main () {
    Locatable parentSourcePos = null;
    parentSourcePos = test(parentSourcePos);
    //the second call must fail because of proxy and substitution:
    test(parentSourcePos);
}

Annotation test(parentSourcePos)
{
Annotation[] annotations = PetType.class.getAnnotations();
Annotation annotation = annotations[0];
Class<? extends Annotation> type = annotation.annotationType();
ClassLoader cl = SecureLoader.getClassClassLoader(LocatableAnnotation.class);

Class loadableT = Class.forName(type.getName(), false, cl);
if(loadableT !=type) {
    // here we can have issue because annotation do not inherite of Locatable
    return annotation;
}

return (Annotation)Proxy.newProxyInstance(cl,
        new Class[]{ type, Locatable.class },
        new LocatableAnnotation(annotation,parentSourcePos));
}

@dufoli
Copy link

dufoli commented Aug 18, 2021

I think I found the issue by looking for reproducer.
https://github.com/javaee/jaxb-v2/blob/master/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/annotation/LocatableAnnotation.java#L83

it return the annotation without Locatable proxy so we can have an annotation with Locatable class and checkUniverse check that Type is consistent. because XML is a tree we have a call with returned value of LocatableAnnotation .create as parameter for next call... here checkUniverse must found an issue because type can be not consistent.

https://github.com/javaee/jaxb-v2/blob/master/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/model/impl/ModelBuilder.java#L287-L290

Here you see it get Annotation from current class then cast it to Locatable for next leaf but it can return a non Locatable instance. So best is maybe do a substitution on LocatableAnnotation.create to throw exception if not succeed instead of returning source object.
or substitution on ModelBuilder to check instance type before cast.
I am not a big expert but if someone can test substitution on that?

@argenstijn
Copy link

Dufoli, how can we get someone of graalvm look into this issue?

@cstancu ? Can you please take a quick look!

@argenstijn
Copy link

I do not get how the substitute fix the issue because no method/field are substitute

yes, that is weird but it helps somehow.

@dougxc
Copy link
Member

dougxc commented Aug 18, 2021

@cstancu ? Can you please take a quick look!

Codrut is currently on vacation but will look at this after he returns.

@cstancu
Copy link
Member

cstancu commented Aug 23, 2021

@argenstijn I cannot use your reproducible. When I run mvn package -Pnative I get:

14652: Compilation failure
[ERROR] /jaxb-bug/src/main/java/com/quarkus/bug/ReproduceHandler.java:[17,17] cannot find symbol
[ERROR]   symbol:   class Note
[ERROR]   location: package generated

If you can still reproduce this issue can you please make sure that the reproducible code is complete.

@Adelrisk can you please provide reproducible code?

@argenstijn
Copy link

@cstancu , see below:

graalvm version: 21.2
linux wls: Ubuntu 20.04 LTS (GNU/Linux 5.10.16.3-microsoft-standard-WSL2 x86_64)
quarkus: 2.1.3

reproduce.zip

mvn package -Pnative result:

mvn package -Pnative
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to met
hod java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.quarkus.bug:ReproducerIssue14652 >----------------
[INFO] Building ReproducerIssue14652 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for io.quarkus:quarkus-maven-plugin:jar:2.1.13.Final is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.318 s
[INFO] Finished at: 2021-08-23T12:24:25+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin io.quarkus:quarkus-maven-plugin:2.1.13.Final or one of its dependencies could not be resolved: Failure to find io.quarkus
:quarkus-maven-plugin🫙2.1.13.Final in https://artifactory.prd.ss.aws.insim.biz/artifactory/tan-maven-vr was cached in the local repo
sitory, resolution will not be reattempted until the update interval of tan-maven-vr has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
d52c621@LPZWNL000020171:/mnt/c/ontwikkel/git/infofolioproxyservicequarkus$ mvn package -Pnative
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to met
hod java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.quarkus.bug:ReproducerIssue14652 >----------------
[INFO] Building ReproducerIssue14652 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.1.3.Final:generate-code (default) @ ReproducerIssue14652 ---
[INFO]
[INFO] --- jaxb2-maven-plugin:2.5.0:xjc (simple) @ ReproducerIssue14652 ---
[INFO] Ignored given or default xjbSources [/mnt/c/ontwikkel/git/infofolioproxyservicequarkus/src/main/xjb], since it is not an existent
file or directory.
[INFO] No changes detected in schema or binding files - skipping JAXB generation.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ReproducerIssue14652 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ ReproducerIssue14652 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:2.1.3.Final:generate-code-tests (default) @ ReproducerIssue14652 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ReproducerIssue14652 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ ReproducerIssue14652 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.481 s
[INFO] Finished at: 2021-08-23T12:25:18+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project Reprodu
cerIssue14652: Error while storing the mojo status: /mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target/maven-status/maven-compiler
-plugin/testCompile/default-testCompile/inputFiles.lst (Permission denied) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
d52c621@LPZWNL000020171:/mnt/c/ontwikkel/git/infofolioproxyservicequarkus$ mvn clean package -Pnative
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to met
hod java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.quarkus.bug:ReproducerIssue14652 >----------------
[INFO] Building ReproducerIssue14652 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ReproducerIssue14652 ---
[INFO] Deleting /mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target
[INFO]
[INFO] --- quarkus-maven-plugin:2.1.3.Final:generate-code (default) @ ReproducerIssue14652 ---
[INFO]
[INFO] --- jaxb2-maven-plugin:2.5.0:xjc (simple) @ ReproducerIssue14652 ---
[INFO] Created EpisodePath [/mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target/generated-sources/jaxb/META-INF/JAXB]: true
[INFO] Ignored given or default xjbSources [/mnt/c/ontwikkel/git/infofolioproxyservicequarkus/src/main/xjb], since it is not an existent
file or directory.
[INFO] Created EpisodePath [/mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target/generated-sources/jaxb/META-INF/JAXB]: true
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ReproducerIssue14652 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ ReproducerIssue14652 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to /mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target/classes
[INFO]
[INFO] --- quarkus-maven-plugin:2.1.3.Final:generate-code-tests (default) @ ReproducerIssue14652 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ReproducerIssue14652 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ ReproducerIssue14652 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ ReproducerIssue14652 ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ReproducerIssue14652 ---
[INFO] Building jar: /mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target/ReproducerIssue14652-0.1.jar
[INFO]
[INFO] --- quarkus-maven-plugin:2.1.3.Final:build (default) @ ReproducerIssue14652 ---
[INFO] [org.jboss.threads] JBoss Threads version 3.4.2.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /mnt/c/ontwikkel/git/infofolioproxyservice
quarkus/target/ReproducerIssue14652-0.1-native-image-source-jar/ReproducerIssue14652-0.1-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /mnt/c/ontwikkel/git/infofolioproxyservicequark
us/target/ReproducerIssue14652-0.1-native-image-source-jar/ReproducerIssue14652-0.1-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 21.2.0 Java 11 CE (Java Ver
sion 11.0.12+6-jvmci-21.2-b08)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /home/d52c621/Development/graalvm-ce-java11-21.2.0/bin/native-image -J-D
java.util.logging.manager=org.jboss.logmanager.LogManager -J-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -J-Duser.language
=en -J-Duser.country= -J-Dfile.encoding=UTF-8 -H:ReflectionConfigurationFiles=reflection-config.json -H:+AllowIncompleteClasspath --repo
rt-unsupported-elements-at-runtime -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -
H:+AllowFoldMethods -jar ReproducerIssue14652-0.1-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H
:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace -H:-ParseOnce ReproducerIssue14652-0.1
-runner
[ReproducerIssue14652-0.1-runner:431] classlist: 4,892.82 ms, 0.96 GB
[ReproducerIssue14652-0.1-runner:431] (cap): 1,390.00 ms, 0.96 GB
[ReproducerIssue14652-0.1-runner:431] setup: 3,488.51 ms, 0.96 GB
12:26:29,531 WARN [io.qua.config] Unrecognized configuration key "quarkus.log.console.json" was provided; it will be ignored; verify th
at the dependency extension for this configuration is set or that you did not make a typo
12:26:39,339 INFO [org.jbo.threads] JBoss Threads version 3.4.2.Final
[ReproducerIssue14652-0.1-runner:431] (clinit): 502.59 ms, 5.09 GB
[ReproducerIssue14652-0.1-runner:431] (typeflow): 14,422.88 ms, 5.09 GB
[ReproducerIssue14652-0.1-runner:431] (objects): 17,856.53 ms, 5.09 GB
[ReproducerIssue14652-0.1-runner:431] (features): 1,234.35 ms, 5.09 GB
[ReproducerIssue14652-0.1-runner:431] analysis: 34,932.43 ms, 5.09 GB
Error: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.xml.bind.v2.model.annotation.Locatable which
is incompatible with types in state: 1TypeMObject<[0x0000125700001258:!S:XmlSeeAlso$$ProxyImpl]>
Detailed message:

com.oracle.svm.core.util.UserError$UserException: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.x
ml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x0000125700001258:!S:XmlSeeAlso$$ProxyIm
pl]>
Detailed message:

    at com.oracle.svm.core.util.UserError.abort(UserError.java:82)
    at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:764)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:532)
    at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:491)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:380)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:543)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:573)

Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream
has declared type com.sun.xml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x00001257000
01258:!S:XmlSeeAlso$$ProxyImpl]>
Detailed message:

    at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:761)
    ... 6 more

[ReproducerIssue14652-0.1-runner:431] [total]: 43,652.11 ms, 5.09 GB

Printing build artifacts to: /mnt/c/ontwikkel/git/infofolioproxyservicequarkus/target/ReproducerIssue14652-0.1-native-image-source-jar

/ReproducerIssue14652-0.1-runner.build_artifacts.txt
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:27 min
[INFO] Finished at: 2021-08-23T12:27:04+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.1.3.Final:build (default) on project ReproducerIssue14652: Failed to bu
ild quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeExce
ption: Failed to build native image
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:235)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:829)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:377)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:205)
[ERROR] ... 11 more
[ERROR] -> [Help 1]

@dufoli
Copy link

dufoli commented Aug 23, 2021

to make the reproducer working I ahve removed the Note reference in ReproduceHandler on my side.

@Adelrisk
Copy link
Author

@argenstijn I can confirm the bug with your updated reproducer. The error message seems identical with the OP, the current error is here for clarity:

Error: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.xml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x0000125400001255:!S:XmlSeeAlso$$ProxyImpl]>                                                                                                           
Detailed message:                                                                                                                                                                                                                  
                                                                                                                 
com.oracle.svm.core.util.UserError$UserException: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.xml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x0000125400001255:!S:XmlSeeAlso$$ProxyImpl]>                                                                                                                                                                                  
Detailed message:                                                                                                
                                                                                                                 
        at com.oracle.svm.core.util.UserError.abort(UserError.java:82)                        
        at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:798)         
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$2(NativeImageGenerator.java:495)                                                                                                                                  
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Field com.sun.xml.bind.v2.model.impl.TypeInfoImpl.upstream has declared type com.sun.xml.bind.v2.model.annotation.Locatable which is incompatible with types in state: 1TypeMObject<[0x0000125400001255:!S:XmlSeeAlso$$ProxyImpl]>
Detailed message:

        at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:795)
        ... 8 more
  • GraalVM 21.1.0
  • Java 11 CE (Java Version 11.0.11+8-jvmci-21.1-b05

@Adelrisk
Copy link
Author

@dufoli The previous comment #2720 (comment) includes the updated reproducer

@cstancu
Copy link
Member

cstancu commented Aug 24, 2021

Thank you for the reproducible code. The problem is that LocatableAnnotation wraps an Annotation such that it also implements Locatable. This is incompatible with with our annotation optimizations. The solution is to disable the optimization for non-standard annotation types. Please see #3713 for the patch and please give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug native-image quarkus quarkus related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants