Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing a JavaBean within a Message-Driven EJB  RSS feed

 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JavaBean which is being used by servlets in a web application, and I want to access this bean in a Message-Driven EJB in order to update a value in the bean (I'll want to add a message text to a Vector of Strings in the JavaBean). In the servlets I can access the bean by getting it as a ServletContext attribute, but I'm not clear as to how I can access this bean within the EJB's onMessage() method, since the EJB doesn't have access to the ServletContext.
Can someone suggest how I gain access to this bean within the EJB's onMessage() method ?
Thanks in advance for any feedback.

-James
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i understand you correct your MDB has no reference to the bean in their MANIFEST file. Just add your class to a seperate package, reference it from your ejb.jar and then simple call the Java class. This has nothing todo with the onMessage method.
The restriction of an MDB is only that you can't call it manually (there is no component or home interface) it has to be activated by a message.
But there are no other restrictions.

Originally posted by James Adams:
I have a JavaBean which is being used by servlets in a web application, and I want to access this bean in a Message-Driven EJB in order to update a value in the bean (I'll want to add a message text to a Vector of Strings in the JavaBean). In the servlets I can access the bean by getting it as a ServletContext attribute, but I'm not clear as to how I can access this bean within the EJB's onMessage() method, since the EJB doesn't have access to the ServletContext.
Can someone suggest how I gain access to this bean within the EJB's onMessage() method ?
Thanks in advance for any feedback.

-James
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!