Hi Sergey:
Here are what I had and although the output maybe simple, I checked outputs and they look alright, need your opinions:) 1. Request URL: this is from searching part of endpoint service="{http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl"; http://localhost:8080/demoserver/jaxserver/jmxserver/service/impl.service.ws.gsoc.cxf.apache.org Response: <CxfMBeanCollection> <CxfMBeans> <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="CustomerServiceImpl",service="{http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> <endpointName>"{http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl";</endpointName> </CxfMBean> <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="JaxRsJMXServiceImpl",service="{http://impl.service.ws.gsoc.cxf.apache.org/}JaxRsJMXServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> <endpointName>"{http://impl.service.ws.gsoc.cxf.apache.org/}JaxRsJMXServiceImpl";</endpointName> </CxfMBean> <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="UserServiceImpl",service="{http://impl.service.ws.gsoc.cxf.apache.org/}UserServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> <endpointName>"{http://impl.service.ws.gsoc.cxf.apache.org/}UserServiceImpl";</endpointName> </CxfMBean> </CxfMBeans> </CxfMBeanCollection> 2. Request: search port="UserServiceImpl" http://localhost:8080/demoserver/jaxserver/jmxserver/port/"UserServiceImpl"; Response: <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="UserServiceImpl",service="{http://impl.service.ws.gsoc.cxf.apache.org/}UserServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> <endpointName>"UserServiceImpl"</endpointName> </CxfMBean> 3. Request: search by ObjectName("*******") http://localhost:8080/demoserver/jaxrs3/jmx/component/org.apache.cxf:type=Bus.Service.Endpoint,* Response: <CxfMBeanCollection> <CxfMBeans> <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="JaxRsJMXServiceImpl",service="{http://impl.service.ws.gsoc.cxf.apache.org/}JaxRsJMXServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> </CxfMBean> <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="JMXServer",service="{http://web.management.gsoc.cxf.apache.org/}JMXServer",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> </CxfMBean> <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="CustomerServiceImpl",service="{http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> </CxfMBean> <CxfMBean> <canonicalName>org.apache.cxf:bus.id=cxf568097598,port="UserServiceImpl",service="{http://impl.service.ws.gsoc.cxf.apache.org/}UserServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> </CxfMBean> </CxfMBeans> </CxfMBeanCollection> My current inbound config (): <!-- JAX-WS Service Endpoint --> <jaxws:endpoint id="personService" implementor="#personServ" address="/PersonService"> <jaxws:inInterceptors> <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" /> <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> <constructor-arg> <map> <entry key="action" value="UsernameToken" /> <entry key="passwordType" value="PasswordText" /> <entry key="passwordCallbackClass" value="org.apache.cxf.gsoc.ws.auth.ServerPasswordCallback" /> </map> </constructor-arg> </bean> </jaxws:inInterceptors> </jaxws:endpoint> <bean id="instrumentationManager" class="org.apache.cxf.management.jmx.InstrumentationManagerImpl"> <property name="bus" ref="cxf" /> <property name="enabled" value="true" /> <property name="JMXServiceURL" value="service:jmx:rmi:///jndi/rmi://localhost:9914/jmxrmi" /> </bean> <!-- Wiring the counter repository --> <bean id="counterRepository" class="org.apache.cxf.management.counters.CounterRepository"> <property name="bus" ref="cxf" /> </bean> <!-- JAX-RS Server 1 --> <jaxrs:server id="userServiceRs" address="/jaxrs1"> <jaxrs:serviceBeans> <ref bean="userService" /> </jaxrs:serviceBeans> </jaxrs:server> <!-- JAX-RS Server 2 --> <jaxrs:server id="customerServiceRs" address="/jaxrs2"> <jaxrs:serviceBeans> <ref bean="customerService" /> </jaxrs:serviceBeans> </jaxrs:server> <!-- JAX-RS Server 3: This is the old jmx inbound, haven't deleted, but will do --> <jaxrs:server id="jmxServiceRs" address="/jaxrs3"> <jaxrs:serviceBeans> <ref bean="jmxService" /> </jaxrs:serviceBeans> </jaxrs:server> <!-- CXF3388: Expose JMXServer: Current testing inbound.--> <jaxrs:server id="jmxServerRs" address="/jaxserver"> <jaxrs:serviceBeans> <ref bean="jmxServer" /> </jaxrs:serviceBeans> </jaxrs:server> <!-- This jmxServer should be exposed to jax-rs which should be separated from other service endpoints --> <bean id="jmxServer" class="org.apache.cxf.gsoc.management.web.JMXServer"> <property name="managedJaxRsEndpoints"> <list> <ref bean="userServiceRs"/> <ref bean="customerServiceRs"/> </list> </property> <property name="managedJaxWsEndpoints"> <list> <ref bean="personService"/> </list> </property> <property name="managedEndpoints"> <list> <value>{http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl</value> <value>{http://web.management.gsoc.cxf.apache.org/}JMXServer</value> <value>{http://impl.service.ws.gsoc.cxf.apache.org/}UserServiceImpl</value> <value>{http://impl.service.ws.gsoc.cxf.apache.org/}JaxRsJMXServiceImpl</value> </list> </property> <property name="instrumentationManager" ref="instrumentationManager"/> </bean> <bean id="userService" class="org.apache.cxf.gsoc.ws.service.impl.UserServiceImpl" /> <bean id="customerService" class="org.apache.cxf.gsoc.ws.service.impl.CustomerServiceImpl" /> <bean id="jmxService" class="org.apache.cxf.gsoc.ws.service.impl.JaxRsJMXServiceImpl" /> I am planning to use this weekend, clean this config and code up, and make Rest request url shorter as you mentioned. I need your suggestions and ideas. and I think I am ready for a big surgery on the demoserver. Code is still in https://dabaip...@github.com/dabaipang/demoserver.git Also, I will go to supermarket and find a scanner for the NDS Thank you very much! Regards: Shenglin Qiu > Date: Fri, 13 May 2011 11:11:51 +0100 > Subject: Re: Expose MBeans in CXF > From: sberyoz...@gmail.com > To: dev@cxf.apache.org > > Hi > > On Fri, May 13, 2011 at 1:19 AM, Shenglin Qiu <dabaip...@hotmail.com> wrote: > > > > Hi Sergey: > > > > Here is the todo list which you have assigned: > > > > 1. Have one JAX-WS and JAX-RS endpoints > > 2. Have your JMXServer as a separate endpoint > > 3. Injecting a bus reference and registering a listener > > > > Your Tips: > > 1. > > In > > the method where bus is injected, get ServerLifeCycleManager.class > > extension from the bus and register your own ServerLifeCycleListener > > impl > > , it has methods such as startServer and stopServer, in > > startServer(Server server) you can do > > server.getEndpoint().getService().getQName(), > > and keep these QNames > > in the local list and have a method say getManagedEndpoints() which will > > return the list of those QNames that will be a good start > > > > 2. > >> <bean class="org.apache.cxf.management.web.JMXServer"> > >> ? ?<property name="managedEndpoints"> > >> ? ? ? ? <list> > >> ? ? ? ? ? ?<value>{http://users.com/rs}UserService</value> > >> ? ? ? ? ? ?<value>{http://users.com/ws}UserService</value> > >> ? ? ? ? </list> > >> ? ?</property> > >> ? ?<property name="manager" ref="instrumentationManager"/> > >> </bean> > > but ?<property name="managedEndpoints"> can be dropped, you can get this > > list from the bus > > > > > > Currently, I have finished on Step 1 and 2, and you have told me that put > > step 3 on hold, and make sure JMXServer as a separated enpoint is correct > > OK. I don't understand what you've done so far, what decisions have > been made to do with making sure that > - list of managed endpoints is returned > - all MBean representations for all the endpoints are returned, > - MBeans related to an individual endpoint are returned > > Can you please describe what you've done ? > > > I am actually stopped at this GET request: > > I tried: > > http://localhost:8080/demoserver/jaxserver/jmxserver/service/{http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl > > And obviously it doesn't work because of the slash in url is not accepted. > > (I still didn't find a reasonable answer from searching google, shocking) > > > Shenglin, you are obviously very well prepared technically but you > need to change the approach and do it asap. Why do you expect Google > to tell you why the above URI does not work ? > > That URI seems too long anyway > > http://localhost:8080/demoserver/jmx?service={http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl > > Is the max really and in this particular case I'm presuming this query > is about getting the list of MBeans reps for a particular managed > service. Perhaps in the future we can allocate dynamic subresources > instead for handling endpoint specific MBeans to make URIs shorter for > this particular case. > > > > > > Then I reserve slash to back slash and got 500 errors: > > http://localhost:8080/demoserver/jaxserver/jmxserver/service/{http:\\impl.service.ws.gsoc.cxf.apache.org\}CustomerServiceImpl > > => There is a 500 error from CXF > > here is the exception stacktrace: > > > > 2011-05-12 > > 20:00:48.657:WARN::/demoserver/jaxserver/jmxserver/service/%7Bhttp:%5 > > C%5Cimpl.service.ws.gsoc.cxf.apache.org%5C%7DCustomerServiceImpl > > java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Unexpected > > interna > > l error near index 1<|\<| ^ > > at > > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMess > > age(AbstractFaultChainInitiatorObserver.java:102) > > at > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept > > orChain.java:303) > > at > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti > > ationObserver.java:113) > > at > > org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDes > > tination.java:97) > > at > > org.apache.cxf.transport.servlet.ServletController.invokeDestination( > > ServletController.java:458) > > at > > org.apache.cxf.transport.servlet.ServletController.invoke(ServletCont > > roller.java:146) > > at > > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCX > > FServlet.java:148) > > at > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Ab > > stractHTTPServlet.java:179) > > at > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHT > > TPServlet.java:108) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) > > at > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(Abstract > > HTTPServlet.java:159) > > at > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511 > > ) > > at > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3 > > 90) > > at > > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav > > a:216) > > at > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1 > > 82) > > at > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7 > > 65) > > at > > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440) > > > > at > > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHand > > lerCollection.java:230) > > at > > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection. > > java:114) > > at > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1 > > 52) > > at org.mortbay.jetty.Server.handle(Server.java:326) > > at > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:54 > > 2) > > at > > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpCo > > nnection.java:926) > > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) > > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) > > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) > > at > > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja > > va:410) > > at > > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.j > > ava:582) > > > > > > Any suggestions? > > Please understand how CXF JAX-RS handles requests, don't try changing > "/" to "\\" and hope it will work > > > > > Currently I can do the following: > > http://localhost:8080/demoserver/jaxrs3/jmx/component/org.apache.cxf:type=Bus.Service.Endpoint,* > > => get Mbean by ObjectName query > > What is "/jaxrs3" ? Are you really sure your JMXServer endpoint is separate ? > > > http://localhost:8080/demoserver/jaxserver/jmxserver/list > > => get all Mbeans by > > ObjectName('*:type=*,*') which query is *:type=*,* > > should be just > > http://localhost:8080/demoserver/jmx/list > > > http://localhost:8080/demoserver/jaxserver/jmxserver/type/Bus.Service.Endpoint > > => get Mbean by type > > http://localhost:8080/demoserver/jaxserver/jmxserver/port/%22UserServiceImpl%22 > > => get Mbean by service, %22 is an issue > > which I can't get rid of it, still working on it. > > http://localhost:8080/demoserver/jaxserver/jmxserver/service/impl.service.ws.gsoc.cxf.apache.org > > => get Mbean by part of service such as > > {http://impl.service.ws.gsoc.cxf.apache.org/}CustomerServiceImpl -> > > > > > > impl.service.ws.gsoc.cxf.apache.org > > > /demoserver/jaxserver/jmxserver/type/ > or > /demoserver/jaxserver/jmxserver/port/ > > is just too long > > /demoserver/jmx?mbean=somembeanname > > would probably do; well perhaps, introducing some "types" into URIs > like /type/, /port/, etc, may also may make sense, but lets make sure > we have a simple and straightforward approach for getting the list of > all sorts of MBean representation > > > Thanks, Sergey > > > > Thank you. > > > > Regards: > > Shenglin Qiu > >