• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem loading xml file

 
prasad kulkarni
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to get the InputStream for a properies file as
InputStream stream1 = getClass().getClassLoader().getResourceAsStream("commons-logging.properties");

However, when i am trying to get a inputstream for a xml file, I am getting null value. I am not able to locate the xml file. Both files are present under same directory.
InputStream stream2 = getClass().getClassLoader().getResourceAsStream("ejbLocator.xml");


Is there any clue? or I could not load xml file as stream?
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by prasad kulkarni:

Is there any clue? or I could not load xml file as stream?


getResourceAsStream() doesn't care what the file content is.
getResourceAsStream() uses the classpath to find resources, so if you can find one file in a directory, you should be able to find another.
Are there other circumstances at work here, like file permissions?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!