Skip Menu |

This queue is for tickets about the jmx4perl CPAN distribution.

Report information
The Basics
Id: 46328
Status: resolved
Priority: 0/
Queue: jmx4perl

People
Owner: roland [...] cpan.org
Requestors: jajohnso [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: problem with READ_ATTRIBUTE
When I create a new JMX::Jmx4Perl::Request such as: my $request = new JMX::Jmx4Perl::Request(READ_ATTRIBUTE,$mbean,$attribute); I recieve the following error: Invalid type 'READ_ATTRIBUTE' given (should be one of remnotif read regnotif list exec write) at ./jmx_test.pl line 14 The only way I found to resolve it is to substitute READ_ATTRIBUTE with "read" such as this: my $request = new JMX::Jmx4Perl::Request("read",$mbean,$attribute); The only reason I mention it is because it's listed as an example in the JMX::Jmx4Perl::Request POD. Module Version: 0.1 Perl Version: v5.10.0 built for x86_64-linux-gnu-thread-multi OS Info: Linux ubuntu64 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 x86_64 GNU/Linux
Hi, thanks for your report. The issue is, that you don't have use JMX::Jmx4Perl::Request; which imports the constants mentionend in the documentation. If you 'use strict' this would have been reported as an error. I confess, that the documentation is not very clear here. I'm going to fix this. Maybe I will move the constants to JMX::Jmx4Perl itself, so that the pakage import as mentioned above would become obsolete. Please let me know, if this works for you. Thanks for using Jmx4Perl, hope you like it ...
Hmm, as I just see, you already used JMX::Jmx4Perl::Request directly, so you already 'use'd it, I guess. Could you please post a short sample code, which exhibits the behaviour you described ?
Actually, you're absolutely correct. I hadn't loaded each of the modules - only JMX::Jmx4Perl and JMX::Jmx4Perl::Response, not JMX::Jmx4Perl::Request. If I do load them all, this code works fine: ---------------------------- #!/usr/bin/perl use strict; use JMX::Jmx4Perl; use JMX::Jmx4Perl::Response; use JMX::Jmx4Perl::Request; use JMX::Jmx4Perl::Agent; my $mbean = "JMImplementation:type=MBeanServerDelegate"; my $attribute = "ImplementationName"; my $jmx = new JMX::Jmx4Perl(url => "http://{Path to installed agent}/j4p-agent"); my $request = new JMX::Jmx4Perl::Request(READ_ATTRIBUTE,$mbean,$attribute); my $response = $jmx->request($request); print "Implementation Name: ",$response->value(),"\n"; ---------------------------- jim@ubuntu64:~$ ./jmx_test.pl Implementation Name: JMX Looks like I'm all set, I just think the documentation probably needs the module load area added to your example snippets. Thanks ... - Jim