Hi Petr,
On 23/04/14 11:30, Dolezal, Petr wrote:
Hi Sergey,
you were a bit faster than me with my reply :-) Well, I mentioned it in my
original post: we use an OSGi container (Equinox) with embedded Jetty. So the
code base is indeed shared. It looks you are confirming my impression that CXF
shares some information globally, which is not working very well in OSGi
environment. I think that the bus is not created again, but reused, as you
suspect.
I don't know what the bus identifier is used for exactly and what are the
consequences of changing it, but I guess that it should be assigned in a more
flexible way, perhaps if the servlet mapping (the discussed JIRA ticket
suggested that, didn't it?) could be reflected in the identifier, it could save
the whole situation even in OSGi environment. But I don't know if it is
possible - I know very little about CXF buses (and I know even less about
Spring), so I can't give advices ;-) However, any sharing needs much attention
in OSGi, this is a lesson that I know already very well.
I hope this would help and there is a way to make CXF + JAX-RS more
OSGi-friendly.
The question though remains, given that you use web.xml, no Spring &
Blueprint, meaning that in case of a single web.xml you have two
CXFNonSpringJaxrsServlet instances created, how both of those instances
end up sharing the bus (lets say the same endpoint registry in the
context of this discussion).
Here is the link to CXFNonSpringServlet:
https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
(CXFNonSpringJaxrsServlet extends it, the related source is unchanged
between multiple versions).
CXFNonSpringJaxrsServlet delegates to a default CXFNonSpringServlet
constructor and afterwards a new bus created in loadBus().
Note, CXFNonSpringServlet has a setBus() method, and bus itself is
'protected' and it appears to me somehow you have the shared bus
injected via those setters. I don't understand how it is possible :-)
so if you could check out the source and put a breakpoint in
CXFNonSpringServlet then we'd trace where the shared bus is coming from...
Thanks, Sergey
Petr