admin管理员组

文章数量:1426472

I have very fragile and very old Java application that is an integral part to my client's business operation. It's written by the national government so I don't have much scope to change how this application runs. It absolutely has to use Java 7 and there's nothing I can do to change this.

The application comes with both a .bat file and a .sh file to run it. I have been able to run this application successfully on my Windows 11 machine using the bat file and also in a Linux-based docker container using the .sh file.

The problem comes in when I deploy this image to an Azure container registry. There appears to be an issue with processing the javaagent in Azure. Below is a snippet from the Web App startup logs which shows the line in the .sh file where the error is thrown:

2025-01-17T14:35:25.855384929Z FATAL ERROR in native method: processing of -javaagent failed
2025-01-17T14:35:32.253593478Z /app/LTS/RunLTSStandalone.sh: line 99:     7 Aborted                 (core dumped) java -cp $CLASSPATH $JAVA_OPTIONS uk.gov.hmrc.aspire.lts.test.LTSStandalone
2025-01-17T14:35:32.279219017Z Application terminated.

I have cross checked the Environment Variables in my container with those added in the Azure Web App - the only one that I think might have an impact on this is the JAVA_TOOL_OPTIONS which only appears in my Azure environment variables and not in the docker container's environment variables. The value for this in Azure is currently empty. I am not a Java developer by any stretch so I'm not really sure where to go next.

Any and all assistance/advice or guidance would be greatly appreciated please! Thanks!

I have very fragile and very old Java application that is an integral part to my client's business operation. It's written by the national government so I don't have much scope to change how this application runs. It absolutely has to use Java 7 and there's nothing I can do to change this.

The application comes with both a .bat file and a .sh file to run it. I have been able to run this application successfully on my Windows 11 machine using the bat file and also in a Linux-based docker container using the .sh file.

The problem comes in when I deploy this image to an Azure container registry. There appears to be an issue with processing the javaagent in Azure. Below is a snippet from the Web App startup logs which shows the line in the .sh file where the error is thrown:

2025-01-17T14:35:25.855384929Z FATAL ERROR in native method: processing of -javaagent failed
2025-01-17T14:35:32.253593478Z /app/LTS/RunLTSStandalone.sh: line 99:     7 Aborted                 (core dumped) java -cp $CLASSPATH $JAVA_OPTIONS uk.gov.hmrc.aspire.lts.test.LTSStandalone
2025-01-17T14:35:32.279219017Z Application terminated.

I have cross checked the Environment Variables in my container with those added in the Azure Web App - the only one that I think might have an impact on this is the JAVA_TOOL_OPTIONS which only appears in my Azure environment variables and not in the docker container's environment variables. The value for this in Azure is currently empty. I am not a Java developer by any stretch so I'm not really sure where to go next.

Any and all assistance/advice or guidance would be greatly appreciated please! Thanks!

Share Improve this question asked Jan 17 at 19:10 ChewpackerChewpacker 111 silver badge2 bronze badges 1
  • 1 Which agent? What are the details of the error? It will be very difficult to help if you don't share a minimal reproducible example. Please also read How to Ask. – aled Commented Jan 18 at 2:05
Add a comment  | 

1 Answer 1

Reset to default 0

I managed to crack this over the weekend. Turns out Application Insights had injected an environment variable for the java agent. I deleted the environment variable from the web app entirely and explicitly set the value of JAVA_TOOL_OPTIONS to "" in my docker file and the application booted!

本文标签: Java 7 application runs in local container but not when deployed to Azure container registryStack Overflow