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

InaccessibleObjectException when calling distinct on a stream in OGNL #2567

Closed
Luke-Sikina opened this issue May 18, 2022 · 3 comments
Closed

Comments

@Luke-Sikina
Copy link

MyBatis version

3.5.9

Database vendor and version

MySQL 5.7

Test case or example project

Example project, linked to test case

Steps to reproduce

  1. Checkout the project listed above
  2. Make sure you are running Java 17+
  3. Make sure you have docker installed (I used test containers to make the example cleaner)
  4. In the project, run mvn clean install (If you don't use test containers a lot, this might take a minute to pull everything)

Expected result

Maven will compile the project, spin up the test db container, pass all tests, and build successfully.

Actual result

The build will fail because of a test failure. The test fails with the following error:

### Error querying database.  Cause: java.lang.reflect.InaccessibleObjectException: Unable to make public final java.util.stream.Stream java.util.stream.ReferencePipeline.distinct() accessible: module java.base does not "opens java.util.stream" to unnamed module @7f1dd5e7
### Cause: java.lang.reflect.InaccessibleObjectException: Unable to make public final java.util.stream.Stream java.util.stream.ReferencePipeline.distinct() accessible: module java.base does not "opens java.util.stream" to unnamed module @7f1dd5e7
        at com.sikina.mybatisproblem.ExampleMapperIntegrationTest.shouldGetThings(ExampleMapperIntegrationTest.java:43)
@harawata
Copy link
Member

Hello @Luke-Sikina ,

Thank you for the report and the complete repro!

This problem has been fixed in 3.5.10 which is currently available in the snapshot repo.
We plan to release 3.5.10 soon, so it would be great if you could try the snapshot and see if there is any other issue.

Related issues:

@Luke-Sikina
Copy link
Author

@harawata Thank you for the quick response! I just tried using 3.5.10-SNAPSHOT and it worked perfectly. I even added some other logic that uses a more complex collector that I was concerned about, and it still worked perfectly. I've pushed the fixed unit test to a new branch in my repro repo, in case you need to refer to it: https://github.com/Luke-Sikina/mybatisproblem/tree/snapshot-fix

I'm not sure if you close issues when you cut the relevant release, or when you commit the fix, so I'm going to let you close this at your discretion.

Thank you for solving this; I'm looking forward to 3.5.10!

@harawata
Copy link
Member

Thanks for the swift feedback!
And the update is reassuring. :D

Closing as a duplicate of #2392

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

No branches or pull requests

2 participants