db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From A Leg <hale_in...@yahoo.com>
Subject Re: Pb Loading Configuration need java Hackers help.
Date Thu, 17 Jun 2004 14:45:16 GMT
Hi Thomas.

In fact setClassLoader is not usable.
As ClassLoader is used inside the first call to OJB :
PersistenceBrokerFactory.defaultPersistenceBroker();
Which use it to load Configuration and Logger elements.
So when you have conflict between OJB ClassLoader and your application 
ClassLoader ....

If anybody has an idea.

Mais be it you had another defaultPersistenceBroker method with 
ClassLoader as parameter :
This would give
PersistenceBrokerFactory.defaultPersistenceBroker(myClassLoader);

I will try to implement it, or tell me if you can do it.
Any idea welcome.

Thank's for help

Andre

Thomas Dudziak wrote:

> A Leg wrote:
>
>> Hi Thomas
>>
>> *_loggerClass = Log4jLoggerImpl.class;*
>> crash when LogingConfiguration , it could seem surprising but it is 
>> sure.
>>
>> The problem arrive
>> when PersistenceBrokerFactoryBaseImpl make LogFactory.getLogger
>> getLogger make first a "new LogingConfiguration()"
>> Which call the load() method in it's constructor.
>>
>> The crash arrive exactly *in LogingConfiguration.java, line 161*.
>>
>> This is probably linked to the fact that dbManager is a JINI service.
>>
>> I have added :
>> System.out.println("yep, so use log4j");
>> _loggerClass = Log4jLoggerImpl.class;
>> _loggerConfigFile = "log4j.properties";
>> System.out.println("After yep, so use log4j");
>>
>> and you can see below that it crash just after yep, so use log4j
>>
>> The debug build give no information here, because debug use logger 
>> which does not load.
>> I have tried first to get debug working, but *this stack come from 
>> release compile with jar-debug.*
>>
>> That is why I have been obliged to add debug messages.
>>
>> If you look at the stack below :
>>
>> Load of *ojbLoggingPropFile fail first* :
>> Load of *ojbPropFile fail also*.
>>
>> Do we need to adapt our application to support new logging elements ?
>> Any idea welcome.
>
>
> Hmm, I have zero knowledge of Jini, but there may be two things that 
> you can try:
>
> * Specify the log4j logger directly in the OJB-logging.properties 
> because the exception occurs in a fallback check that is only called 
> if there is no logger explicitly configured. So put these lines in 
> your OJB-logging.properties:
>
> LoggerClass=org.apache.ojb.broker.util.logging.Log4jLoggerImpl
> LoggerConfigFile=log4j.properties
>
> * This might be a classloader issue, so you could change the 
> classloader that OJB uses (when it is not accessing classes directly, 
> in this case it uses the thread's context classloader) via the 
> org.apache.ojb.broker.util.ClassHelper#setClassLoader method. Here you 
> would use the Jini classloader. Please note that you have to do this 
> before using *any* OJB class, and you'll need a recent OJB version 
> (rc7 or CVS).
>
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Mime
View raw message