[collectd] Java plugin can't find our classes

Nicholas Sterling nsterling at coraid.com
Thu Feb 21 21:34:22 CET 2013


Hi, folks.  We are first-time users of collectd, trying to write a Java plugin to collect some data.  So far we can't seem to get the Java plugin to find our classes; we get this error:

      java plugin: cjni_config_load_plugin: FindClass (com/coraid/cms/pe/HBAMetrics) failed.
      java plugin: Configuration block for `HBAMetrics' found, but no such configuration callback has been registered. Please make sure, the `LoadPlugin' lines precede the `Plugin' blocks.

We have tried many things to get around this, but nothing works. What are we missing?  Presumably the above means that the Java plugin cannot find our class on the classpath specified in java.class.path, but we think we've set it up correctly.  Our config block for the plugin looks like this:

    <Plugin "java">
         JVMArg "-verbose:jni"
         JVMArg "-Djava.class.path=/opt/collectd/share/collectd/java/coraid-plugin.jar:/opt/collectd/share/collectd/java/collectd-api.jar"
         LoadPlugin "com/coraid/cms/pe/HBAMetrics"
         <Plugin "HBAMetrics">
         </Plugin>
    </Plugin>

Here's the JAR file:

    # pwd
    /opt/collectd/share/collectd/java

    # ls
    collectd-api.jar  coraid-plugin.jar  generic-jmx.jar

    # jar tf coraid-plugin.jar
    META-INF/
    META-INF/MANIFEST.MF
    com/
    com/coraid/
    com/coraid/cms/
    com/coraid/cms/pe/
    com/coraid/cms/pe/MetricData.class
    com/coraid/cms/pe/HBAMetrics.class

And here is the HBAMetrics class:

    # jar xf coraid-plugin.jar com/coraid/cms/pe/HBAMetrics

    # javap com.coraid.cms.pe.HBAMetrics
    Compiled from "HBAMetrics.java"
    public class com.coraid.cms.pe.HBAMetrics implements org.collectd.api.CollectdConfigInterface,org.collectd.api.CollectdInitInterface,org.collectd.api.CollectdReadInterface,org.collectd.api.CollectdShutdownInterface {
       public static final java.lang.String PLUGIN_NAME;
       public com.coraid.cms.pe.HBAMetrics();
       public int config(org.collectd.api.OConfigItem);
       public int init();
       public int read();
       public int shutdown();
    }

Thanks for any help with this urgent (for us) problem.

Nicholas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20130221/59de61cc/attachment.html>


More information about the collectd mailing list