You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Raoul OPPLIGER <ro...@iware.ch> on 2005/06/07 16:56:58 UTC

RE : TR : A error message with JdbcAppender

THE  PROBLEM  IS  RESOLVED.
 
In fact, it is really a classloader issue.
I've had an old version of log4j.jar in my jre directory.
 
If I delete this old version and if I specify the path of jar files in the command line, the previous problem is resolved.
 
C:\log4j>echo
ECHO is on.
C:\log4j>"C:\Program Files\jdev1012\jdk"\bin\javac -classpath .;c:\log4j\log4j-1
.2.9.jar;c:\log4j\mysql-connector-java-3.1.8-bin LogTest.java
C:\log4j>"C:\Program Files\jdev1012\jdk"\bin\java -cp .;c:\log4j\log4j-1.2.9.jar
;c:\log4j\mysql-connector-java-3.1.8-bin LogTest
log4j:ERROR Failed to excute sql
java.sql.SQLException: Erreur de syntaxe pr?s de '2005-06-07 16:45:25,390 - syst
em.system -0    [main] DEBUG syste' ? la ligne 1
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2379)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2306)
        at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1298)
        at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:163)
        at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:235)
        at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:131)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
(AppenderAttachableImpl.java:57)
        at org.apache.log4j.Category.callAppenders(Category.java:194)
        at org.apache.log4j.Category.forcedLog(Category.java:379)
        at org.apache.log4j.Category.debug(Category.java:248)
        at LogTest.main(LogTest.java:7)
C:\log4j>
 
Now, there's a problem with the sql but it's another problem.
 
Thanks.
 
Raoul
 

________________________________

De: Andreas Fester [mailto:Andreas.Fester@gmx.de]
Date: mar. 07.06.2005 16:24
À: Log4J Users List; Raoul OPPLIGER
Objet : Re: TR : A error message with JdbcAppender



Hi,

James Stauffer wrote:
> Is it possibly a classloader issue?  It could be that the JDBC driver
> is loaded by the same classloader as the class that generates the
> config file but by a different class loader that the code the
> configures log4j.

We tried to track the problem down, and I am currently stuck.
I also already thought about a classloader issue, but I can not
imagine how this should happen in this case. We used a simple
test class:

import org.apache.log4j.*;
import org.apache.log4j.xml.*;

public class LogTest {
   public static void main(String[] args) {
     DOMConfigurator.configure("log4j.xml");
     Logger.getLogger("system.system").debug("Application initialized.");
   }
}

We started it with the following .cmd file:

SET JAVA_HOME=C:\Programme\Java\jdk1.4.2
dir
echo %CLASSPATH%
%JAVA_HOME%\bin\javac -classpath .;log4j-1.2.9.jar LogTest.java
%JAVA_HOME%\bin\java -verbose:class -cp
.;log4j-1.2.9.jar;mysql-connector-java-3.1.8-bin.jar LogTest

The only difference between my environment and Raouls environment
is the JVM: Raoul uses the JDK from Jdeveloper (a 1.4.2_04-b05),
and I use the original SUN JDK (a 1.4.2_08-b03).
The output shows no additional CLASSPATH set in our both environments.
The log4j.xml is the same, Raoul sent me his version (I though about
illegal invisible characters in the Driver= attribute, but that seems
to be ok).

BUT: Raoul gets the ClassNotFoundException, whereas in my case the
mysql driver is properly loaded. I only get a ClassNotFoundException
if I mess with the -cp parameter.... So I think we are thankful for
all additional input :-)

Thanks,
        Andreas

>
> On 6/6/05, Raoul OPPLIGER <ro...@iware.ch> wrote:
>
>>Hi Andreas
>>
>>For your information:
>>        operating system:       windows XP
>>        java:                   1.4.2_04
>>        log4j:          logging-log4j-1.2.9
>>
>>I don't really understand why there's a problem with the CLASSPATH
>>because I use the database to construct the configuration file.
[...]



Re: RE : TR : A error message with JdbcAppender

Posted by James Stauffer <st...@gmail.com>.
Probably something like this (I am not positive that this is correct):
Since log4j.jar was in your jre dir it was part of boot classloader
but your jdbc jar was part of the normal classloader so the log4j
classes couldn't see the classes in the normal classloader.

Someone please correct me.

On 6/7/05, Andreas Fester <An...@gmx.de> wrote:
> Hi,
> 
> just to be curious: how can the existence of a user specific
> jar file (i.e. other than rt.jar, tools.jar etc.) within some
> jre directory influence class loading behaviour, without
> being present in some CLASSPATH, -cp or -Xbootclasspath???
> 
> Any hint welcome :-)
> 
> Thanks and best Regards,
> 
>         Andreas
> 
> 
> Raoul OPPLIGER wrote:
> > THE  PROBLEM  IS  RESOLVED.
> >
> > In fact, it is really a classloader issue.
> > I've had an old version of log4j.jar in my jre directory.
> >
> > If I delete this old version and if I specify the path of jar files in
> > the command line, the previous problem is resolved.
> [...]
> 
> --
> Andreas Fester
> mailto:Andreas.Fester@gmx.de
> WWW: http://littletux.homelinux.org
> ICQ: 326674288
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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


Re: RE : TR : A error message with JdbcAppender

Posted by Andreas Fester <An...@gmx.de>.
Hi,

just to be curious: how can the existence of a user specific
jar file (i.e. other than rt.jar, tools.jar etc.) within some
jre directory influence class loading behaviour, without
being present in some CLASSPATH, -cp or -Xbootclasspath???

Any hint welcome :-)

Thanks and best Regards,

	Andreas


Raoul OPPLIGER wrote:
> THE  PROBLEM  IS  RESOLVED.
>  
> In fact, it is really a classloader issue.
> I've had an old version of log4j.jar in my jre directory.
>  
> If I delete this old version and if I specify the path of jar files in 
> the command line, the previous problem is resolved.
[...]

-- 
Andreas Fester
mailto:Andreas.Fester@gmx.de
WWW: http://littletux.homelinux.org
ICQ: 326674288

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