ClassLoader.getResourceAsStream

F

F C

Bonjour

I checked the newgroups before to send a message.

I need to read the logging configuration from a file.

LogManager.getLogManager().readConfiguration(
getClass().getClassLoader().getResourceAsStream(configFile)
);

This instruction is executed from a data server running in a tomcat
4.0.1 instance.
The data server is in a jar file.

Unfortunately, the three following commands to get an InputStream
instance associated to the configuration file return a null reference:

command a) getClass().getResourceAsStream(configFile)
command b) getClass().getClassLoader().getResourceAsStream(configFile)
command c) Thread.currentThread().getContextClassLoader().getResourceAsStream(configFile)

But, in an application mode (i.e. data server not running in a tomcat
server)
only the previous command a) return null.

Does some one have an idea how can i get an input stream corresponding
to the configuration file ?

I use java 1.4.0 under solaris ( I also tried with java 1.4.1).

Thank you for your help
F
 
A

Alain Javier Guarnieri del Gesu

* F C said:
I need to read the logging configuration from a file.

The data server is in a jar file.

Unfortunately, the three following commands to get an InputStream
instance associated to the configuration file return a null reference:

command a) getClass().getResourceAsStream(configFile)
command b) getClass().getClassLoader().getResourceAsStream(configFile)
command c) Thread.currentThread().getContextClassLoader().getResourceAsStream(configFile)

package fr.yahoo.do_not_reply_please;

class France {
public void bonjour () {

InputStream in = getClass().getResourceAsStream("data.txt");
 
Joined
Mar 31, 2009
Messages
1
Reaction score
0
Try with antiJARLocking property

Hi,

I put property antiJARLocking as "true" in the context.xml file and starts getting resources from JARS:
<Context path="/teller" antiJARLocking="true"/>

G
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top