agents not working in uberjar

In my Leiningen project I have the following config:

:java-agents [[com.newrelic.agent.java/newrelic-agent "3.19.2"]]

When running my app as in lein repl the agent is being run, but when I create the uberjar and run it like:

java -jar target/proclodo-spa-server-rendering.jar

the agent is not started. I could include newrelic-agent.jar in my uberjar and pass the -javaagent argument, but I'm trying to avoid having big binary blobs in my repository that will not be upgraded automatically (why does New Relic even recommend that?). I tried adding:

:bootclasspath true

due to this comment:

;; Java agents can instrument and intercept certain VM features. Include
;; :bootclasspath true to place the agent jar on the bootstrap classpath.

but it made no difference. How is the agent jar supposed to be placed in the CLASSPATH so I can verify it's working?

I am using Jetty, which is said to interfere with bootclasspath , but I'm not sure how it should be interfering. Everything seems to run fine, it's only the agent that's not starting.


If you run java yourself, you have to pass the VM options, such as the debugging agent to use, yourself. lein can't package that into a jar: there is simply no mechanism for doing it.

链接地址: http://www.djcxy.com/p/51742.html

上一篇: 无法与Leiningen 2.5.2一起运行uberjar

下一篇: 代理不在uberjar工作