【问题标题】:java newrelic agent throwing classnotfound exceptionjava newrelic 代理抛出 classnotfound 异常
【发布时间】:2026-01-25 04:05:02
【问题描述】:

我正在尝试在带有 tomcat 7 的 linux 机器上安装 newrelic。此安装没有 catalina.sh,因此无法使用 newrelic 安装程序。

我尝试了将 newrelic.jar 添加到 javaagent 中的 manula 方法,例如:

CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/share/tomcat7/newrelic/newrelic.jar"

但是每当我启动 tomcat 时,我都会收到以下 classnotfoundexception:

Unable to start New Relic agent: javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
        at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:106)
        at com.newrelic.agent.extension.dom.ExtensionDomParser.getTransformerFactory(ExtensionDomParser.java:360)
        at com.newrelic.agent.extension.dom.ExtensionDomParser.fixNamespace(ExtensionDomParser.java:337)
        at com.newrelic.agent.extension.dom.ExtensionDomParser.parseDocument(ExtensionDomParser.java:167)
        at com.newrelic.agent.extension.dom.ExtensionDomParser.readFile(ExtensionDomParser.java:152)
        at com.newrelic.agent.extension.ExtensionParsers$3.parse(ExtensionParsers.java:46)
        at com.newrelic.agent.extension.JarExtension.<init>(JarExtension.java:59)
        at com.newrelic.agent.extension.JarExtension.<init>(JarExtension.java:104)
        at com.newrelic.agent.extension.ExtensionService.initializeBuiltInExtensions(ExtensionService.java:388)
        at com.newrelic.agent.extension.ExtensionService.doStart(ExtensionService.java:145)
        at com.newrelic.agent.service.AbstractService.start(AbstractService.java:54)
        at com.newrelic.agent.service.ServiceManagerImpl.doStart(ServiceManagerImpl.java:124)
        at com.newrelic.agent.service.AbstractService.start(AbstractService.java:54)
        at com.newrelic.agent.Agent.premain(Agent.java:208)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:622)
        at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:117)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:622)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:343)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:358)
Caused by: java.lang.ClassNotFoundException: org/apache/xalan/processor/TransformerFactoryImpl
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at javax.xml.transform.FactoryFinder.getProviderClass(FactoryFinder.java:124)
        at javax.xml.transform.FactoryFinder.newInstance(FactoryFinder.java:179)

为此,我已尽我所能,但没有任何效果。我什至手动将 xalan jar 添加到 tomcat 库中,但没有运气

【问题讨论】:

    标签: java newrelic


    【解决方案1】:

    您需要确保已安装 xalan.jar。如果安装了它,它可能是在错误的地方。您可能需要在容器级别使用它,这是一篇讨论此问题的博客文章(tomcat5,但大多数建议仍应适用)。

    http://doookstechstuff.blogspot.com/2010/04/how-to-fix-tomcat5-on-rhel5.html

    【讨论】:

      【解决方案2】:

      确保您放置 xalan.jar 的位置在类路径中,并且您运行 tomcat 的用户帐户可以访问它。如果您已将其放入 tomcat /lib 文件夹,请确保 .jar 文件的权限与文件夹中的其他对象匹配。

      如果这有帮助,请告诉我们。如果您需要更多信息,最好通过 New Relic Support (http://support.newrelic.com) 创建票证。

      【讨论】: