简体   繁体   English

Leiningen java-agents不在uberjar工作

[英]Leiningen java-agents not working in uberjar

In my Leiningen project I have the following config: 在我的Leiningen项目中,我有以下配置:

: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: 当在lein repl运行我的应用程序时,正在运行代理程序,但是当我创建uberjar并运行它时:

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?). 我可以在我的uberjar中包含newrelic-agent.jar并传递-javaagent参数,但是我试图避免在我的存储库中有大的二进制blob而不会自动升级(为什么New Relic甚至建议这样做?)。 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? 如何将代理jar放在CLASSPATH中以便我可以验证它是否正常工作?

I am using Jetty, which is said to interfere with bootclasspath , but I'm not sure how it should be interfering. 我正在使用Jetty,据说它会干扰bootclasspath ,但我不确定它应该如何干扰。 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. 如果您自己运行java,则必须自己传递VM选项,例如要使用的调试代理。 lein can't package that into a jar: there is simply no mechanism for doing it. lein无法将其打包成jar:没有机制可以做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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