It does not matter what it returns. Just read from it. If your file is otside ant jar it will return a java.io.FileInputStream, if it is in a jar it will return java.util.zip.ZipFileInputStream. In either case you can read the file from the stream.
If you want to parse it you can use StreamSource to parse/transform it. I personaly put the files outside any jar, just place them in the lib directory. this way you can read it also, and it's easier to re/configure your app/tool/class with it, just use a text editor. 2. It depends, but sometimes if you try to open a non-existing resource you might get null as return value, but it may also throw an exception (something like ResourceNotFoundError or s.th. like that). Check both cases :) Lachezar. > it's returning a java.util.zip.ZipFile... > is it the intire jar?? > but if i change the name for a inexistent file, it returns null... > > ----- Original Message ----- > From: "Lachezar Dobrev" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, May 08, 2002 11:51 AM > Subject: Re: [JBoss-user] reading a file inside an EJB > > > > This is not something excelent, but does the work for me. > > Also it is deploy-directory-independant. > > > > I use: > > getClass().getClassLoader().getResourceAsStream("/mydata.xml"); > > > > The all you have to make sure is, that the mydata.xml file is in the > class > > path (the application lib directory, the server lib directory etc.). > > > > Try it. I am not sure, if this violates the ejb specs, because it > actualy > > reads a file. If you use a distributed environment (multiple servers, ejb > > clustering etc.) you may fall behind, because you need the file available > to > > all VMs. A better choice would be to use Configuration Entities, mapped to > a > > table. Most of your configurations may be used this way. It is not so hard > > to use as it may seem. > > > > Lachezar. > > > > > I have a xml file used to map which fields will be populate in the value > > > objet (to make smaller vo's). My problem is : how can i read a file (the > > xml > > > mapper) inside an EJB without using absolute path ? > > > > > > Emerson Cargnin - MSA > > > Ramal 861 > > > > > > ----- Original Message ----- > > > From: "Paul Cody" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Wednesday, May 08, 2002 8:31 AM > > > Subject: RE: [JBoss-user] JBoss refuses to start on Windows in dir with > > > spaces > > > > > > > > > > We have the same problem. In the medium term, I agree that this needs > > to > > > be > > > > fixed. In the short term, at least you have the source code; you can > > > > probably dedicate a smart developer to the problem and have things > > working > > > > relatively soon. Of course, JBoss is full of smart developers, and > yet > > > it's > > > > still a problem. This is probably because any smart developer knows > > never > > > > to install anything into a directory having spaces, and really smart > > ones > > > > know to stay the hell away from windoze lest their lives by full of > such > > > > trivialities. However, users/customers are rarely developers, much > less > > > > smart. > > > > > > > > Paul > > > > > > > > > -----Original Message----- > > > > > From: Thomas Hentschel Lund [mailto:[EMAIL PROTECTED]] > > > > > Sent: Wednesday, May 08, 2002 4:39 AM > > > > > To: [EMAIL PROTECTED] > > > > > Subject: [JBoss-user] JBoss refuses to start on Windows in dir with > > > > > spaces > > > > > > > > > > > > > > > > > > > > > > > > > I have a huge problem. We are bundling jboss inside our > > > > > application (under > > > > > development) and the installer lets people choose the dir > > > > > they want to install > > > > > into. > > > > > > > > > > Most (if not all) on Windows install into "program files". > > > > > But JBoss refuses to > > > > > start in there. We have tried this with 3.0.0rc1 + rc2 - > > > > > totally bare bones - no > > > > > changes at all to any config scripts. We are attempting to > > > > > run jboss using the > > > > > run.bat script. > > > > > > > > > > If the application is installed inside a dir without spaces, > > > > > then all is fine. > > > > > But it is not possible to force our customers to install the > > > > > app inside a static > > > > > path - they want (and should be able) to choose it from the > installer. > > > > > > > > > > JBoss gives the following error: > > > > > > > > > > 12:30:42,132 INFO [Server] JBoss Release: JBoss-3.0.0RC2 > > > > > CVSTag=JBoss_3_0_0_RC2 > > > > > > > > > > 12:30:42,162 INFO [Server] Home Dir: > > > > > C:\Program%20Files\SecureAware\SecureAware > > > > > > > > > > 12:30:42,162 INFO [Server] Home URL: > > > > file:/C:/Program%20Files/SecureAware/Secur > > > > eAware/ > > > > 12:30:42,162 INFO [Server] Library URL: > > > > file:/C:/Program%20Files/SecureAware/Se > > > > cureAware/lib/ > > > > 12:30:42,162 INFO [Server] Patch URL: null > > > > 12:30:42,162 INFO [Server] Server Name: default > > > > 12:30:42,162 INFO [Server] Server Home Dir: > > > > C:\Program%20Files\SecureAware\Secu > > > > reAware\server\default > > > > 12:30:42,162 INFO [Server] Server Home URL: > > > > file:/C:/Program%20Files/SecureAwar > > > > e/SecureAware/server/default/ > > > > 12:30:42,162 INFO [Server] Server Data Dir: > > > > C:\Program%20Files\SecureAware\Secu > > > > reAware\server\default\db > > > > 12:30:42,162 INFO [Server] Server Temp Dir: > > > > C:\Program%20Files\SecureAware\Secu > > > > reAware\server\default\tmp > > > > 12:30:42,162 INFO [Server] Server Config URL: > > > > file:/C:/Program%20Files/SecureAw > > > > are/SecureAware/server/default/conf/ > > > > 12:30:42,162 INFO [Server] Server Library URL: > > > > file:/C:/Program%20Files/SecureA > > > > ware/SecureAware/server/default/lib/ > > > > 12:30:42,172 INFO [Server] Starting General Purpose Architecture > > (GPA)... > > > > log4j:ERROR Could not open > > > > [file:/C:/Program%20Files/SecureAware/SecureAware/ser > > > > ver/default/conf/log4j.xml]. > > > > java.io.FileNotFoundException: > > > > C:\Program%20Files\SecureAware\SecureAware\server > > > > \default\conf\log4j.xml > > > > > > > > and goes on for a while trying to load other stuff and gives errors of > > the > > > > same > > > > kind. > > > > > > > > I have spend 2 days on running through forums, and I see other ppl > > having > > > > the > > > > same problem. But apparently there is no fix for this and no solution > > > (other > > > > than forcing a non space containing dir, which is not an option for > us) > > > > > > > > Please help! > > > > > > > > /Thomas Lund > > > > > > > > -- > > > > Thomas Hentschel Lund > > > > > > > > > > > > _______________________________________________________________ > > > > > > > > Have big pipes? SourceForge.net is looking for download mirrors. We > > supply > > > > the hardware. You get the recognition. Email Us: > > [EMAIL PROTECTED] > > > > _______________________________________________ > > > > JBoss-user mailing list > > > > [EMAIL PROTECTED] > > > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > > > > _______________________________________________________________ > > > > > > > > Have big pipes? SourceForge.net is looking for download mirrors. We > > supply > > > > the hardware. You get the recognition. Email Us: > > [EMAIL PROTECTED] > > > > _______________________________________________ > > > > JBoss-user mailing list > > > > [EMAIL PROTECTED] > > > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > > > > > _______________________________________________________________ > > > > > > Have big pipes? SourceForge.net is looking for download mirrors. We > supply > > > the hardware. You get the recognition. Email Us: > [EMAIL PROTECTED] > > > _______________________________________________ > > > JBoss-user mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > > > > > > > _______________________________________________________________ > > > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > > the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] > > _______________________________________________ > > JBoss-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user