-
Notifications
You must be signed in to change notification settings - Fork 205
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
Failed to scan packages 'com.microsoft.applicationinsights' (When AI libraries are part of Uber SpringBoot Jar) #553
Comments
@MicNeo thank you for reporting the issue. Could you please update the thread with instructions on how to reproduce the issue? Also just a sanity check are you having both Application Insights core and Web jars inside the same uber spring boot jar? (i.e did you make sure you are not missing anyone). Also I believe annotation detector is commonly used library to detect annotations I believe. Correct me if I am wrong here. |
@MicNeo I tried to reproduce this issue by creating a spring boot application and packaged it into single jar using mvn package. I then executed the jar and I cannot find the same exception. I have placed followed the maven organization of packages.(https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html) Please let me know if you followed these guidelines for packaging or else provide us with the steps to reproduce the issue. FYI my Application Insights jars are residing in the same location in UberSpringBoot Jar |
@dhaval24 yes, of course both AI jars are in place, in that uber jar :) About reproduction steps of this one, really nothing fancy. It's simple spring boot app with configured AI via filter. How do you launch your test app? Directly from some IDE or in terminal, like java -jar UberSpringBoot.jar ? |
Here you have project which reproduces that error. It's minimal setup of spring boot with AI. Pleace notice that I replaced instrumentation key to XXXX for security reasons :) To reproduce this bug, simply download that zip, extract, run mvn install, and then in your terminal run: java -jar target/demo-0.0.1-SNAPSHOT.jar |
@MicNeo I am using from the command line : like java -jar DemoApp.jar and it works fine. |
You are basically providing the wrong base package in component scan - it should be the root package of your application. This is the possible culprit. Also your configuration misses one of the beans. |
@dhaval24 I tried root package without success. Have you tried my sample project I have uploaded? Can you upload your working example? Maybe this is problem related with some JVM settings. |
@MicNeo sure, I would trim and upload it this evening. I have it in another machine. |
@dhaval24 would you find some time to post your sample app which works for you? :) |
@MicNeo apologies got really caught up. I will try to upload something as soon as possible. Thanks for your patience. |
@dhaval24 any news on that topic? sorry for rushing you but it's very important to me to have it working. If you got working example I could try to find out by my own what is wrong with my setup. |
@MicNeo apologies for the delay. Here is the sample. Please replace the ikey in applicationinsights.xml and in the ApplicationInsightsConfig class with your ikey. Do mvn package. Run the jar. You should be able to see all the telemetry on the portal. Apologies for the delay here. |
@dhaval24 please add |
Ah crap, thanks for pointing out. Will take a look. By the way @MicNeo could you please try mvn spring-boot:run. And see if you get same error? |
@MicNeo yes, this is true and a very strange behavior. I see that on mvn package java -jar .... throws this exception but when I use the Springboot plugin spring-projects/spring-boot#9324 Look at the comments it explains many things of this complicated behavior. By the way what stops from using Also with the SpringBoot starter that we are developing in #518 I no longer see this issue happening. So I have more questions on how initialization is happening in the Spring at the moment which seems to be addressed with the Starter. |
@dhaval24 you're right, it looks like exception is gone when using mvn spring-boot:run. I need to take a look at this, but it seems that I would need to have maven installed to run that jar, which doesn't seems to be optimal way. This springboot starter which you're talking about, you're running it with that maven command or with plain old java -jar ... ? |
@MicNeo yes, I am running the starter with java -jar and it runs without any issues. Though it is still getting polished :-) . This is indeed a strange issue. |
Hi guys, has this been solved? This is pretty annoying. What about publishing a complete spring boot project using AI? That would be a great help. Not only for Eclipse, but for IntelliJ as well. |
@Injac apologies for the trouble but if you look at my comment above I have described in detail about what is happening. Let me know if you need more clarification. |
Hey,
I trying to use Application Insights with Spring Boot, packed as a single jar. I encounter a problem during startup, here is my log:
I tried to use 2.0.0-BETA version too, but I get very similar results:
I debuged it a little, and problem lies in library that is used to scan for annotations. It doesn't support opening files that are inside jar, that's the path where applicationinsights jar is stored when packed as a single jar:
jar:file:/C:/my-app.jar!/BOOT-INF/lib/applicationinsights-core-2.0.0-BETA.jar!/com/microsoft/applicationinsights/
So it's jar inside jar :) Any ideas how to fix that?
Best regards
The text was updated successfully, but these errors were encountered: