-
Notifications
You must be signed in to change notification settings - Fork 194
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
Is applicationinsights-core support JDK 9+ currently? #674
Comments
@jdneo I think this should work. I have tested this in JDK 10 in a SpringBoot application which creates a fat jar. If you are doing it otherwise, I am not sure how it exactly is done in Functions, but ensure that the jaxb-api is exposed in the final war/jar artifact which is created after mvn package. This library should be available at run time for proper execution. As far as support is concerned for JDK 9+, the main work for support lies in dependency collection via Application Insights Java Agent, though other parts seems to work once required modules are supplied, we still lack integrated testing on these new JDKs and hence there is no claim for official support. |
It might work for fat jar. How about non fat jar scenario? |
@jdneo try using From preliminary research, we think the only thing that breaks us is the "modularizing" in Java 9. Since we use the xml.bind classes, you'll need to add at least that module to the command line. I haven't had the chance to try this yet, but we will be working on this soon. Let us know if this works for you and I'll keep this ticket open until we update the documentation with the Java 9 workarounds. |
@littleaj I think that we should prohibit users from adding --add in the command line. The JavaEE APIs will be depreciated from Java 11 and onwards (pretty soon) and the command line flag will no longer work for people who have migrated to Java 9 and are using this technique. https://jaxenter.com/jdk-11-java-ee-modules-140674.html The better long term solution as mentioned in the stackoverflow answer @jdneo pointed (check proper long term solution section) would be to explicitly add the jaxb-api in the dependencies section. Alternatively, when we release next version of SDK we can package this API as a part of our library. Though there is definitely a risk of dependency hell with the above approach as this would be very commonly used module in many enterprises and I would rather let users update their POM. |
Ah, good catch. So, yes. It's a workaround that will work now if you want to get unblocked in Java 9, @jdneo; but it will likely break again if you upgrade to Java 11 after that is released. Given this information we will likely look for other XML deserializing options to make this issue obsolete. |
@dhaval24 @littleaj Thank you for all the information provided here. Both Since AI Java SDK is a very important and fundamental lib for Java devs. I think if we can solve this, that will be great both for us and our customers. 😄 |
@jdneo thanks for your suggestion. Yes I believe we should invest in long term seamless solution for all JDKs if possible. We have a feature planned to support JDK 9+ and when we tackle that in coming month or so we would make sure to address this problem in best possible way. In the mean time please feel free to share any information you get around the same in this issue here. |
Hi @dhaval24 any progress on this? java 11 gets released tomorrow and we would like to look at upgrading to it? |
@timja we haven't been able to get to this yet. I hope we should get to it soon. If you have suggestions open to explore, |
Hi @dhaval24. Any status update on this? Our project is upgraded to Java 11 shortly and we are unsure how AI will react to this. |
@alert101 this is still in our backlogs and we are actively tracking it. There are few key things that needs to be done for this migration:
|
I have this working locally with Java 11. Please give me permission to create a branch in this repo and I'll raise a PR |
@stevenleadbeater you can fork the repo and send a PR |
@stevenleadbeater can you create a PR? I've also looked into this but Java agent in JDK 11 hasn't been able to send anything. |
@ElliotZhang I was going to make a PR when they let me push my changes to a branch in this repo. Instead they've asked me to fork it and do it that way. I know its only a 10 minute job, but now I have the code done I have other things to be doing. I've built the jar, it seems to work for us, so we loaded it into our own maven repo. I'll see if I can find the time to port the code some time soon |
@stevenleadbeater apologies if there was any confusion here. We are always very happy to accept contributions. By meaning to “fork the repo and send the pr” I just want to clarify that it meant sending a PR to origin repo from your fork. In that way you do need a permission to create a branch in origin repo. I would be very happy if you make this contribution! |
@dhaval24 No, there is no confusion. I know what you want. Like I said though, my team is unblocked by this as we have our own jar in our own maven repo now. I've got a lot on my plate at the moment and shifting the origin to another repo pushing it up and doing all the admin like tasks of getting it in to a PR from a forked repo has just taken a back seat to other things. I'll get to it when I can although it may need some extra work around keeping support for older JDKs as I've ripped that out after considering that JDK 11 is the only supported open JDK. However, there are still places paying for JDK7 and 8 support I believe... Not sure what you guys want to do around this, obviously it's not a good idea to maintain 2 code bases for pre and post jigsaw. Perhaps we could have separate builds run for JDK9+ and JDK7-8? |
@stevenleadbeaeter totally understandable and appreciate your explanation. Regarding support for JDK 7 and 8, we definitely would have to keep supporting them for a while as Microsoft does support those versions and many users and enterprises are still on JDK 8. If there is no better way, we might create 2 jars. With that in mind: would you mind elaborating the set of changes you had to do to make JDK 11 work with Java Agent. If they are small enough I can help with them. |
@dhaval24 I add the dependency in project to enable application insights in maven plugin with java 11 , it works but no telemetries was sent. Then i found there is an exception when read instrument key from application insights.xml, it throws an exception. And when i remove the xmlns in config xml, it could work, but it failed again with java 8 , it seems that schema differs in jre8 and java11 with maven(I tried the code and it works in a simple java project, but it failed again in a test maven mojo). Is there any method to solve this issue? For now we could only read the instrument key manually and pass it to application insight. link to code where throw exception exception in java 11
exception in java8
|
@Flanker32 I have learned that the url |
@dhaval24 It works well in JDK11, however, the same code failed in java8 and throw an exception The exception only exist when I run the code within a maven mojo, I created a java project and run the code and it works in both java8 and java11. |
@Flanker32 can you share your environment settings. I removed the xmlns in ApplicationInsights.xml but then all tracings were off, even the web req operations that used to work (in JDK 11). |
Any updates on when can we expect AppInsightAgent to work with java 11? |
@timja I had applied this fix to make agent come up in my env but the problem is it doesn't send any telemetry. I guess there is some other blocking issue. |
@ElliotZhang Here is the pr we fix this issue microsoft/azure-maven-plugins#610, we use AI within a maven plugin project, Application Insights 2.2.1 , Oracle JDK 11. Issues we meet is that JAXB can't parse the configuration XML and return null which made AI lose the instrumentation key to send telemetry. You may attach to AI and set a breakpoint here to see whether you meet the same issue. |
Is it possible to get some of these fixes merged into an alpha release of the spring dependencies and a new agent? You currently have a 2.4.0-BETA tag out, maybe we can do something similar? I'm sure we could help test if you make this available. |
Hi @dhaval24, does insights java agent support Java 12 ?? |
@dhaval24 @trask @littleaj Seems like support was released in the beta version. I've tested it on one of my apps and it works (spring-boot 2 with postgresql jdbc) Also, is Class support likely to come back to AI-Agent.xml or is it gone for good?
|
@timja Thanks, I'll close this as fixed. Regarding class support, we've had some others ask for it so it will likely return in 2.5.0-BETA2 or GA, whichever comes first. |
Java 9+ support added in #971 (2.5.0-BETA) |
I'm getting
When using JDK 10 on my machine. Not quite sure if it is because AI Java SDK not support JDK 9+.
Then according to this answer, I added
into my pom and upgrade
AI-core
to the newest version:2.1.1
Then everything works fine. But I cannot receive the telemetries then. Any suggestions on that?
The text was updated successfully, but these errors were encountered: