java newrelic agent抛出classnotfound异常

时间:2014-03-10 15:11:22

标签: java newrelic

我正在尝试使用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 lib但没有运气

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分:0)

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

如果有帮助,请告诉我们。如果您需要其他信息,最好使用New Relic Support(http://support.newrelic.com)创建一张票。