• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getInitParameter with a MessageDrivenBean

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
 
reply
    Bookmark Topic Watch Topic
  • New Topic