Announcement Announcement Module
Collapse
No announcement yet.
Runing Junit test org.apache.commons.pool.impl.GenericObjectPool: method <init>()V no Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Runing Junit test org.apache.commons.pool.impl.GenericObjectPool: method <init>()V no

    While running a junit test (In Eclipse- right click run as junit test), I am getting this error

    java.lang.NoSuchMethodError: org.apache.commons.pool.impl.GenericObjectPool: method <init>()V not found
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:1165)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource.java:880)
    at org.springframework.jdbc.datasource.DataSourceTran sactionManager.doBegin(DataSourceTransactionManage r.java:200)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.getTransaction(AbstractPl atformTransactionManager.java:350)
    at org.springframework.transaction.interceptor.Transa ctionAspectSupport.createTransactionIfNecessary(Tr ansactionAspectSupport.java:261)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:101)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy8.saveShipment(Unknown Source)
    at vms.service.ShipmentServiceTest.testSaveShipment(S hipmentServiceTest.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:166 )
    at junit.framework.TestCase.runBare(TestCase.java:140 )
    at org.springframework.test.ConditionalTestCase.runBa re(ConditionalTestCase.java:76)
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:131)
    at junit.framework.TestSuite.runTest(TestSuite.java:1 73)
    at junit.framework.TestSuite.run(TestSuite.java:168)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)

    Any help/idea,

    Thanks

  • #2
    The issue looks like an issue with commons pool which is used by Commons DBCP. Check and make sure that you have the correct versions of both Commons Pool and DBCP.

    Comment


    • #3
      I checked the versions of both org.apache.commons.dbcp and also for org.apache.commons.pool. They are both version 1.3 : 47.0

      The problem is still same.

      Comment


      • #4
        same problem

        I too am seeing the same problem. here is the dependency tree:
        Code:
        [INFO] [dependency:tree]
        [INFO] com.everbank:trades:war:1.0-SNAPSHOT
        [INFO] +- jaxen:jaxen:jar:1.1.1:compile
        [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
        [INFO] |  +- jdom:jdom:jar:1.0:compile
        [INFO] |  +- xml-apis:xml-apis:jar:1.3.02:compile
        [INFO] |  +- xerces:xercesImpl:jar:2.6.2:compile
        [INFO] |  \- xom:xom:jar:1.0:compile
        [INFO] |     +- xerces:xmlParserAPIs:jar:2.6.2:compile
        [INFO] |     \- com.ibm.icu:icu4j:jar:2.6.1:compile
        [INFO] +- junit:junit:jar:3.8.1:test
        [INFO] +- javax.activation:activation:jar:1.0.2:compile
        [INFO] +- axis:axis:jar:1.2.1:compile
        [INFO] +- axis:axis-jaxrpc:jar:1.2.1:compile
        [INFO] +- axis:axis-saaj:jar:1.2.1:compile
        [INFO] +- com.oracle:classes12:jar:10.1.0.4.0:compile
        [INFO] +- commons-beanutils:commons-beanutils:jar:1.6:compile
        [INFO] +- commons-codec:commons-codec:jar:1.3:compile
        [INFO] +- commons-digester:commons-digester:jar:1.3:compile
        [INFO] +- commons-discovery:commons-discovery:jar:0.2:compile
        [INFO] +- commons-fileupload:commons-fileupload:jar:1.0:compile
        [INFO] +- commons-logging:commons-logging:jar:1.0.4:compile
        [INFO] +- commons-validator:commons-validator:jar:1.1.3:compile
        [INFO] +- com.ostermiller:csv-parser-utils:jar:1.0:compile
        [INFO] +- net.sourceforge.jexcelapi:jxl:jar:2.6.10:compile
        [INFO] +- com.everbank:fabcommons:jar:1.0:compile
        [INFO] +- com.everbank:fab-struts:jar:1.0:compile
        [INFO] +- com.lowagie:itext:jar:2.1.4:compile
        [INFO] |  +- bouncycastle:bcmail-jdk14:jar:138:compile
        [INFO] |  \- bouncycastle:bcprov-jdk14:jar:138:compile
        [INFO] +- jakarta:jakarta-common:jar:1.0:compile
        [INFO] +- org.apache.poi:poi:jar:3.2-FINAL:compile
        [INFO] +- javax:jsr173_api:jar:1.0:compile
        [INFO] +- javax.mail:mail:jar:1.4.1:compile
        [INFO] +- javax.servlet:servlet-api:jar:2.3:provided
        [INFO] +- javax.servlet.jsp:jsp-api:jar:2.0:provided
        [INFO] +- log4j:log4j:jar:1.2.13:compile
        [INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.8:compile
        [INFO] |  \- org.slf4j:slf4j-api:jar:1.5.8:compile
        [INFO] +- logkit:logkit:jar:1.0.1:compile
        [INFO] +- com.jsptags.navigation:pager:jar:2.0:compile
        [INFO] +- com.everbank:serviceAuthenticationWSDL:jar:1.0:compile
        [INFO] +- struts:struts:jar:1.1:compile
        [INFO] |  +- struts:struts-legacy:jar:1.1:compile
        [INFO] |  +- commons-lang:commons-lang:jar:2.1:compile
        [INFO] |  +- oro:oro:jar:2.0.7:compile
        [INFO] |  \- javax.sql:jdbc-stdext:jar:2.0:compile
        [INFO] +- wsdl4j:wsdl4j:jar:1.5.1:compile
        [INFO] +- xalan:xalan:jar:2.6.0:compile
        [INFO] +- com.everbank:tradesAbis:jar:1.0-SNAPSHOT:compile
        [INFO] +- javassist:javassist:jar:3.11.0.GA:compile
        [INFO] +- org.hibernate:hibernate-core:jar:3.3.2.GA:compile
        [INFO] |  +- antlr:antlr:jar:2.7.6:compile
        [INFO] |  \- javax.transaction:jta:jar:1.1:compile
        [INFO] +- org.hibernate:hibernate-annotations:jar:3.3.0.ga:compile
        [INFO] +- org.hibernate:hibernate-commons-annotations:jar:3.3.0.ga:compile
        [INFO] +- javax.persistence:persistence-api:jar:1.0:compile
        [INFO] +- commons-dbcp:commons-dbcp:jar:1.2.2:provided
        [INFO] |  \- commons-pool:commons-pool:jar:1.3:provided
        [INFO] +- com.oracle.jdbcdriver:ojdbc14:jar:1.0:provided
        [INFO] +- org.apache.xbean:xbean-spring:jar:3.3:test
        [INFO] +- org.springframework:spring:jar:2.5.1:test
        [INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
        [INFO] +- opensymphony:quartz:jar:1.6.0:compile
        [INFO] +- javax.servlet:jstl:jar:1.1.2:compile
        [INFO] +- taglibs:standard:jar:1.1.2:compile
        [INFO] +- com.everbank.services.clients:authentication_service_client:jar:1.0.0:compile
        [INFO] |  +- com.everbank.services.clients:service_client_api:jar:1.0.0:compile
        [INFO] |  \- com.everbank.xml:auth_service_user_xml:jar:1.0.0:compile
        [INFO] |     \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
        [INFO] |        \- stax:stax-api:jar:1.0.1:compile
        [INFO] \- org.directwebremoting:dwr:jar:2.0.3:compile
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD SUCCESSFUL
        [INFO] ------------------------------------------------------------------------

        Comment


        • #5
          solved!!!!!

          after doing some digging. I discovered that the org.apache.commons.pool.impl.GenericObjectPool class is actually in 2 separate jars on the classpath. In eclipse, the first of the jars is the common-pool jar. when run in maven, the first is jakarta-common.

          I removed jakarta-common from the pom and suddenly everything works. For future reference, you can figure out what jar a class is loading out of by the following:
          Code:
           try
                     {
                  	   LOGGER.error("org.apache.commons.pool.impl.GenericObjectPool found "+Thread.currentThread().getContextClassLoader().loadClass("org.apache.commons.pool.impl.GenericObjectPool").getProtectionDomain().getCodeSource().getLocation());
                     }
                     catch (Exception e)
                     {}

          Comment


          • #6
            Problem resolved

            Originally posted by bdangubic View Post
            The issue looks like an issue with commons pool which is used by Commons DBCP. Check and make sure that you have the correct versions of both Commons Pool and DBCP.
            I replace my old common-pool jar file with 1.4 version to matched it with commonc-dbcp-1.4 and it works!!.
            - Thanks

            Comment

            Working...
            X