Hi, I'd like to pass some parameters to a stateless session bean. I'd like to do something like I do when I configure a Servlet initial parameters in the web.xml file. Thanks
Ok, this is probably a stupid question, but how can I load the file from the EJB inside? If I white File f = new File("./file.properties"); it don't work, but I don't know how to access the context to retrive the real path. Can you help me?
s.susini
2010-08-01 17:39:35
You use an "absolute" path. For example /config/file.properties. Also, note there is a Properties class that you should use instead of new File so it abstracts away the parsing.I should have mentioned that "env-entry" exists for the ejb-jar.xml. Most people don't use that because it is easier to have a property file vary across environments than the xml that is jar'd up within your ear.
Jeanne Boyarsky
2010-08-01 17:53:41
@Jeanne: but wouldn't accessing the file system affect the portability of the app?
stratwine
2010-08-02 07:05:48
@Stratwine: Not if it is deployed with the app. This isn't a random file on the file system. T his is a properties file deployed either in the ear or better yet to a directory that can be easily changed. But that's a rich topic and not something easy to discuss in comments.
Jeanne Boyarsky
2010-08-03 00:04:41