Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在heroku procfile中设置java代理路径?_Java_Heroku_Newrelic_Javaagents_Procfile - Fatal编程技术网

如何在heroku procfile中设置java代理路径?

如何在heroku procfile中设置java代理路径?,java,heroku,newrelic,javaagents,procfile,Java,Heroku,Newrelic,Javaagents,Procfile,在我的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 wi

在我的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文件吗?

您只需要一种web进程类型,如下所示:

web:java-javaagent:newrelic/newrelic.jar$java_OPTS-jar target/dependency/webapp-runner.jar-port$port target/*.war

或者,您可以使用heroku config:set JAVA_OPTS=-javaagent:newrelic/newrelic.jar将-javaagent:newrelic/newrelic.jar添加到JAVA_OPTS中,并使用

web:java$java_OPTS-jar target/dependency/webapp-runner.jar-port$port target/*.war