File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss and the fly likes How to access a properties file from a messagedrivenbean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "How to access a properties file from a messagedrivenbean" Watch "How to access a properties file from a messagedrivenbean" New topic
Author

How to access a properties file from a messagedrivenbean

Hope Zhu
Ranch Hand

Joined: May 11, 2004
Posts: 32
Hi,

I have a messagedrivenbean which reads from a properties file for starting info. If I pack the properties file & bean jar file in a same .ear file and hot-deploy into jboss, bean will looking for the properties file in JBOSS_HOME/bin dir. Obviously the properties file is not there. Anyone knows where the properties file is deployed and in my bean code how to point to that location?

Thanks in advance.
Jeff Shelley
Ranch Hand

Joined: May 21, 2003
Posts: 70
I'm not sure a properties file is allowed by the EJB specification. I seem to remember somewhere in the spec that says "Thou shalt not do I/O." It's a container portability thing.

You could put these as environment entries in your ejb-jar.xml. Then you'll be able to change that without changing code. Also, putting them in a database would work too.


It's almost Friday
Hope Zhu
Ranch Hand

Joined: May 11, 2004
Posts: 32
Hi Jeff,

Thanks a lot for your help. As you suggested I put info into my ejb-jar.xml as env-entry, it works.

Just to clear confusion I think I/O works ok with mbean. I placed my old properties file in server/default/conf dir and hard code path in my mbean it worked.

Thanks again for your help.
 
 
subject: How to access a properties file from a messagedrivenbean
 
Threads others viewed
Detect if a .properties file is in a jar
use temporary queue to get return value from onMessage() and how to pick it up
return value to the calling servlet from messageDrivenBean
Replace with Properties
Access file system from enterprise bean