You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Arnaud Yahoo <a_...@yahoo.fr.INVALID> on 2020/03/23 17:07:53 UTC

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

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" 


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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


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

Posted by Luis Rodríguez Fernández <uo...@gmail.com>.
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
<https://jolokia.org/reference/html/protocol.html#post-request>
[2] https://jolokia.org/reference/html/protocol.html#post-request










El mar., 24 mar. 2020 a las 9:36, Martin Grigorov (<mg...@apache.org>)
escribió:

> Hi,
>
> On Mon, Mar 23, 2020 at 7:08 PM Arnaud Yahoo <a_...@yahoo.fr.invalid>
> 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-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@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

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, Mar 23, 2020 at 7:08 PM Arnaud Yahoo <a_...@yahoo.fr.invalid>
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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>