stagemonitor / stagemonitor-mailinglist

GitHub issues abused as a mailing list
3 stars 0 forks source link

Spring MVC Plugin Issues #40

Closed gvatreya closed 7 years ago

gvatreya commented 7 years ago

Tried to use the following plugins

Excerpt from Pom.xml

                <stagemonitor.version>0.31.0</stagemonitor.version>
        <stagemonitor-javaagent.version>0.22.0</stagemonitor-javaagent.version>
        <stagemonitor-spring-mvc.version>0.12.0</stagemonitor-spring-mvc.version>
...
        <!-- Stage Monitor -->
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-core</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-web</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-requestmonitor</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-jvm</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-jdbc</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-logging</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-dispatcher</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-alerting</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-javaagent</artifactId>
            <version>${stagemonitor-javaagent.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-os</artifactId>
            <version>${stagemonitor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.stagemonitor</groupId>
            <artifactId>stagemonitor-spring-mvc</artifactId>
            <version>${stagemonitor-spring-mvc.version}</version>
        </dependency>

Using the last plugin, stagemonitor-spring-mvc throws the "Config registered twice" error. If I remove this plugin, there are no errors, and the application runs as it purports to be.

On Debugging, This is what I understood - the core plugin registers stagemonitor.requestmonitor.spring.monitorOnlySpringMvcRequests first and then when the stagemonitor-spring-mvc plugin tries to register it again, there is an error. Is this understanding correct? Does it mean that the core plugin and spring-mvc plugin are to be used in mutual exclusion? Am I misunderstanding something?

I have looked at the Pet Clinic sample, I donot see it using the spring-mvc plugin. I have followed the Installation steps mentioned here.

How Can I debug further? Can anyone suggest me on further steps? Thank you

Error Stack Trace

[ERROR] [RMI TCP Connection(2)-127.0.0.1] [2017-03-10 11:45:45] [core.Stagemonitor] [The configuration key stagemonitor.requestmonitor.spring.monitorOnlySpringMvcRequests is registered twice. Once for Monitor only SpringMVC requests and once for Monitor only SpringMVC requests.]
java.lang.IllegalArgumentException: The configuration key stagemonitor.requestmonitor.spring.monitorOnlySpringMvcRequests is registered twice. Once for Monitor only SpringMVC requests and once for Monitor only SpringMVC requests.
    at org.stagemonitor.core.configuration.Configuration.add(Configuration.java:143)
    at org.stagemonitor.core.configuration.Configuration.registerOptionProvider(Configuration.java:113)
    at org.stagemonitor.core.configuration.Configuration.registerConfigurationOptions(Configuration.java:106)
    at org.stagemonitor.core.configuration.Configuration.<init>(Configuration.java:101)
    at org.stagemonitor.core.configuration.Configuration.<init>(Configuration.java:87)
    at org.stagemonitor.core.Stagemonitor.reloadPluginsAndConfiguration(Stagemonitor.java:272)
    at org.stagemonitor.core.Stagemonitor.reset(Stagemonitor.java:251)
    at org.stagemonitor.core.Stagemonitor.<clinit>(Stagemonitor.java:41)
    at org.stagemonitor.web.WebPlugin.<clinit>(WebPlugin.java:56)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:274)
    at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:181)
    at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:151)
    at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1599)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1128)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5095)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1585)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I am attaching the screenshots for reference.

false stack-trace true

felixbarny commented 7 years ago

The spring mvc plugin is discontinued as the web plugin auto discovers spring mvc. Generally, dont mix different stagemonitor versions. Also, remove the dependency to stagemonitor javaagent. Did you read something in the docs which lead you to adding these dependencies?

gvatreya commented 7 years ago

I wasn't aware that the spring MVC plugin is deprecated in favor of the web plugin. I donot recollect reading about it being discontinued in the documentation https://github.com/stagemonitor/stagemonitor/wiki. I shall re-visit the doc to understand better.

Thank you Felix.

Sent from a mobile device, kindly excuse the typos and brevity.

On 10-Mar-2017 9:54 pm, "Felix" notifications@github.com wrote:

The spring mvc plugin is discontinued as the web plugin auto discovers spring mvc. Generally, dont mix different stagemonitor versions. Also, remove the dependency to stagemonitor javaagent. Did you read something in the docs which lead you to adding these dependencies?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stagemonitor/stagemonitor-mailinglist/issues/40#issuecomment-285674161, or mute the thread https://github.com/notifications/unsubscribe-auth/AG1XH-5Xq52B5IUKZUB8pA2TayL9U02gks5rkVX_gaJpZM4MZUn1 .

felixbarny commented 7 years ago

Where did you read about the spring-mvc plugin in the first place? If this is still in the documentation, I should remove it.

gvatreya commented 7 years ago

I believe that I misunderstood when I saw the heading Spring MVC Plugin https://github.com/stagemonitor/stagemonitor/wiki/Configuration-Options#spring-mvc-plugin under Configuration Options https://github.com/stagemonitor/stagemonitor/wiki/Configuration-Options heading. The wordings - "Stagemonitor is plug-in based agent and not all plugins are included by default. " , made me believe that I will have to include the java-agent and spring-mvc plugins for the metrics I was looking for.

Also, the installation Step 1 heading, Include Optional Plugins https://github.com/stagemonitor/stagemonitor/wiki/Step-1%3A-In-Browser-Widget#include-optional-plugins, has a link listing all the available plugins http://search.maven.org/#search%7Cga%7C1%7Corg.stagemonitor, reinforced my belief that I will need the spring-mvc plugin and the java-agent.

On Fri, Mar 10, 2017 at 9:38 PM, Felix notifications@github.com wrote:

Where did you read about the spring-mvc plugin in the first place? If this is still in the documentation, I should remove it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stagemonitor/stagemonitor-mailinglist/issues/40#issuecomment-285709665, or mute the thread https://github.com/notifications/unsubscribe-auth/AG1XH5x64bWkGj1DJKp_cxhUOc1JYNNYks5rkXWFgaJpZM4MZUn1 .

felixbarny commented 7 years ago

Thx for the feedback. I've updated the guide: https://github.com/stagemonitor/stagemonitor/wiki/Step-1:-In-Browser-Widget#include-optional-plugins

gvatreya commented 7 years ago

Thank you. We can now mark this ticket as resolved, I guess.