getResourceAsStream not working any more

Hi guys,

I am working on a web application which has EJBs. My environment is:

* JDK 1.4.2

* Eclipse 3.0.1 with Lomboz plugin

* JBoss 3.2.3

The folder deployed is "sida.war". There is a "sida.properties" file in sida.war\WEB-INF\classes folder. I have a class "SidaProperties" which manages access to "sida.properties" file. In this class, in its static constructor, i was accessing this file as

InputStream inputStream = SidaProperties.class.getResourceAsStream("/sida.properties");

if ( inputStream ==null )

System.out.println("sida.properties could not be found." );

Every thing was working ok.

Now we are upgrading our environment to:

* JDK 5.0

* Eclipse 3.3 with WTP

* JBoss 4.2.0

Eclipse 3.3 wants projects segregated so I have

* one Utility project where I am keeping all *.java files except EJBs.

* one Dynamic Web project where I am keeping all JSPs.

* one EJB project where I am keeping all my EJBs.

* one EAR project which keeps reference to all three above.

The "sida.properties" file is located in Dynamic Web project while "SidaProperties" class is located in Utility project.

I am still deploying like previously i.e. "sida.properties" file in sida.war\WEB-INF\classes folder but now "SidaProperties" class could not find the "sida.properties" file and I am getting the message:

"sida.properties could not be found."

Any thing which I am missing here?

Thanks

[1641 byte] By [tv1970usa] at [2007-11-27 10:43:27]
# 1

I find out that if i move the "sida.properties" file from "sida.war\WEB-INF\classes" folder to "sida.war" folder then getResourceAsStream starts working. Problem is we use "sida.war\WEB-INF\classes" folder to put sensitive files including some system rules files as XMLs and if i start moving these files then i surely will be asked that how come you can access these files before but not now. There must be a way to access these files in "sida.war\WEB-INF\classes" folder. Please reply.

Thanks

tv1970usa at 2007-7-28 20:00:28 > top of Java-index,Java Essentials,Java Programming...
# 2

Hmmm...

I changed my code from

InputStream inputStream = SidaProperties.class.getResourceAsStream("/sida.properties");

if ( inputStream == null )

System.out.println( "sida.properties could not be found." );

to

InputStream inputStream = SidaProperties.class.getResourceAsStream("/WEB-INF/classes/sida.properties");

if ( inputStream == null )

System.out.println( "sida.properties could not be found." );

and its now working. Can anybody tell me why it was working the old way before but not now?

tv1970usa at 2007-7-28 20:00:28 > top of Java-index,Java Essentials,Java Programming...