我们遵循了newrelic安装指南中指定的步骤,以下是newrelic安装程序在catalina.sh中创建的条目:
# ---- New Relic switch automatically added to start command on 2013 Dec 09, 20:24:35
NR_JAR=/usr/share/fk-ops-tomcat6-base/newrelic/newrelic.jar; export NR_JAR
JAVA_OPTS="$JAVA_OPTS -javaagent:$NR_JAR"; export JAVA_OPTS在catalina.out中重启应用时出现异常:
Error bootstrapping New Relic agent: java.lang.RuntimeException: java.io.IOException: No such file or directory
java.lang.RuntimeException: java.io.IOException: No such file or directory
        at com.newrelic.bootstrap.BootstrapLoader.load(BootstrapLoader.java:95)
        at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:93)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.checkAndCreate(File.java:1704)
        at java.io.File.createTempFile(File.java:1792)
        at java.io.File.createTempFile(File.java:1828)
        at com.newrelic.bootstrap.BootstrapLoader.getJarFileInAgent(BootstrapLoader.java:81)
        at com.newrelic.bootstrap.BootstrapLoader.addBridgeJarToClassPath(BootstrapLoader.java:47)
        at com.newrelic.bootstrap.BootstrapLoader.load(BootstrapLoader.java:92)
        ... 7 more发布于 2014-07-23 17:52:53
我最近遇到了堆栈跟踪的异常,在我的例子中,它是由根本不存在的临时目录引起的。
具体地说:默认情况下,tomcat使用$CATALINA_BASE/temp作为java.io.tmpdir属性的值,并且似乎会在需要时创建它。当新的exist代理启动时,它可能还不存在,因此新的exist代理失败,并出现该异常。
重启后一切正常(现在目录存在了!),但是我在我的启动脚本中解决了: 1.将CATALINA_TMPDIR的值显式设置为我控制的值2.在启动tomcat之前确保该目录存在。
https://stackoverflow.com/questions/20474036
复制相似问题