• Post Reply Bookmark Topic Watch Topic
  • New Topic

Working with files in EJB  RSS feed

 
Raghunath Nandyala
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

According to EJB Spec , I cant use io package inside ejb, my doubts are
1)If I want to load a file or property file how can I do that

2)Is it ok to use to invoke a class which is using files from ejb

For this we are using

InputStream propFile=Thread.currentThread().getContextClassLoader().getResourceAsStream("Filepath") inside ejb..(It will load file successfully from domain)

is it ok... what is the differance , how container will treat this

Thanks
Raghunath N
 
Ådne Brunborg
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally, I recommend keeping away from any references to Thread at all, even though I think Thread.currentThread().getContextClassLoader() will be unproblematic.

Consider this approach for loading a properties file:




[ November 06, 2006: Message edited by: �dne Brunborg ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!