在我的heroku procfile中,我已经添加了这样的Java代理路径
web: java -javaagent:newrelic/newrelic.jar
在应用程序根文件夹中,我创建了newrelic文件夹,并将newrelic-java-5.13.0.zip文件解压缩到该文件夹中。
但是我遇到以下错误:
app/web.1: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
app/web.1: Picked up JAVA_TOOL_OPTIONS: -Xmx671m -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
app/web.1: Jun 29, 2020 11:38:27 +0000 [4 1] com.newrelic INFO: New Relic Agent: Loading configuration file "/app/newrelic/./newrelic.yml"
app/web.1: Jun 29, 2020 11:38:27 +0000 [4 1] com.newrelic INFO: Using default collector host: collector.newrelic.com
app/web.1: Jun 29, 2020 11:38:28 +0000 [4 1] com.newrelic INFO: New Relic Agent v5.13.0 is initializing...
app/web.1: Jun 29, 2020 11:38:30 +0000 [4 11] com.newrelic INFO: Instrumentation com.newrelic.instrumentation.jdbc-resultset is disabled. Skipping.
app/web.1: Jun 29, 2020 11:38:35 +0000 [4 1] com.newrelic.agent.RPMServiceManagerImpl INFO: Configured to connect to New Relic at collector.newrelic.com:443
app/web.1: Jun 29, 2020 11:38:36 +0000 [4 1] com.newrelic INFO: Setting audit_mode to false
app/web.1: Jun 29, 2020 11:38:36 +0000 [4 1] com.newrelic INFO: Setting protocol to "https"
app/web.1: Jun 29, 2020 11:38:36 +0000 [4 1] com.newrelic INFO: Agent class loader: com.newrelic.bootstrap.BootstrapAgent$JVMAgentClassLoader@25f38edc
app/web.1: Jun 29, 2020 11:38:36 +0000 [4 1] com.newrelic INFO: Premain startup complete in 10,888ms
app/web.1: Usage: java [-options] class [args...]
app/web.1: (to execute a class)
app/web.1: where options include:
app/web.1: -d32 use a 32-bit data model if available
app/web.1: -d64 use a 64-bit data model if available
app/web.1: -server to select the "server" VM
app/web.1: because you are running on a server-class machine.
app/web.1:
app/web.1:
app/web.1: -cp <class search path of directories and zip/jar files>
app/web.1: -classpath <class search path of directories and zip/jar files>
app/web.1: A : separated list of directories, JAR archives,
app/web.1: and ZIP archives to search for class files.
app/web.1: -D<name>=<value>
app/web.1: set a system property
app/web.1: -verbose:[class|gc|jni]
app/web.1: enable verbose output
app/web.1: -version print product version and exit
app/web.1: -version:<value>
app/web.1: Jun 29, 2020 11:38:37 +0000 [4 6] com.newrelic.agent.core.CoreServiceImpl INFO: JVM is shutting down
app/web.1: Jun 29, 2020 11:38:37 +0000 [4 6] com.newrelic.agent.core.CoreServiceImpl INFO: New Relic Agent has shutdown
heroku/web.1: State changed from starting to crashed
注意:我的应用程序生成war文件,而不是jar文件。所以我需要将jar转换为war文件吗?
答案 0 :(得分:1)
您只需要一种web
流程类型,如下所示:
web: java -javaagent:newrelic/newrelic.jar $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
或者,您可以使用-javaagent:newrelic/newrelic.jar
将JAVA_OPTS
添加到heroku config:set JAVA_OPTS="-javaagent:newrelic/newrelic.jar"
并使用
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war