All,

  I’m fairly certain this is not a c3p0 problem, but it just so happens that that’s where the error is throwing first so I’m hoping maybe someone has seen this.  

  I’ve got a small Spring project, and it works fine when I don’t include log4j.properties in the build path. I get the normal “please configure…” message from log4j, but at least everything runs.  However, when I add log4j.properties to my build path, I get an ExceptionInInitialize error from Spring, rooting back to a NoClassDefFound error coming from Log4J being called by Log4jMLog.getMLogger. the full trace is below.

 

I’m using log4j 1.2.13 and c3p0 0.0.1-pre6.

 

I’ve used older versions of log4j and c3p0 together quite nicely in the past, which is why I think this is probably Spring related since the only difference between this project and the ones that have worked, other than the versions of the libraries, is doing it all within spring.

 

Any help?

 

Thanks a lot.

 

Marc

 

java.lang.ExceptionInInitializerError

      at com.argus.optimize.tst.POLARunnerTest.testOptimize(POLARunnerTest.java:24)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source)

      at junit.framework.TestCase.runTest(TestCase.java:154)

      at junit.framework.TestCase.runBare(TestCase.java:127)

      at junit.framework.TestResult$1.protect(TestResult.java:106)

      at junit.framework.TestResult.runProtected(TestResult.java:124)

      at junit.framework.TestResult.run(TestResult.java:109)

      at junit.framework.TestCase.run(TestCase.java:118)

      at junit.framework.TestSuite.runTest(TestSuite.java:208)

      at junit.framework.TestSuite.run(TestSuite.java:203)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Class that bean class [com.mchange.v2.c3p0.ComboPooledDataSource] depends on not found; nested exception is java.lang.NoClassDefFoundError

      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:917)

      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:138)

      at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:652)

      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:382)

      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:314)

      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)

      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)

      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:68)

      at com.argus.application.AppManager.<clinit>(AppManager.java:7)

      ... 16 more

Caused by: java.lang.NoClassDefFoundError

      at org.apache.log4j.Logger.getLogger(Logger.java:117)

      at com.mchange.v2.log.log4j.Log4jMLog.getMLogger(Log4jMLog.java:48)

      at com.mchange.v2.log.MLog.getLogger(MLog.java:145)

      at com.mchange.v2.log.MLog.<clinit>(MLog.java:72)

      at com.mchange.v2.c3p0.ComboPooledDataSource.<clinit>(ComboPooledDataSource.java:71)

      at java.lang.Class.forName0(Native Method)

      at java.lang.Class.forName(Unknown Source)

      at org.springframework.util.ClassUtils.forName(ClassUtils.java:160)

      at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:320)

      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:910)

      ... 24 more

 

 

 

For what it’s worth, here’s my classpath:

 

<?xml version="1.0" encoding="UTF-8"?>

<classpath>

           

            <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

            <classpathentry kind="src" path="src"/>

            <classpathentry kind="lib" path="lib/c3p0-0.9.1-pre6.jar"/>

            <classpathentry kind="lib" path="lib/log4j-1.2.13.jar"/>

            <classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>

            <classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>

            <classpathentry kind="lib" path="lib/jtds-1.2.jar"/>

            <classpathentry kind="lib" path="lib/POLA.jar"/>

            <classpathentry kind="lib" path="lib/spring.jar"/>

            <classpathentry kind="output" path="classes"/>

</classpath>