[prev in list] [next in list] [prev in thread] [next in thread] 

List:       collectd
Subject:    Re: [collectd] Java plugin - Cannot find the API class "org.collectd.api.Collectd"
From:       Dan Scott <danieljamesscott () gmail ! com>
Date:       2013-10-31 14:26:31
Message-ID: CANQKhhku+F-ezRVXQY0onzwKmtWwr9K852SaQRqh1CYC76Ltaw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

I probably should have replied to myself a while back, but I managed to
figure this out.

Although I had installed JRE 7 and JDK 7, I had only switched my system
defaults to use JRE 7, my JAVA_HOME was still pointing at version 6.

After I used 'alternatives' to switch to JDK7, everything worked correctly.

I think that the actual error message indicating the problem was lost in
stderr because I was running collectd using an initscript.

Thanks,

Dan Scott



On 31 October 2013 13:56, Franklin, Dave <Dave.Franklin@arrisi.com> wrote:

>  A few things I can think of off the top of my head:****
>
> ** **
>
> It would be interesting to see what the log output is with DEBUG cranked
> up - it should show all the JVM args passed in before the JVM is created.
> ****
>
> Also I see you're logged in as root - is collectd running with sufficient
> permissions? ****
>
> Can you confirm the class is actually in the jar file: jar tf
> /usr/share/collectd/java/collectd-api.jar ****
>
> ** **
>
> =D****
>
> ** **
>
> Dave Franklin****
>
> Principal Software Engineer****
>
> Arris Group, Inc. - T1-9****
>
> 900 Chelmsford Street****
>
> Lowell, MA 01851****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> *From:* collectd-bounces@verplant.org [mailto:
> collectd-bounces@verplant.org] *On Behalf Of *Dan Scott
> *Sent:* Wednesday, September 18, 2013 9:37 AM
> *To:* collectd@verplant.org
> *Subject:* [collectd] Java plugin - Cannot find the API class
> "org.collectd.api.Collectd"****
>
> ** **
>
> Hi,****
>
> ** **
>
> I'm running collectd 5.04 on AWS:****
>
> ** **
>
> collectd-5.0.4-1.19.amzn1.x86_64****
>
> collectd-java-5.0.4-1.19.amzn1.x86_64****
>
> ** **
>
> I'm trying to get the java plugin working to monitor tomcat. I have a
> config file as follows:****
>
> ** **
>
> LoadPlugin java****
>
> ** **
>
> <Plugin "java">****
>
>         JVMARG
> "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar:/usr/share/collectd/java/generic-jmx.jar"
> ****
>
> ** **
>
>         LoadPlugin "org.collectd.java.GenericJMX"****
>
>         <Plugin "GenericJMX">****
>
> # Heap memory usage****
>
> <MBean "memory-heap">****
>
>   ObjectName "java.lang:type=Memory"****
>
>   InstancePrefix "memory-heap"****
>
>   <Value>****
>
>     Type "jmx_memory"****
>
>     Table true****
>
>     Attribute "HeapMemoryUsage"****
>
>   </Value>****
>
> </MBean>****
>
> ** **
>
>     <Connection>****
>
>       Host "localhost"****
>
>       ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:17264/jmxrmi"***
> *
>
>       Collect "memory_pool"****
>
>     </Connection>****
>
>     </Plugin>****
>
> </Plugin>****
>
> ** **
>
> The log file says: Cannot find the API class "org.collectd.api.Collectd".
> Please set the correct class path using 'JVMArg "-Djava.class.path=..."'**
> **
>
> ** **
>
> But as you can see, I already have this line added. The jar files exist
> and contain the correct classes:****
>
> ** **
>
> [root@localhost ~]# rpm -ql collectd-java****
>
> /etc/collectd.d/java.conf****
>
> /usr/lib64/collectd/java.so****
>
> /usr/share/collectd/java/collectd-api.jar****
>
> /usr/share/collectd/java/generic-jmx.jar****
>
> ** **
>
> Can anyone help?****
>
> ** **
>
> Thanks,****
>
> ** **
>
> Dan Scott****
>

[Attachment #5 (text/html)]

<div dir="ltr">Hi,<div><br></div><div>I probably should have replied to myself a \
while back, but I managed to figure this out.</div><div><br></div><div>Although I had \
installed JRE 7 and JDK 7, I had only switched my system defaults to use JRE 7, my \
JAVA_HOME was still pointing at version 6.</div>

<div><br></div><div>After I used &#39;alternatives&#39; to switch to JDK7, everything \
worked correctly.</div><div><br></div><div>I think that the actual error message \
indicating the problem was lost in stderr because I was running collectd using an \
initscript.</div>

<div><br></div><div>Thanks,</div><div><br></div><div>Dan \
Scott</div><div><br></div></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On 31 October 2013 13:56, Franklin, Dave <span dir="ltr">&lt;<a \
href="mailto:Dave.Franklin@arrisi.com" \
target="_blank">Dave.Franklin@arrisi.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">A \
few things I can think of off the top of my head:<u></u><u></u></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">It \
would be interesting to see what the log output is with DEBUG cranked up - it should \
show all the JVM args passed in before the JVM is created. <u></u><u></u></span></p>
<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Also \
I see you're logged in as root - is collectd running with sufficient permissions? \
<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Can \
you confirm the class is actually in the jar file: jar tf \
/usr/share/collectd/java/collectd-api.jar <u></u><u></u></span></p>
<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">=D<u></u><u></u></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Dave \
Franklin<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Principal \
Software Engineer<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Arris \
Group, Inc. - T1-9<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">900 \
Chelmsford Street<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Lowell, \
MA 01851<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><b><span \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a \
href="mailto:collectd-bounces@verplant.org" \
target="_blank">collectd-bounces@verplant.org</a> [mailto:<a \
href="mailto:collectd-bounces@verplant.org" \
target="_blank">collectd-bounces@verplant.org</a>] <b>On Behalf Of </b>Dan Scott<br>
<b>Sent:</b> Wednesday, September 18, 2013 9:37 AM<br>
<b>To:</b> <a href="mailto:collectd@verplant.org" \
target="_blank">collectd@verplant.org</a><br> <b>Subject:</b> [collectd] Java plugin \
- Cannot find the API class \
&quot;org.collectd.api.Collectd&quot;<u></u><u></u></span></p><div><div class="h5"> \
<p class="MsoNormal"><u></u>  <u></u></p> <div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">I&#39;m running collectd 5.04 on AWS:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">collectd-5.0.4-1.19.amzn1.x86_64<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">collectd-java-5.0.4-1.19.amzn1.x86_64<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">I&#39;m trying to get the java plugin working to monitor tomcat. \
I have a config file as follows:<u></u><u></u></p> </div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">LoadPlugin java<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">&lt;Plugin &quot;java&quot;&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            JVMARG \
&quot;-Djava.class.path=/usr/share/collectd/java/collectd-api.jar:/usr/share/collectd/java/generic-jmx.jar&quot;<u></u><u></u></p>
 </div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">            LoadPlugin \
&quot;org.collectd.java.GenericJMX&quot;<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">            &lt;Plugin \
&quot;GenericJMX&quot;&gt;<u></u><u></u></p> </div>
<div>
<p class="MsoNormal"># Heap memory usage<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">&lt;MBean &quot;memory-heap&quot;&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">   ObjectName \
&quot;java.lang:type=Memory&quot;<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">   InstancePrefix &quot;memory-heap&quot;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">   &lt;Value&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">      Type &quot;jmx_memory&quot;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">      Table true<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">      Attribute &quot;HeapMemoryUsage&quot;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">   &lt;/Value&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">&lt;/MBean&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">      &lt;Connection&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">         Host &quot;localhost&quot;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">         ServiceURL \
&quot;service:jmx:rmi:///jndi/rmi://localhost:17264/jmxrmi&quot;<u></u><u></u></p> \
</div> <div>
<p class="MsoNormal">         Collect &quot;memory_pool&quot;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">      &lt;/Connection&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">      &lt;/Plugin&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">&lt;/Plugin&gt;<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">The log file says:  Cannot find the API class \
&quot;org.collectd.api.Collectd&quot;. Please set the correct class path using \
&#39;JVMArg &quot;-Djava.class.path=...&quot;&#39;<u></u><u></u></p> </div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">But as you can see, I already have this line added. The jar \
files exist and contain the correct classes:<u></u><u></u></p> </div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">[root@localhost ~]# rpm -ql collectd-java<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">/etc/collectd.d/java.conf<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">/usr/lib64/collectd/java.so<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">/usr/share/collectd/java/collectd-api.jar<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">/usr/share/collectd/java/generic-jmx.jar<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">Can anyone help?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">Dan Scott<u></u><u></u></p>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>



_______________________________________________
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic