Hi Till,

I know the MBean Naming convention but I don’t understand why cant just change 
the MBean class to have the Name as the Class + MBean added on, so 
TriggeredScraperImplMBean?
As this should work based on the spec, not?

J

Am 27.08.19, 11:30 schrieb "Till Voß" <till.v...@codecentric.de>:

    Hey,
    
    i just checked it and it doesn't work with the class name
    "TriggeredScraperImplMBean". The exception only disappears, if the class is
    named "TriggeredScraper".
    
    After a short research i found the following convention: "By convention, an
    MBean interface takes the name of the Java class that implements it, with
    the suffix MBean added"
    (see https://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html).
    
    Till
    
    
    
    
    
    Am Di., 27. Aug. 2019 um 11:01 Uhr schrieb Julian Feinauer <
    j.feina...@pragmaticminds.de>:
    
    > This would be my preferred solution as Tim just renamed the Scraper to
    > their current Name.
    >
    > Julian
    >
    > Am 27.08.19, 10:01 schrieb "Till Voß" <till.v...@codecentric.de>:
    >
    >     Hi Julian,
    >
    >     yes, that also works.
    >
    >     Regards,
    >     Till
    >
    >     Am Di., 27. Aug. 2019 um 09:34 Uhr schrieb Julian Feinauer <
    >     j.feina...@pragmaticminds.de>:
    >
    >     > Hi Till,
    >     >
    >     > good pointer.
    >     > This was in issue with two parallel branches (mine and Tims).
    >     >
    >     > I would rather Opt for Renaming the MBean to
    > TriggeredScraperImplMBean.
    >     >
    >     > This should also work, or?
    >     >
    >     > Julian
    >     >
    >     > Am 27.08.19, 09:24 schrieb "Till Voß" <till.v...@codecentric.de>:
    >     >
    >     >     Hi all,
    >     >
    >     >
    >     >
    >     >     currently i am developing a plc4x logstash plugin and i have an
    > issue
    >     > with
    >     >     the TriggeredScraper.
    >     >
    >     >     The TriggeredScraperImpl implements the interface
    >     > "TriggeredScraperMBean".
    >     >     The File "TriggeredScraperImpl.java" contains line 163
    >     >     "mBeanServer.registerMBean(this, new ObjectName(MX_DOMAIN,
    > "scraper",
    >     >     "scraper"));", which leads to the following exception:
    >     >
    >     >
    >     >
    >     >     >
    >     >     > *09:05:26.915 [main] DEBUG
    >     >     >
    > org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl -
    >     >     > Unable to register Scraper as MBean*
    >     >     > *javax.management.NotCompliantMBeanException: MBean class
    >     >     >
    > org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl
    >     > does
    >     >     > not implement DynamicMBean, and neither follows the Standard
    > MBean
    >     >     > conventions (javax.management.NotCompliantMBeanException: 
Class
    >     >     >
    > org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl
    >     > is not
    >     >     > a JMX compliant Standard MBean) nor the MXBean conventions
    >     >     > (javax.management.NotCompliantMBeanException:
    >     >     >
    > org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl:
    >     > Class
    >     >     >
    > org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl
    >     > is not
    >     >     > a JMX compliant MXBean)*
    >     >     > *              at
    >     >     >
    >     >
    > 
java.management/com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:177)*
    >     >     > *              at
    >     >     >
    >     >
    > 
java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:313)*
    >     >     > *              at
    >     >     >
    >     >
    > 
java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)*
    >     >     > *              at
    >     >     >
    >     >
    > 
org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl.<init>(TriggeredScraperImpl.java:163)*
    >     >     > *              at
    >     >     >
    >     >
    > 
org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl.<init>(TriggeredScraperImpl.java:134)*
    >     >     > *              at
    >     >     >
    >     >
    > 
org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl.<init>(TriggeredScraperImpl.java:96)*
    >     >     > *              at
    >     > org.apache.plc4x.logstash.Plc4x.start(Plc4x.java:116)*
    >     >     > *              at
    >     >     >
    >     >
    > 
org.apache.plc4x.logstash.Plc4xInputTest.testPlc4xInput(Plc4xInputTest.java:51)*
    >     >     > *              at
    >     >     >
    >     >
    > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
    >     >     > Method)*
    >     >     > *              at
    >     >     >
    >     >
    > 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)*
    >     >     > *              at
    >     >     >
    >     >
    > 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)**
    >     >     > ....*
    >     >
    >     >
    >     >
    >     >     This means the Standard MBean naming convention is violated. My
    >     > proposed
    >     >     fix is to refactor the class name from "TriggeredScraperImpl" to
    >     >     "TriggeredScraper" to fulfil the naming conventions. What do you
    > think?
    >     >
    >     >
    >     >
    >     >     Best regards
    >     >
    >     >     Till
    >     >
    >     >
    >     >
    >     >
    >     >
    >     >     --
    >     >     Till Voß
    >     >
    >     >     codecentric AG | Kreuznacher Straße 30 | 60486 Frankfurt am Main
    > |
    >     >     Deutschland
    >     >     mobil: +49 151 643 305 40 | fax: +49 69 714 02 682
    >     >
    >     >     Sitz der Gesellschaft: Solingen | HRB 25917 | Amtsgericht
    > Wuppertal
    >     >     Vorstand: Michael Hochgürtel . Rainer Vehns . Ulrich Kühn
    >     >     Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Klaus Jäger .
    > Jürgen
    >     > Schütz
    >     >
    >     >
    >     >
    >
    >     --
    >     Till Voß
    >
    >     codecentric AG | Kreuznacher Straße 30 | 60486 Frankfurt am Main |
    >     Deutschland
    >     mobil: +49 151 643 305 40 | fax: +49 69 714 02 682
    >
    >     Sitz der Gesellschaft: Solingen | HRB 25917 | Amtsgericht Wuppertal
    >     Vorstand: Michael Hochgürtel . Rainer Vehns . Ulrich Kühn
    >     Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Klaus Jäger . Jürgen
    > Schütz
    >
    >
    >
    
    -- 
    Till Voß
    
    codecentric AG | Kreuznacher Straße 30 | 60486 Frankfurt am Main |
    Deutschland
    mobil: +49 151 643 305 40 | fax: +49 69 714 02 682
    
    Sitz der Gesellschaft: Solingen | HRB 25917 | Amtsgericht Wuppertal
    Vorstand: Michael Hochgürtel . Rainer Vehns . Ulrich Kühn
    Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Klaus Jäger . Jürgen Schütz
    

Reply via email to