File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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");
I agree. Here's the link:
subject: getInitParameter with a MessageDrivenBean
Similar Threads
Getting context parameters
Making calls outside the container
EJB 3 Local Lookup not working with Weblogic 10.3
return value to the calling servlet from messageDrivenBean