Re: invoke jmxproxy servlet using argument with a , is not a possible

2020-03-24 Thread Luis Rodríguez Fernández
Hello Arnaud,

If jmxproxy does not work for you perhaps you can give a try to jolokia
[1]. It accepts JSON POST requests [2] that can implement your scenario.
The installation is quite straight-forward, simply deploy it as a .war or
attach it as an agent to your JVM.

Hope it helps,

Luis

[1] https://jolokia.org

[2] https://jolokia.org/reference/html/protocol.html#post-request










El mar., 24 mar. 2020 a las 9:36, Martin Grigorov ()
escribió:

> Hi,
>
> On Mon, Mar 23, 2020 at 7:08 PM Arnaud Yahoo 
> wrote:
>
> > Hello
> >
> > I am trying to invoke a mbean through jmxproxy servlet. Arguments are
> > separated with , so when one argument itself is containing a coma, it
> > breaks the invocation.
> >
> > It seems there is no way to escape ,.
> >
> > For example trying to save a context configuration fails :
> >
> > curl -u user:pass -G "http://localhost:8080/manager/jmxproxy/";
> > --data-urlencode "invoke=Catalina:type=StoreConfig" --data-urlencode
> > "op=storeContext" --data-urlencode
> >
> "ps=Catalina:j2eeType=WebModule,name=//localhost/myContext,J2EEApplication=none,J2EEServer=none,true,true"
> >
> >
>
>
> https://github.com/apache/tomcat/blob/b9aff64f78740235a5565004423be40cadc740ac/java/org/apache/catalina/manager/JMXProxyServlet.java#L240
> splits
> the parameters by comma and in your case it finds 5 parameters, while
> StoreConfig#storeContext(String, boolean, boolean) expects 3 parameters.
> Without improvements in the parsing code I think your case is not supported
> at the moment.
>
> Martin
>
>
> >
> > of course it works from jconsole.
> >
> > (By the way as an alternative I tried
> >
> > curl -u user:pass
> > http://localhost:8080/manager/text/save?path=/myContext but it fails
> with
> >
> > FAIL - Encountered exception [javax.management.MBeanException: Cannot
> > find operation store] )
> >
> > Arnaud
> >
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
> >
>


-- 

"Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better."

- Samuel Beckett


Re: invoke jmxproxy servlet using argument with a , is not a possible

2020-03-24 Thread Martin Grigorov
Hi,

On Mon, Mar 23, 2020 at 7:08 PM Arnaud Yahoo 
wrote:

> Hello
>
> I am trying to invoke a mbean through jmxproxy servlet. Arguments are
> separated with , so when one argument itself is containing a coma, it
> breaks the invocation.
>
> It seems there is no way to escape ,.
>
> For example trying to save a context configuration fails :
>
> curl -u user:pass -G "http://localhost:8080/manager/jmxproxy/";
> --data-urlencode "invoke=Catalina:type=StoreConfig" --data-urlencode
> "op=storeContext" --data-urlencode
> "ps=Catalina:j2eeType=WebModule,name=//localhost/myContext,J2EEApplication=none,J2EEServer=none,true,true"
>
>

https://github.com/apache/tomcat/blob/b9aff64f78740235a5565004423be40cadc740ac/java/org/apache/catalina/manager/JMXProxyServlet.java#L240
splits
the parameters by comma and in your case it finds 5 parameters, while
StoreConfig#storeContext(String, boolean, boolean) expects 3 parameters.
Without improvements in the parsing code I think your case is not supported
at the moment.

Martin


>
> of course it works from jconsole.
>
> (By the way as an alternative I tried
>
> curl -u user:pass
> http://localhost:8080/manager/text/save?path=/myContext but it fails with
>
> FAIL - Encountered exception [javax.management.MBeanException: Cannot
> find operation store] )
>
> Arnaud
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>