Skip to content

Conversation

@coheigea
Copy link

@coheigea coheigea commented Sep 8, 2020

Thrift 0.13.0 does not work with JDK8, as it is compiled with JDK11. Even though the source version is JDK8, incorrect byte code is generated for various ByteBuffer methods, e.g.:

Exception in thread "TAsyncClientManager#SelectorThread 22" java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer;

The fix is to manually cast ByteBuffer to Buffer (or else switch to using the xenial docker image to create the release artifacts). See this task for more context: jetty/jetty.project#3244

@zeshuai007
Copy link
Member

Hi @he ,

I have been using jdk-8 for thrift communication and compilation, but I have not found java.lang.NoSuchMethodError. Can you provide test cases?
In addition, do the same problems exist for'remaining(),'hasRemaining()', and'capacity()'?

Cheers,
Zezeng Wang

@coheigea
Copy link
Author

Hi @zeshuai007 ,

Yes you can reproduce as follows:

  1. git clone https://github.com/apache/camel
  2. Edit parent/pom.xml and change libthrift-version from 0.12.0 to 0.13.0
  3. mvn clean install -f parent/pom.xml
  4. mvn clean install -f components/camel-thrift/pom.xml

If you run the last command with JDK11 it works perfectly, otherwise you start seeing the errors as above, e.g.:
Exception in thread "TAsyncClientManager#SelectorThread 27" java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer;
at org.apache.thrift.async.TAsyncMethodCall.doWritingRequestBody(TAsyncMethodCall.java:263)
at org.apache.thrift.async.TAsyncMethodCall.transition(TAsyncMethodCall.java:195)

@Jens-G Jens-G added the rebase needed rebase needed label Sep 20, 2020
@stale
Copy link

stale bot commented Dec 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 13, 2020
@coheigea
Copy link
Author

@zeshuai007 Will this PR be considered for 0.14.0? Or can you at least make sure that released artifacts are built with Java 8 to avoid this problem?

@stale
Copy link

stale bot commented Dec 14, 2020

This issue is no longer stale. Thank you for your contributions.

@stale stale bot removed the wontfix label Dec 14, 2020
@coheigea coheigea closed this Jan 4, 2021
@coheigea coheigea deleted the THRIFT-5274 branch January 4, 2021 15:20
@ctubbsii
Copy link
Member

ctubbsii commented Jan 4, 2021

A much simpler fix would be to add -release 8 to the javac command line when compiling with JDK9 and later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rebase needed rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants