Native image compilation error

Leonardo Loch Zanivan pangalz at gmail.com
Tue Dec 5 15:20:58 UTC 2017


Hi Codrut,

I've downloaded latest version and tried the reflection stuff. It worked
very well with a sample bean and Jackson.
Thank you so much!

Although, I found a few issues while testing other samples, I'll send
follow up emails.

Here's my sample Bean:

package panga.test.graal;
public class Car {
    private String name;
    public Car(String name) {
        this.name = name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }
}

Main method:

package panga.test.graal;
import com.fasterxml.jackson.databind.ObjectMapper;
public class Main {
    public static void main(String... args) throws Throwable {
        final Car ferrari = new Car("Ferrari");
        ObjectMapper mapper = new ObjectMapper();
        System.out.println(mapper.writeValueAsString(ferrari));
    }
}

Reflection configuration:

[{
"name" : "panga.test.graal.Car",
"allDeclaredMethods" : "true",
"allDeclaredFields" : "true",
"allPublicFields" : "true",
"allPublicMethods" : "false"
}]

Command used to create image:

*native-image -jar test.jar -H:+ReportUnsupportedElementsAtRuntime
-H:ReflectionConfigurationFiles=test.json*

NOTE: If I set "allPublicMethods": "true" the following error happens:

classlist:   1,180.50 ms

       (cap):   6,728.02 ms

       setup:   7,493.71 ms

  (typeflow):   4,005.06 ms

   (objects):   1,792.39 ms

  (features):       3.51 ms

    analysis:   5,963.47 ms

    universe:     135.11 ms

fatal error: com.oracle.svm.core.util.VMError$HostedError: UNSUPPORTED
FEATURE: wait/notify called on non-instance type: char[]

at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:74)

at
com.oracle.svm.hosted.meta.UniverseBuilder.collectWaitNotifyFieldInfo(UniverseBuilder.java:733)

at
com.oracle.svm.hosted.meta.UniverseBuilder.build(UniverseBuilder.java:127)

at
com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:688)

at
com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:349)

at
com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:221)

at
com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:312)

at
com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:58)

Error: Image building with exit status 1

On Mon, Dec 4, 2017 at 9:46 PM Codrut Stancu <codrut.stancu at oracle.com>
wrote:

> Hi Leonardo,
>
> The GraalVM 0.30 release is available for download from OTN (
> http://www.oracle.com/technetwork/oracle-labs/program-languages/overview/index.html)
> as usual. It supports reflection and you can find an example in the graalvm-0.30/examples/native-image/README.md
> file. The reflection support is currently experimental and we are ironing
> out potential wrinkles as we expand our use of this feature. For Jackson we
> are investigating the possibility to pre-process the  Jackson annotations
> and register the reflexively accessed elements automatically. At this point
> you'll have to write the reflexion configuration files manually.
>
> Codrut Stancu
>
>
> On Tue, 2017-11-21 at 00:07 +0000, Leonardo Loch Zanivan wrote:
>
> Awesome! Thank you for letting me know. I'm looking forward to use it soon.
>
> Cheers
>
> On Mon, Nov 20, 2017 at 9:54 PM Codrut Stancu <codrut.stancu at oracle.com>
> wrote:
>
> Hi Leonardo,
>
> Reflection is not supported in the current native-image released
> binary. It should be supported in the next release. The release will
> also include a small example to get you started.
>
> Codrut Stancu
>
> On Sat, 2017-11-18 at 14:04 -0800, Codrut Stancu wrote:
> > We actually do support reflection in SVM, but you have to specify the
> > reflexively accessed elements using some descriptor files. That's a
> > limitation of the closed world assumption. The only feature that's
> > not supported is dynamic class loading. We haven't experimented with
> > Jackson yet. I'll get back later with more details (on my phone right
> > now).
> >
> > Codrut StancuOn Nov 18, 2017 1:18 PM, Stefan Marr <java at stefan-marr.d
> > e> wrote:
> > >
> > >
> > > Hi Leonardo:
> > >
> > > >
> > > > On 18 Nov 2017, at 21:10, Leonardo Loch Zanivan <pangalz at gmail.co
> > > > m> wrote:
> > > >
> > > > I only read some mentions about Classloading limitations.
> > > >
> > > > All the JSON serializers I know uses Reflection APIs, so I
> > > > suppose this is something to be supported in future releases.
> > > I don’t know. But, you really need the closed world assumption to
> > > make AOT compilation in the way it is supposed to work for Truffle
> > > languages.
> > > So, I wouldn’t expect that this is going to be addressed any time
> > > soon…
> > >
> > > Best regards
> > > Stefan
> > >
>
>


More information about the graal-dev mailing list