-
1. Re: access file included in EJB jar module that is deployed
haraldgliebe Jun 28, 2003 5:42 AM (in response to billelmehdi)You can use
Thread.currentThread().getContextClassLoader().getResourceAsStream("/resources/file.xml")
to open an InputStream to the file.
Regards,
Harald -
2. Re: access file included in EJB jar module that is deployed
billelmehdi Jun 30, 2003 6:49 AM (in response to billelmehdi)You are very helpful,
are you a solution in the oposite way, yes because I want to read and write in this file. It's possibleto do this?
Thanks. -
3. Re: access file included in EJB jar module that is deployed
frito Jun 30, 2003 7:08 AM (in response to billelmehdi)It is possible if the file can be accessed by the file system (not class loader!).
But the spec points out you must not use the java.io package ;-)
Greetings,
Frito -
4. Re: access file included in EJB jar module that is deployed
billelmehdi Jun 30, 2003 7:21 AM (in response to billelmehdi)I have not understood your solution! can you be more explicit please.
thanks. -
5. Re: access file included in EJB jar module that is deployed
veit Jul 1, 2003 5:22 AM (in response to billelmehdi)Hi,
write another class like XMLAccess. import the class as normal and do all the io-stuff through your extra class. This should work and be EJB Spec compatible.
Regards,
Dominic -
6. Re: access file included in EJB jar module that is deployed
frito Jul 1, 2003 11:21 AM (in response to billelmehdi)I don't know if I get you right Dominic. Do you mean you can instanciate another class on your bean call which does all the IO to be spec compliant? It doesn't matter which class is doing the IO when it is done on a bean call!!!
Sure you can use the java.io package. But the spec says you must not and I recommend not to do so until you really know what you are doing (remembering transactions, passivation, security, ...)
Greetings,
Frito -
7. Re: access file included in EJB jar module that is deployed
veit Jul 3, 2003 4:59 AM (in response to billelmehdi)Hi,
OK. The EJB spec comment was not really correct. However, I feel, that it is a possibility to handle IO access that is sometimes needed in a semi-tolerated way.
Regards,
Dominic