FX Gendrin
FX Gendrin

Reputation: 11

[Azure][Application Insights agent for Java]java.lang.NoClassDefFoundError: http/RequestLine

After launch my jetty with applicationinsights-agent-1.0.6.jar as agent (See https://github.com/Azure/azure-content/blob/master/articles/application-insights/app-insights-java-agent.md), I get following stack trace. Remove the agent remove the stack trace.

I don't understand why it bother with "java.lang.NoClassDefFoundError: http/RequestLine", I found this class nowhere ...

Is someone has the same issue?

    java.lang.NoClassDefFoundError: http/RequestLine
    at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:1231)
    at com.microsoft.applicationinsights.internal.channel.common.ApacheSender43.<init>(ApacheSender43.java:52)
    at com.microsoft.applicationinsights.internal.channel.common.ApacheSenderFactory.create(ApacheSenderFactory.java:40)
    at com.microsoft.applicationinsights.internal.channel.common.TransmissionNetworkOutput.<init>(TransmissionNetworkOutput.java:95)
    at com.microsoft.applicationinsights.internal.channel.common.TransmissionNetworkOutput.create(TransmissionNetworkOutput.java:85)
    at com.microsoft.applicationinsights.channel.concrete.inprocess.InProcessTelemetryChannelFactory.create(InProcessTelemetryChannelFactory.java:41)
    at com.microsoft.applicationinsights.channel.concrete.inprocess.InProcessTelemetryChannel.initialize(InProcessTelemetryChannel.java:263)
    at com.microsoft.applicationinsights.channel.concrete.inprocess.InProcessTelemetryChannel.<init>(InProcessTelemetryChannel.java:147)
    at com.microsoft.applicationinsights.internal.config.TelemetryConfigurationFactory.setChannel(TelemetryConfigurationFactory.java:396)
    at com.microsoft.applicationinsights.internal.config.TelemetryConfigurationFactory.initialize(TelemetryConfigurationFactory.java:102)
    at com.microsoft.applicationinsights.TelemetryConfiguration.getActive(TelemetryConfiguration.java:74)
    at com.microsoft.applicationinsights.TelemetryClient.<init>(TelemetryClient.java:75)
    at com.microsoft.applicationinsights.internal.common.LogTelemetryClientProxy.<init>(LogTelemetryClientProxy.java:72)
    at com.microsoft.applicationinsights.log4j.v1_2.ApplicationInsightsAppender.activateOptions(ApplicationInsightsAppender.java:103)
    at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
    at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)
    at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
    at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
    at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
    at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
    at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1006)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:872)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:755)
    at org.apache.log4j.xml.XMLWatchdog.doOnChange(DOMConfigurator.java:1125)
    at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:89)
    at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:58)
    at org.apache.log4j.xml.XMLWatchdog.<init>(DOMConfigurator.java:1117)
    at org.apache.log4j.xml.DOMConfigurator.configureAndWatch(DOMConfigurator.java:735)
    at org.apache.log4j.xml.DOMConfigurator.configureAndWatch(DOMConfigurator.java:718)

Command line

    java -Djetty.home=/opt/servers/jetty -Djetty.base=/opt/servers/jetty-base  -Djava.awt.headless=true -Dfile.encoding=UTF-8  -javaagent:/opt/servers/jetty-base/lib/ext/applicationinsights-agent-1.0.6.jar -Djava.net.preferIPv4Stack=true -cp /opt/servers/jetty/start.jar org.eclipse.jetty.start.Main &

Upvotes: 0

Views: 1208

Answers (1)

Peter Pan
Peter Pan

Reputation: 24138

According to the exception java.lang.NoClassDefFoundError, it means some dependent libraries like httpclient were missed in the command line.

As to resolve it, you need to download the zip file of Application Insights SDK for Java from the page, and append them with the : delimiter to the tail of the option -cp.

Any concern, please feel free to let me know.

Upvotes: 1

Related Questions