loader.getResource( null

O

obelix

hi:)
I hope I can find help here. I've already googled myself to death, no
solution.

so from the very beginning. I made a tomcat project in eclipse,
deployed and I have put a test.properties file into a classes
directory.

Than I do the following:
===================8<====================================
ClassLoader loader = this.getClass().getClassLoader();
URL file = loader.getResource("test.properties");
===================8<====================================

the loader looks like this:
===================8<====================================
WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
StandardClassLoader
delegate: true
repositories:
file:E:\Apache\Tomcat5.0\shared\classes\
----------> Parent Classloader:
StandardClassLoader
delegate: true
repositories:
file:E:\Apache\Tomcat5.0\common\classes\
file:E:\Apache\Tomcat5.0\common\lib\ant-launcher.jar
file:E:\Apache\Tomcat5.0\common\lib\ant.jar
file:E:\Apache\Tomcat5.0\common\lib\commons-collections-3.1.jar
file:E:\Apache\Tomcat5.0\common\lib\commons-dbcp-1.2.1.jar
file:E:\Apache\Tomcat5.0\common\lib\commons-el.jar
file:E:\Apache\Tomcat5.0\common\lib\commons-pool-1.2.jar
file:E:\Apache\Tomcat5.0\common\lib\jasper-compiler.jar
file:E:\Apache\Tomcat5.0\common\lib\jasper-runtime.jar
file:E:\Apache\Tomcat5.0\common\lib\jsp-api.jar
file:E:\Apache\Tomcat5.0\common\lib\naming-common.jar
file:E:\Apache\Tomcat5.0\common\lib\naming-factory.jar
file:E:\Apache\Tomcat5.0\common\lib\naming-java.jar
file:E:\Apache\Tomcat5.0\common\lib\naming-resources.jar
file:E:\Apache\Tomcat5.0\common\lib\servlet-api.jar
file:E:\Apache\Tomcat5.0\common\lib\tools.jar
----------> Parent Classloader:
sun.misc.Launcher$AppClassLoader@92e78c
===================8<====================================
and my problem is, when I
loader.getResource("test.properties");

I get NULL.
tell my why?? and how can I fix it.

thanks in advance, simon:)

ps. I have already tried:
1) put test.properties into the "StandardClassLoader" and it works, but
it is not the place of my properties.
2) manipulate the string "test.properties", nothing works
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top