jabsorb + EJB

23 views
Skip to first unread message

progre55

unread,
Oct 5, 2010, 12:21:28 PM10/5/10
to jabsorb-user
Hi people,

I'm trying to get jabsorb work with EJB on the server side. I havent
been able to find anything on the web so far.
I have an EJB application on the server side, and willing to use JSON-
RPC on the transport layer.
However, how do you register EJBs with JSONRPCBridge? and where?

Any tip/suggestion is highly appreciated.

Kind regards,
progre55
Message has been deleted

tibor....@gmail.com

unread,
Oct 5, 2010, 2:28:00 PM10/5/10
to jabsorb-user
Hi,

My suggestion is to implement the interface ServletContextListener,
and the contextInitialized method in particular can be used to
register your objects with jabsorb.
The lifecycle of jabsorb is bound to the servlet container and not to
the EJB container in any way. Whenever the servlet context is
destroyed/reloaded, you need to register your object again. Choosing
the approach above, the initialization code will be run by the servlet
container whenever needed, so you do not have to worry.

I hope this is enough to get you started. A word of warning:

It will seem straightforward to look up the SLSB and register it with
the bridge, however, this might not be a good idea depending on your
configuration and needs:

If you are using (or plan to use) clustering on the EJB tier, you
might need to add a thin wrapper for your SLSBs to your web
application code that will take care of looking up the JNDI resources
each time. Depending on your appServer and configuration, you might
not be allowed to cache/store the stub without loosing failover
capability. Some application servers provide stubs which are clever
enough to transparently handle failover, while others do not.

Cheers,
T

progre55

unread,
Oct 6, 2010, 7:13:02 AM10/6/10
to jabsorb-user
HI Tibor,

Thanks a lot for the suggestions, appreciate!

Another question though.. How to deal with authentication/
authorization in this case?
Now I have a public class (Auth) registered with the global bridge,
which has login(user,pass) and logout() methods, and if login is
successful, I put a bridge in the user's session and register some
more classes with this bridge depending on the user's access level.
But any suggestions on how to handle stateless situations, please?

Regards,
progre55

On Oct 5, 8:28 pm, "tibor.boe...@gmail.com" <tibor.boe...@gmail.com>
wrote:

tibor....@gmail.com

unread,
Oct 6, 2010, 10:46:49 AM10/6/10
to jabsorb-user
Hi,

There are two options that come to my mind. The first one being some
kind of authentication token that is passed as first argument to your
stateless session bean methods each time. This token could serve as a
reference to a subject cached at the EJB tier. The second idea is to
store the subject on the web container tier (http session), and use a
local argument resolver (which is a great feature of jabsorb) to
inject it into the invocation. This approach can be clustered without
any issue, as long as your subject is serializable (it should be...)
and you have session replication enabled between the web container
cluster nodes.

I prefer to use the local arg resolver and store my subject/authn
token/whatever in the http session. Besides this single session
attribute, this approach is fully stateless.

Cheers,
T
Reply all
Reply to author
Forward
0 new messages