Loading Properties file in EJB
1 posts in topic
Flat View  Flat View

Posted By:   Naresh_Sharma
Posted On:   Tuesday, August 21, 2001 12:32 AM

Hello Everybody, I am working with Orion 1.5.2 server,and in a EJB's method i am reading a properties file. when i used ClassLoader.getSystemResouce("abc.properties"), it didn't worked but when i tried this.getClass().getClassLoader().getSystemResource("abc.properties") method, it worked. can anybody explain the differnce in between these two. For your information orion server uses Extension mechanism for loading required classes. Thanks Naresh

Re: Loading Properties file in EJB

Posted By:   Bozidar_Dangubic  
Posted On:   Wednesday, August 22, 2001 07:21 AM

first, great choice of app server! second, you can setup your properties in your ejb deployment descritor with tag. that is the preferred way you should use to get the properties to your ejbs. you can also use jndi to lookup properties from ldap servers and such. but env-entry should be sufficient to load and use and property that your ejb may need. you code that works, i.e. this.getClass().getClassLoader().getSystemResource() will create a new object and new URL network connection for each Instance of the bean and I am not so sure that you want that. in addition, you are opening a connection just to read data that is local to your application. in my opinion, env-entry is a way to go or jndi for more advanced properties lookup.
About | Sitemap | Contact