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
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)
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?
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
http://localhost:8080/demoserver/jaxserver/jmxserver/list
=> get all Mbeans by
ObjectName('*:type=*,*') which query is *:type=*,*
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
Thank you.
Regards:
Shenglin Qiu
> Date: Thu, 12 May 2011 14:23:36 +0100
> Subject: Re: Expose MBeans in CXF
> From: [email protected]
> To: [email protected]
>
> Hi Shenglin
>
> Thanks for the update. Can you please copy the summary from the
> previous email, where one possible approach going forward was
> discussed and describe what you've done so far in context of that
> summary ?
> Looks like you are progressing well, however I'm not exactly sure what
> exactly you are trying to do.
>
> More comments inline
>
> On Thu, May 12, 2011 at 1:53 PM, Shenglin Qiu <[email protected]> wrote:
> >
> > Hi Sergey:
> >
> > I have tested my current code and these are working fine:
> > http://localhost:8080/demoserver/jaxserver/jmxserver/port/%22UserServiceImpl%22
> > http://localhost:8080/demoserver/jaxserver/jmxserver/type/Bus.Service.Endpoint
> >
> > I will work on this " sign which is %22 in the URL and try to remove it.
>
> Please update us first on what you've done so far, why you are passing
> "UserServiceImpl" as the final segment is unclear at the moment
>
> >
> > This is not working
> > http://localhost:8080/demoserver/jaxserver/jmxserver/service/{http://web.management.gsoc.cxf.apache.org/}DJMXServer
> > which is :
> > http://localhost:8080/demoserver/jaxserver/jmxserver/service/%7Bhttp://web.management.gsoc.cxf.apache.org/%7DJMXServer
> >
> > It simply return 404 error. I guess it's the restriction from CXF Rest
> > inbound,
>
> Well, I believe CXF 2.4.0 and CXF 2.3.5 have no problems at all with
> handling all sort of encoded URIs, earlier versions had some issues
> when matrix params were used or some specific characters were encoded.
> So try the latest versions.
> However, what I'd really encourage you to do is to make sure you
> understand why the above is not working, by debugging the JAX-RS
> runtime code and see what might be going wrong
>
> > then I tried:
> > http://localhost:8080/demoserver/jaxserver/jmxserver/service/service?{http://web.management.gsoc.cxf.apache.org/}DJMXServer
> > http://localhost:8080/demoserver/jaxserver/jmxserver/service/service={http://web.management.gsoc.cxf.apache.org/}DJMXServer
> > They didn't work neither. Because when = in request, it's still 404, and
> > when ? in request, I only get 'service' as the @PathParam in the input, the
> > rest of the part is lost.
>
> '?' identifies the start of the query component, so that is not
> captured, and please check why '=' is not working. Perhaps something
> to do with @Path values ?
>
> >
> > So is there any way I can pass string like 'http://******' as a part of
> > request in cxf?
> >
> Yes, pass it as a query parameter value, ex ?component=http://bar or
> as the value of the path segment
>
> > BTW, I will have the NDA ready this week.
> >
> it's ICLA
>
> http://www.apache.org/licenses/icla.txt
>
> Please try to update the dev list at least twice per week and login to
> #cxf if you have questions. We should be finalizing by now the
> retrieval of MBean representations and start planning what to do next
>
> Thanks, Sergey
>
> > Thank you.
> >
> > Regards
> > Shenglin Qiu
> >
> >
>
>
>
> --
> Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com