-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Azure batch sdk not working with java 17. #27806
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @mksuni, @bgklein, @mscurrell, @cRui861, @paterasMSFT, @gingi, @dpwatrous. Issue DetailsDescribe the bug Exception or Stack Trace
To Reproduce Setup (please complete the following information):
Additional context Problem due to accessing the private fields using reflection:
Reflective access not permitted with java 17 Information Checklist
|
@srnagar can you please follow up from the autorest / codegen side? |
Hi, we hit this issue recently after migrating to Java 17, I saw this issue is one year old is there any news about it ? |
I'm also facing this bug. I hope, that this will be fixed soon. I didn't expect this because of:
See: Prerequisites |
…me libraries At least Snowflake and Azure Batch. snowflakedb/snowflake-jdbc#589 Azure/azure-sdk-for-java#27806
Hello, as I am also facing this issue and it blocks my team with migration to Java 17 and it's been a while since it's reported, I've decided to debug the code and try to fix it for the community. I've tried to push new branch and create a PullRequest (in repository https://github.com/Azure/autorest-clientruntime-for-java ) however I have no sufficient rights to do it. Issue is located in this file https://github.com/Azure/autorest-clientruntime-for-java/blob/master/client-runtime/src/main/java/com/microsoft/rest/Validator.java and it throws runtime exception for a field The root cause of this issue is order of methods calls. In reflection it's not necessary to make a field accessible before getting both modifiers: static and/or final. Since Java17 it's not possible to make accessible fields which are part of Below you can find a diff-patch which fixed the issue for me.
Final code should look like:
I hope it helps to fix this issue for the community. I didn't test it on all versions of Java between 8 - 16 but it should work as there were no changes in @loicmathieu @vipintrnal @maroony If you wait for this fix, you can apply above patch on your own and deploy adjusted version to internal artifactory and override dependency in pom.xml file of your project like below:
It will also help to test on different scenarios on configuration setup. If you need any further support, please do not hesitate to contact me. |
At the moment, I don't have any issues with Java 17. Maybe it's because I'm using azure batch sdk 11.0.0? I don't know. |
Would you mind sharing your pom dependency? In my project it looks like below
And I'm still facing this issue. Maybe you applied symilar workaround for the VM to open all modules like here kestra-io/kestra#1669 ? I'm using OpenJDK 17.0.8 by Azul Zulu. |
Ah... Found it! You are right. I'm using the "open workaround". |
@mario-guerra could you help get this track1 batch issue discussed in the Batch team, and/or provide any updates on Batch release timelines? |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @bgklein @cRui861 @dpwatrous @gingi @mksuni @mscurrell @paterasMSFT. |
@dpwatrous for comment. |
Just a small update from the Batch team: @skapur12 was able to reproduce this issue and confirmed that the problem appears to be with the If this is fixed in a new version of Also, we are actively working on shipping a preview of a new package based on the more modern |
@dpwatrous this workaround (opening modules widely to reflection) reduces security of the applications. It is there for a reason IMHO. |
Agreed the workaround isn't ideal. We'll update the Batch SDK's dependency as soon as there is a fix available in the client-runtime package. |
I am looking at this issue and will have an update on the best path forward for this issue. |
We are currently working on a track 2 version of the Azure Batch SDK which is expected to preview in early 2024. The newer version of this library will support Java 17 and will also follow the track 2 design guidelines for Azure SDKs. We recommend migrating from the existing Azure Batch library to the new version as the older versions of the library will be deprecated and will only have patch releases for security issues or critical bug fixes. cc: @mario-guerra |
Hi @vipintrnal, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support. |
Describe the bug
azure batch sdk not working with java 17.
Exception or Stack Trace
To Reproduce
Steps to reproduce the behavior:
Use azure batch sdk with java 17.
Setup (please complete the following information):
Additional context
I suspect the issue is due to below code:
Problem due to accessing the private fields using reflection:
Reflective access not permitted with java 17
Information Checklist
The text was updated successfully, but these errors were encountered: