Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes getInitParameter with a MessageDrivenBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "getInitParameter with a MessageDrivenBean" Watch "getInitParameter with a MessageDrivenBean" New topic

getInitParameter with a MessageDrivenBean

Ben Hagadorn

Joined: Mar 28, 2006
Posts: 25
I need a way to retrieve some intialization parameters for my MessageDrivenBean. If this was a servlet I would put the info into the web.xml file and then call servletContext.getInitParameter("X") where "X" was the name of my parameter in web.xml. Is there a comparable place to store these types of parameters for a MessageDrivenBean and what method do I call to get them?

Thanks for the help.

- Ben
Ben Hagadorn

Joined: Mar 28, 2006
Posts: 25
Got it. This is what I needed to do:

Add entries to my ejb-jar.xml file:


Add code to my MessageDrivenBean:

String SMTPMailServer = (String)ctx.lookup("java:comp/env/SMTPMailServer");
jQuery in Action, 2nd edition
subject: getInitParameter with a MessageDrivenBean
Similar Threads
Getting context parameters
EJB 3 Local Lookup not working with Weblogic 10.3
Making calls outside the container
return value to the calling servlet from messageDrivenBean