java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer

Ouverte
#966 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
java
Domaine
build-system

Piste de recherche

Start at the ArrowBuf.setBytes stack frame and the arrow-java 17.0.0 build configuration, then inspect the generated bytecode's use of java.nio.ByteBuffer.position(int) against the Java 8 API. Done means the library can run in the reported Java 1.8 Spark environment without this NoSuchMethodError, with the relevant build or compatibility checks passing.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Type: bug
Describe the bug, including details regarding any error messages, version, and platform.

We are experiencing a compatibility issue when using the arrow-java 17.0.0 library in a Spark application deployed on a Java 1.8 runtime environment.

java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;

    at org.apache.arrow.memory.ArrowBuf.setBytes(ArrowBuf.java:847) at org.apache.arrow.memory.ArrowBuf.setBytes(ArrowBuf.java:899) at org.apache.arrow.vector.BaseVariableWidthVector.setSafe(BaseVariableWidthVector.java:1193) at org.apache.spark.sql.execution.arrow.StringWriter.setValue(ArrowWriter.scala:256) at org.apache.spark.sql.execution.arrow.ArrowFieldWriter.write(ArrowWriter.scala:135) at org.apache.spark.sql.execution.arrow.ArrowWriter.write(ArrowWriter.scala:100)

The error indicates that the arrow-java JAR file contains bytecode that references the ByteBuffer.position(int)
method with a return type of Ljava/nio/ByteBuffer.

This specific method signature was introduced in JDK 9 as part of the covariance changes in ByteBuffer.

In JDK 8, the same method returns Ljava/nio/Buffer.

Seems library being compiled with a newer JDK (9 or above)
without specifying the correct cross-compilation flags (-release or -bootclasspath).
Without these flags, the compiler uses its own (newer) API signatures,
making the resulting bytecode incompatible with older JVMs.

It is possible comple library with proper flags and put it to maven repository?

Langage dominant
Java
Étoiles
95
Forks
154
Merge moyen
2 j 16 h
PR mergées (30 j)
9

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de apache/arrow-java

Toutes les issues de apache/arrow-java

Issues similaires

Plus d'issues Java

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.