Repository navigation
Closed
Description
@ramonskie, a simple project jar with applicationinsights-agent.jar added on the root archive level
The same works with old ruby based java buildpack
Please note adding APPLICATIONINSIGHTS_CONNECTION_STRING is essential, otherwise it doesn't start the agent and error doesn't occur
I believe this might be some command evaluation problem that leads to running the jar in a wrong way and java's help is getting printed out.
APPLICATIONINSIGHTS_CONNECTION_STRING: InstrumentationKey=<key-guid>;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/
_JAVA_OPTIONS: >-
-Dhttps.proxyHost=gate.company.com
-Dhttps.proxyPort=8080
-Dhttp.proxyHost=gate.company.com
-Dhttp.proxyPort=8080
-Dhttp.nonProxyHosts=localhost|*.companyapps-np.com|*.companyapps.com|*.gwpnet.com|*.appcloud.company.com|*.ac.company.com|*.ac-np.company.com|*.company.com
JAVA_OPTS: >-
-javaagent:applicationinsights-agent.jar
2026-04-02T13:44:39.12+0200 [CELL/0] OUT Downloading droplet...
2026-04-02T13:44:45.23+0200 [CELL/0] OUT Downloaded droplet (239.5M)
2026-04-02T13:44:45.23+0200 [CELL/0] OUT Starting health monitoring of container
2026-04-02T13:44:45.40+0200 [APP/PROC/WEB/0] OUT Invoking pre-start scripts.
2026-04-02T13:44:45.44+0200 [APP/PROC/WEB/0] OUT Created symlink: /home/vcap/app/BOOT-INF/lib/java-cfenv-3.5.0.jar -> /home/vcap/deps/0/java_cf_env/java-cfenv-3.5.0.jar
2026-04-02T13:44:45.44+0200 [APP/PROC/WEB/0] OUT Created symlink: /home/vcap/app/BOOT-INF/lib/client-certificate-mapper-2.0.1.jar -> /home/vcap/deps/0/client_certificate_mapper/client-certificate-mapper-2.0.1.jar
2026-04-02T13:44:45.44+0200 [APP/PROC/WEB/0] OUT Invoking start command.
2026-04-02T13:44:45.45+0200 [APP/PROC/WEB/0] OUT JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=129700K -XX:ReservedCodeCacheSize=240M -Xss1M -Xmx406875K
2026-04-02T13:44:45.45+0200 [APP/PROC/WEB/0] ERR Picked up _JAVA_OPTIONS: -Dhttps.proxyHost=gate.company.com -Dhttps.proxyPort=8080 -Dhttp.proxyHost=gate.company.com -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|*.companyapps-np.com|*.companyapps.com|*.gwpnet.com|*.appcloud.company.com|*.ac.company.com|*.ac-np.company.com|*.company.com
2026-04-02T13:44:46.07+0200 [APP/PROC/WEB/0] ERR OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2026-04-02T13:44:46.37+0200 [APP/PROC/WEB/0] OUT 2026-04-02 11:44:46.373Z INFO c.m.a.a.i.c.ConfigurationBuilder - Some telemetry may be sampled out because a default sampling configuration was added in version 3.4.0 to reduce the default billing cost. You can set the sampling configuration explicitly: https://learn.microsoft.com/azure/azure-monitor/app/java-standalone-config#sampling
2026-04-02T13:44:48.53+0200 [APP/PROC/WEB/0] OUT 2026-04-02 11:44:48.534Z INFO c.m.applicationinsights.agent - Application Insights Java Agent 3.6.2 started successfully (PID 7, JVM running for 3.077 s)
2026-04-02T13:44:48.53+0200 [APP/PROC/WEB/0] OUT 2026-04-02 11:44:48.534Z INFO c.m.applicationinsights.agent - Java version: 21.0.10, vendor: BellSoft, home: /home/vcap/deps/0/jre/jre-21.0.10
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR Usage: java [options] <mainclass> [args...]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR (to execute a class)
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR or java [options] -jar <jarfile> [args...]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR (to execute a jar file)
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR or java [options] -m <module>[/<mainclass>] [args...]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR java [options] --module <module>[/<mainclass>] [args...]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR (to execute the main class in a module)
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR or java [options] <sourcefile> [args]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR (to execute a single source-file program)
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR Arguments following the main class, source file, -jar <jarfile>,
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -m or --module <module>/<mainclass> are passed as the arguments to
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR main class.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR where options include:
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -client to select the "client" VM
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -cp <class search path of directories and zip/jar files>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -classpath <class search path of directories and zip/jar files>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --class-path <class search path of directories and zip/jar files>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR A : separated list of directories, JAR archives,
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR and ZIP archives to search for class files.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -p <module path>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --module-path <module path>...
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR A : separated list of elements, each element is a file path
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR to a module or a directory containing modules. Each module is either
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR a modular JAR or an exploded-module directory.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --upgrade-module-path <module path>...
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR A : separated list of elements, each element is a file path
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR to a module or a directory containing modules to replace
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR upgradeable modules in the runtime image. Each module is either
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR a modular JAR or an exploded-module directory.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --add-modules <module name>[,<module name>...]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR root modules to resolve in addition to the initial module.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR <module name> can also be ALL-DEFAULT, ALL-SYSTEM,
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR ALL-MODULE-PATH.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --enable-native-access <module name>[,<module name>...]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR modules that are permitted to perform restricted native operations.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR <module name> can also be ALL-UNNAMED.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --list-modules
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR list observable modules and exit
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -d <module name>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --describe-module <module name>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR describe a module and exit
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --dry-run create VM and load main class but do not execute main method.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR The --dry-run option may be useful for validating the
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR command-line options such as the module system configuration.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --validate-modules
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR validate all modules and exit
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR The --validate-modules option may be useful for finding
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR conflicts and other errors with modules on the module path.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -D<name>=<value>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR set a system property
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -verbose:[class|module|gc|jni]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR enable verbose output for the given subsystem
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -version print product version to the error stream and exit
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --version print product version to the output stream and exit
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -showversion print product version to the error stream and continue
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --show-version
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR print product version to the output stream and continue
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --show-module-resolution
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR show module resolution output during startup
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -? -h -help
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR print this help message to the error stream
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --help print this help message to the output stream
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -X print help on extra options to the error stream
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --help-extra print help on extra options to the output stream
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -ea[:<packagename>...|:<classname>]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -enableassertions[:<packagename>...|:<classname>]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR enable assertions with specified granularity
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -da[:<packagename>...|:<classname>]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -disableassertions[:<packagename>...|:<classname>]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR disable assertions with specified granularity
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -esa | -enablesystemassertions
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR enable system assertions
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -dsa | -disablesystemassertions
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR disable system assertions
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -agentlib:<libname>[=<options>]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR load native agent library <libname>, e.g. -agentlib:jdwp
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR see also -agentlib:jdwp=help
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -agentpath:<pathname>[=<options>]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR load native agent library by full pathname
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -javaagent:<jarpath>[=<options>]
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR load Java programming language agent, see java.lang.instrument
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR -splash:<imagepath>
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR show splash screen with specified image
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR HiDPI scaled images are automatically supported and used
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR if available. The unscaled image filename, e.g. image.ext,
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR should always be passed as the argument to the -splash option.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR The most appropriate scaled image provided will be picked up
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR automatically.
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR See the SplashScreen API documentation for more information
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR @argument files
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR one or more argument files containing options
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --disable-@files
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR prevent further argument file expansion
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --enable-preview
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR allow classes to depend on preview features of this release
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR To specify an argument for a long option, you can use --<name>=<value> or
2026-04-02T13:44:48.54+0200 [APP/PROC/WEB/0] ERR --<name> <value>.
2026-04-02T13:44:48.58+0200 [APP/PROC/WEB/0] OUT Exit status 1
2026-04-02T13:44:48.58+0200 [CELL/SSHD/0] OUT Exit status 0
2026-04-02T13:44:54.26+0200 [CELL/0] OUT Cell 19a35bde-f432-4789-93e7-54442219ad63 stopping instance 917f441c-ace0-400b-5c9c-da68
2026-04-02T13:44:54.26+0200 [CELL/0] OUT Cell 19a35bde-f432-4789-93e7-54442219ad63 destroying container for instance 917f441c-ace0-400b-5c9c-da68
2026-04-02T13:44:54.29+0200 [API/9] OUT Process has crashed with type: "web"
Metadata
Metadata
Assignees
Labels
No labels
Activity
stokpop commentedon Apr 2, 2026
Maybe this option needs quotes as the command line does not like
*and|symbols outside quotes.->
krismarc commentedon Apr 2, 2026
That was my first suspect. However, if there's no javaagent then it works with those proxy settings (without any modifications).
This worked without quotation with Ruby version.
krismarc commentedon Apr 2, 2026
Actually, as far as I remember, in other buildpack (not sure about java one), extra quotation used to became part of pipe-separated value, which was causing leading and trailing one to be invalid..
krismarc commentedon Apr 2, 2026
hmm, it worked, wondering why it fails only in combination with extra javaagent only
..I still need to check what happens to leading and trailing values of noproxy
stokpop commentedon Apr 2, 2026
Ah I see something else: there is a
;in the connection string... looking at the buildpack code that gets probably translated into:This will break the command at ; and not show the version info, but java usage instead.
With quotes:
it correctly shows version info via the
--version.Also with an extra backspace (instead of additional quotes) it works from the commandline:
\;So maybe the connection string needs to be quoted from
java-buildpack/src/java/frameworks/azure_application_insights_agent.go
Line 171 in 9ce86e2
krismarc commentedon Apr 2, 2026
sorry! update to my previous proxy statements, I've been testing against old buildpack!
for ruby version it works no matter if quotation is used or not
for go version it doesn't work neither the value is quoted or not
..on my way to test.
krismarc commentedon Apr 2, 2026
@stokpop, that's the right catch! I've tested escaped semicolon and it worked.
..unfortunately, due to environment restrictions, I can't build the buildpack on my own to test changes in Line 171 in 9ce86e2. I assume, someone has to come up with a PR 😄
btw, has anyone ever considered allowing env vars like JAVA_OPTS to be provided as a list, so buildpack would convert it back to raw string? this would be a nice feature. Maintaining lists in devops tools/scripts would be a way easier to handle.
stokpop commentedon Apr 2, 2026
The weird things is: I tried to create a failing integration test with (this is inside the golang integration test code)
"APPLICATIONINSIGHTS_CONNECTION_STRING": "InstrumentationKey=12345678-1234-1234-1234-123456789abc;IngestionEndpoint=https://eastus-1.in.applicationinsights.azure.com/"for the Azure application insights, but it does not fail even though I see no escaping being applied:and checking the generated JAVA_OPTS:
Does it behave different with other setup? This is on linux with the 5.0.2 buildpack in docker
cloudfoundry/cflinuxfs4:latest.krismarc commentedon Apr 2, 2026
Not sure if I gave it a try with double quotes - I'll try tomorrow. First attempt was done without quotes at all and the other one with single quotes and escaped semi-colon. Still, ruby version worked without quotes at all.
krismarc commentedon Apr 3, 2026
so luck with double quoted value, only single quoted with escaped semi-colon worked so far
APPLICATIONINSIGHTS_CONNECTION_STRING: 'InstrumentationKey=<guid>\;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/'krismarc commentedon Apr 3, 2026
it's pretty weird, I just noticed that cf push differently treats different envs, could be that it's unrelated and it's just how cf push log behaves
APPLICATIONINSIGHTS_CONNECTION_STRING never inherits any quotation marks
and in case of LOG4J_FORMAT_MSG_NO_LOOKUPS it turns single quotes into double quotes..
[-]Custom java agent doesn't work with v5[/-][+]application insights java agent doesn't work with v5[/+]