Hi,

I'm using Java 17. But compiled to target JDK 11 binary.

/Users/olo/Library/Java/JavaVirtualMachines/azul-17.0.3/

Strange thing is that the org.apache.arrow.memory.util.MemoryUtil class appears 
in the debugger. But when it calls MemoryUtil.directBuffer(address, length) it 
gives the java.lang.NoClassDefFoundError

Yes I'm also passing the flags -

--add-opens=java.base/java.nio=ALL-UNNAMED

Regards,

Olo

________________________________
From: David Li <[email protected]>
Sent: 18 July 2022 18:01
To: dl <[email protected]>
Subject: Re: [JAVA] java.lang.NoClassDefFoundError: Could not initialize class 
org.apache.arrow.memory.util.MemoryUtil

Hi,

It's specifically "could not initialize class", is there other output?

Most likely I'd guess you're on Java 9+, are all the necessary flags passed to 
java to enable unsafe memory on this version? 
https://arrow.apache.org/docs/dev/java/install.html#java-compatibility<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Farrow.apache.org%2Fdocs%2Fdev%2Fjava%2Finstall.html%23java-compatibility&data=05%7C01%7C%7C635738eb6d744d854e6d08da68df27ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637937604889560404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=C%2BwgSBfq0kf%2BXP06shkWtcFgTSIq6%2BWDUCD29idt%2FtQ%3D&reserved=0>

-David

On Mon, Jul 18, 2022, at 12:56, Olo Sawyerr wrote:
Hi,

I'm trying to use arrow flight and keep getting this exception below when 
calling flightClient.getStream() - java.lang.NoClassDefFoundError: Could not 
initialize class org.apache.arrow.memory.util.MemoryUtil

It's quite odd because I have arrow-memory-core defined in my pom. I'm using 
v8.0.0. Any ideas what this could be? I'm running this in IntelliJ.

Code:


try (var allocator = new RootAllocator(); var flightClient = 
FlightClient.builder(allocator, location).build()) {
    var flightStream = flightClient.getStream(ticket);
    if (flightStream.next()) {
        retval = flightStream.getRoot();
    }
}

StackTrace:

2022-07-18T17:29:58.075+0100  INFO  grpc-default-executor-11      stderr      
java.lang.NoClassDefFoundError: Could not initialize class 
org.apache.arrow.memory.util.MemoryUtil

2022-07-18T17:29:58.076+0100  INFO  grpc-default-executor-11      stderr        
    at org.apache.arrow.memory.ArrowBuf.getDirectBuffer(ArrowBuf.java:228)

2022-07-18T17:29:58.077+0100  INFO  grpc-default-executor-11      stderr        
    at org.apache.arrow.memory.ArrowBuf.nioBuffer(ArrowBuf.java:223)

2022-07-18T17:29:58.077+0100  INFO  grpc-default-executor-11      stderr        
    at 
org.apache.arrow.flight.grpc.GetReadableBuffer.readIntoBuffer(GetReadableBuffer.java:91)

2022-07-18T17:29:58.078+0100  INFO  grpc-default-executor-11      stderr        
    at org.apache.arrow.flight.ArrowMessage.frame(ArrowMessage.java:319)

2022-07-18T17:29:58.079+0100  INFO  grpc-default-executor-11      stderr        
    at org.apache.arrow.flight.ArrowMessage.access$100(ArrowMessage.java:68)

2022-07-18T17:29:58.079+0100  INFO  grpc-default-executor-11      stderr        
    at 
org.apache.arrow.flight.ArrowMessage$ArrowMessageHolderMarshaller.parse(ArrowMessage.java:551)

2022-07-18T17:29:58.079+0100  INFO  grpc-default-executor-11      stderr        
    at 
org.apache.arrow.flight.ArrowMessage$ArrowMessageHolderMarshaller.parse(ArrowMessage.java:536)

2022-07-18T17:29:58.079+0100  INFO  grpc-default-executor-11      stderr        
    at io.grpc.MethodDescriptor.parseResponse(MethodDescriptor.java:284)

2022-07-18T17:29:58.080+0100  INFO  grpc-default-executor-11      stderr        
    at 
io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:661)

2022-07-18T17:29:58.080+0100  INFO  grpc-default-executor-11      stderr        
    at 
io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:646)

2022-07-18T17:29:58.080+0100  INFO  grpc-default-executor-11      stderr        
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)

2022-07-18T17:29:58.081+0100  INFO  grpc-default-executor-11      stderr        
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)

2022-07-18T17:29:58.081+0100  INFO  grpc-default-executor-11      stderr        
    at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)

2022-07-18T17:29:58.081+0100  INFO  grpc-default-executor-11      stderr        
    at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

Reply via email to