Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getInitParameter with a MessageDrivenBean

 
Ben Hagadorn
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic