users@glassfish.java.net

Re: Service calls from/to OSGI WAB Hybrid applications have wron

From: <forums_at_java.net>
Date: Mon, 10 Dec 2012 23:43:17 -0600 (CST)

Yes, I know it would be ideal for GlassFish to provide support for OSGi/JPA
spec, but I haven't found time to implement it yet. Coming to the question of
JavaEE context, let me see if I understand your scenario correctly: WAB2 has
registered some pure OSGi service. WAB2 is invoking these services. The
services are operating under WAB1's Java EE context. If this is what you are
seeing, then I confirm that's the correct behavior. Web applications were not
designed by JavaEE to operate as a replacement for local method calls. They
are expected to provide services which are called over a protocol. Since you
are exposing some OSGi services out of WAB2 which is directly called by WAB1,
web container does not get a chance to intercept to switch context. There is
no API available to switch the context. Even if there were an API, I would
advise against it. Instead, you should implement the services as EJBs. That
way, even when WAB1 calls it via OSGi service reference, the method is still
invoked with EJB's context. Thanks, Sahoo

--
[Message sent by forum member 'ss141213']
View Post: http://forums.java.net/node/892749