logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Fester <Andreas.Fes...@gmx.de>
Subject Re: A error message with JdbcAppender
Date Sat, 04 Jun 2005 17:04:52 GMT
Hi Raoul,

seems that you hit the wrong mailing list :-) - log4cxx is for
the C++ port of log4j. To not loose context, I appended your full
original mail and forwarded it to log4j-user@logging.apache.org.

Although you said that mysql-connector-java-3.0.16-ga-bin.jar is
in your classpath those kind of problems are almost always
a misconfigured classpath. Please try the attached test program
with the also attached .xml configuration file -
When I start it (on Unix) with

   java -cp lib/log4j-1.2.9.jar:. LogTest

I get exactly your error, but when I start it with

   java -cp lib/mysql-connector-java-3.1.8-bin.jar:lib/log4j-1.2.9.jar:. 
LogTest

I get a connection error (because I have no mysql database running),
but at least the driver was loaded.

Your mysql-connector 3.0.16 seems a bit out of date, I downloaded a
current one from the mysql homepage. I use log4j 1.2.9 with j2sdk 1.4.2.

HTH,

	Andreas

Raoul OPPLIGER wrote:
> I use log4j with a xml configuration file.
>  
> I don't have problems when I use FileAppender but when I introduce a 
> jdbcAppender in my config file
>  
> <appender name="system_system_3_database" 
> class="org.apache.log4j.jdbc.JDBCAppender">
>    <param name="URL" value="jdbc:mysql://localhost/OSP"/>
>    <param name="driver" value="com.mysql.jdbc.Driver"/>
>    <param name="user" value="root"/>
>    <param name="password" value=""/>
>    <param name="sql" value="insert into ........."/>
>    <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern" value="%d - %c -%-4r [%t] %-5p %c 
> %x - %m%n "/>
>    </layout>
> </appender>
> I've the following message with DOMConfigurator 
> (mysql-connector-java-3.0.16-ga-bin.jar is in my project CLASSPATH)
>  
> log4j:ERROR Failed to load driver
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
>  at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>  at java.lang.Class.forName0(Native Method)
>  at java.lang.Class.forName(Class.java:141)
>  at org.apache.log4j.jdbc.JDBCAppender.setDriver(JDBCAppender.java:336)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:324)
>  at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:196)
>  at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:155)
>  at 
> org.apache.log4j.xml.DOMConfigurator.setParameter(DOMConfigurator.java:530)
>  at 
> org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:182)
>  at 
> org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:140)
>  at 
> org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:153)
>  at 
> org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:415)
>  at 
> org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:335)
>  at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:781)
>  at 
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:666)
>  at 
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
>  at 
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:584)
>  at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:687)
>  at ch.consultas.osp.webcrawling.Log.initialize(Log.java:72)
>  at mypackage1.Hello.main(Hello.java:20)
> log4j:ERROR Failed to load driver
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
>  at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>  at java.lang.Class.forName0(Native Method)
>  at java.lang.Class.forName(Class.java:141)
>  at org.apache.log4j.jdbc.JDBCAppender.setDriver(JDBCAppender.java:336)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:324)
>  at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:196)
>  at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:155)
>  at 
> org.apache.log4j.xml.DOMConfigurator.setParameter(DOMConfigurator.java:530)
>  at 
> org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:182)
>  at 
> org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:140)
>  at 
> org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:153)
>  at 
> org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:415)
>  at 
> org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:335)
>  at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:781)
>  at 
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:666)
>  at 
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
>  at 
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:584)
>  at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:687)
>  at ch.consultas.osp.webcrawling.Log.initialize(Log.java:72)
>  at mypackage1.Hello.main(Hello.java:20)
> Debugger disconnected from local process.
> Process exited.
>  
> Can you help me?
>  
> Raoul

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

Mime
View raw message