David,
Thanks for reporting this.
This might need some deeper thought.
I remember removing my own calls to Jetty's lifecycle mehtods at the last
moment - since they were being called twice. Looking back on this now I
believe that this wrong. I should be making explicit calls to what are
Jetty lifecycle methods and JBoss should not be calling them.
I kicked off a thread about this a while ago, and thought that I had
reached some agreement with the JBoss guys that 3rd party MBeans that were
not JBoss Services but registered with the JBoss JMX Server in order to
export their interfaces, should not be managed by JBoss, even if they
presented methods that looked similar to e.g. JBoss' lifecycle methods,
since their semantics could be entirely different.
I was quite sure this was resolved and was doing my own lifecycle
management just before the release (2.2.2) when I noticed that my lifecycle
methods were being called twice - so I removed _MOST_ of my calls - but
forgot that the WebApplicationContext also has an MBean peer.
It looks like JBoss changed it's behaviour with respect to 3rd party
MBeans. I will try to have a look at this tomorrow and get back to you with
my thoughts.
Thanks for taking the time to give me such a succinct description of the
problem - it makes my life immeasurably easier.
Speak to you soon,
Jules
David Castro-Diephouse wrote:
> Hi. I wanted to alert you to a problem I am seeing in the jboss-jetty
> bundle.
>
> In the update to org/jboss/jetty/JettyService.java 1.15, you removed the
> code that starts the HttpServer in startService, because the HttpServer
> gets registered with JMX in ensureMBean and started later by JMX.
>
> However, there is a similar problem with the WebApplicationContexts.
> When the HttpServer starts up, it starts each of the
> WebApplicationContexts. (HttpServer.start line 127). However, each
> context is also getting registered with JMX and started by JMX later on.
> This happens because in HttpServer.addContext (line 423), it calls
> BeanContextSupport.add(context). HttpServerMBean is registered as a
> membership listener with the HttpServer, and it registers the context
> with JMX.
>
> Having the WebApplicationContext started twice is a problem because it
> causes two ClassLoaders to be created for the context, which screws up
> RMI. (CL 1 loads the classes for the local VM, but CL2 is set as the
> Thread contextClassLoader which is used by RMI, so you get
> ClassCastExceptions any time you get an object back from RMI).
>
> I'm not sure what the best solution would be. I wonder though, why do
> you want to register the contexts as MBeans when their life cycles are
> managed by the HttpServer? Why not just let the server manage them?
> The server also seems to manage its LogSink and its listeners, so as a
> temporary workaround, I might just remove the call to add the
> HttpServerMBean as a membership listener for the HttpServer. I would
> love to hear your thoughts, though, and also to see a fix posted...
>
> thanks
> Dave
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user