How to set a global variable at EAR level from MDB?

My application server is weblogic 10.
An EAR file has an EJB (MDB) and WAR.
Can the MDB set a variable in global context, which the WAR or any other EAR component can access?

There is the database option and the file option.
But I am looking at an in memory option, like an application context variable at EAR level. Any pointers?
p_ashwinramAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim CakalicSenior Developer/ArchitectCommented:
One thought would be to simply use System properties. The information that I've read on Weblogic is that it has a fairly standard ClassLoader hierarchy as shown in this figure: http://gemsres.com/photos/story/res/42876/fig1.jpg. The System class is loaded by the bootstrap ClassLoader and so the same Class instance (along with the static data it manages) is visible to all child ClassLoaders.

If Weblogic happens to prohibit the use of System.setProperty then you could implement a similar solution using your own class akin to System in a jar that is loaded by the system ClassLoader. The same Class instance (and the data it manages) would be visible to all WARs and EJBs.

If you only have one EAR (or only want the value to be shared amongst the WARs and EJBs in one EAR) then I think you could use a Stateless Session Bean that shares data amongst all of its instances. It might be possible to do the same using JNDI. Both these options seem somewhat heavyweight to me.

The simplest solution, if allowed by Weblogic, is to use System.

Regards,
Jim
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
p_ashwinramAuthor Commented:
Thank you very much for covering my blindspot. Appreciate your time and effort to answer this question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.