简体   繁体   中英

can't launch java spring boot app with application Insights agent on azure windows vm

...Has anyone experienced this?

Expected behavior

launching java app jar with app azure insights agent using java command in the windows vm (azure kudu debug console), it should start the spring boot app correctly: "%JAVA_HOME%"\\bin\\java.exe -Dserver.port=%HTTP_PLATFORM_PORT% -javaagent:"%HOME%"\\site\\wwwroot\\applicationinsights-agent-2.4.0-BETA.jar -DAPPLICATION_INSIGHTS_IKEY=a055827f-a797-474f-b3e6-21be57d7fc47 -jar "%HOME%"\\site\\wwwroot\\store-api.jar

Actual behavior

...the vm crashes due to an agent issue:

D:\home\site\wwwroot>"%JAVA_HOME%"\bin\java.exe -verbose -javaagent:"%HOME%"/site/wwwroot/applicationinsights-agent-2.4.0-BETA.jar -jar "%HOME%"/site/wwwroot/store-api.jar
Error occurred during initialization of VM
Error opening zip file or JAR manifest missing : D:\home/site/wwwroot/applicationinsights-agent-2.4.0-BETA.jar
agent library failed to init: instrument

be noted that the AI-Agent.xml is in the same folder:

D:\home\site\wwwroot>dir
 Volume in drive D is Windows
 Volume Serial Number is 2685-8878

 Directory of D:\home\site\wwwroot

05/01/2019  05:14 PM    <DIR>          .
05/01/2019  05:14 PM    <DIR>          ..
04/23/2019  03:16 PM             1,327 AI-Agent.xml
05/01/2019  06:11 PM         2,165,145 applicationinsights-agent-2.4.0-BETA.jar
05/01/2019  06:13 PM        88,090,018 store-api.jar
05/01/2019  05:25 PM           114,456 store-api.log
05/01/2019  05:27 PM             1,268 store-api_trace.log
05/01/2019  05:14 PM               655 web.config
               6 File(s)     90,372,869 bytes
               2 Dir(s)  53,595,926,528 bytes free

D:\home\site\wwwroot> 

System information

  • SDK Version: 2.4.0-BETA and 2.3.1
  • OS type and version: windows on azure vm
  • Using spring-boot? yes

thanking you in advance

As far as the error message when you try to start the server, I believe this is probably due to a vm argument in the run configuration for your project. Can you please go to the run configuration (with the project selected, go to the Run menu and select Run Configurations), click on the Arguments tab, and see what is listed in the VM arguments text box?

In my case ,Here was my original argument

-javaagent:C:\Program Files\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.9.4\appengine-java-sdk-1.9.4\lib\agent\appengine-agent.jar -Xmx512m -Dappengine.fullscan.seconds=5 -Ddatastore.default_high_rep_job_policy_unapplied_job_pct=50

Here is what i changed it too:

-javaagent:"C:\Program Files\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.9.4\appengine-java-sdk-1.9.4\lib\agent\appengine-agent.jar" -Xmx512m -Dappengine.fullscan.seconds=5 -Ddatastore.default_high_rep_job_policy_unapplied_job_pct=50

it fixed my problem.

Hope it helps.

PS: I got this response from some dev community only but didn't have the link. I copied and kept the answer with me so posting it here.

It usually happens when the agent jar file could not be located. Try to change to a full path just to ensure that the file is available.

I have some spring-boot applications running with this agent too. Try to change the way you are passing the javaagent argument.

From:

 -javaagent:"%HOME%"/site/wwwroot/applicationinsights-agent-2.4.0-BETA.jar 

to:

 -javaagent:"%HOME%/site/wwwroot/applicationinsights-agent-2.4.0-BETA.jar" 

Follows a command line sample that I'm using on some of my apps:

PS C:\myapp>"%JAVA_HOME%\bin\java.exe" -javaagent:"C:/myapp/agents/applicationinsights-agent-2.3.1.jar" -jar "C:/myapp/lib/my-app.jar" --server.port=8080

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM