wood burning stoves 2.0*
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
Author

getInitParameter with a MessageDrivenBean

Ben Hagadorn
Greenhorn

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
Greenhorn

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


Add entries to my ejb-jar.xml file:

<env-entry>
<env-entry-name>SMTPMailServer</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>internalmail.ourcompany.com</env-entry-value>
</env-entry>


Add code to my MessageDrivenBean:

String SMTPMailServer = (String)ctx.lookup("java:comp/env/SMTPMailServer");
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: getInitParameter with a MessageDrivenBean
 
Similar Threads
Getting context parameters
JMS
EJB 3 Local Lookup not working with Weblogic 10.3
Making calls outside the container
return value to the calling servlet from messageDrivenBean