spring - Junit Test cases are getting passed in Eclipse but getting exception when running with command line -


my junit test cases running fine in eclipse. fine mean either green or red. however, giving me following exception when try run test cases using options mvn test or mvn install.

    testpersistchannelresponsehdr(com.*.systemi.rga.dao.jpapopulatesubsres test)  time elapsed: 0.65 sec  <<< error! java.lang.illegalstateexception: failed load applicationcontext     @ org.springframework.test.context.cacheawarecontextloaderdelegate.loadcontext(cacheawarecontextloaderdelegate.java:99)     @ org.springframework.test.context.testcontext.getapplicationcontext(testcontext.java:122)     @ org.springframework.test.context.support.dependencyinjectiontestexecutionlistener.injectdependencies(dependencyinjectiontestexecutionlistener.java:109)     @ org.springframework.test.context.support.dependencyinjectiontestexecutionlistener.preparetestinstance(dependencyinjectiontestexecutionlistener.java:75)     @ org.springframework.test.context.testcontextmanager.preparetestinstance(testcontextmanager.java:307)     @ org.springframework.test.context.junit4.springjunit4classrunner.createtest(springjunit4classrunner.java:211)     @ org.springframework.test.context.junit4.springjunit4classrunner$1.runreflectivecall(springjunit4classrunner.java:288)     @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12)     @ org.springframework.test.context.junit4.springjunit4classrunner.methodblock(springjunit4classrunner.java:284)     @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:231)     @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:88)     @ org.junit.runners.parentrunner$3.run(parentrunner.java:238)     @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:63)     @ org.junit.runners.parentrunner.runchildren(parentrunner.java:236)     @ org.junit.runners.parentrunner.access$000(parentrunner.java:53)     @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:229)     @ org.springframework.test.context.junit4.statements.runbeforetestclasscallbacks.evaluate(runbeforetestclasscallbacks.java:61)     @ org.springframework.test.context.junit4.statements.runaftertestclasscallbacks.evaluate(runaftertestclasscallbacks.java:71)     @ org.junit.runners.parentrunner.run(parentrunner.java:309)     @ org.springframework.test.context.junit4.springjunit4classrunner.run(springjunit4classrunner.java:174)     @ org.apache.maven.surefire.junit4.junit4provider.execute(junit4provider.java:264)     @ org.apache.maven.surefire.junit4.junit4provider.executetestset(junit4provider.java:153)     @ org.apache.maven.surefire.junit4.junit4provider.invoke(junit4provider.java:124)     @ org.apache.maven.surefire.booter.forkedbooter.invokeproviderinsameclassloader(forkedbooter.java:200)     @ org.apache.maven.surefire.booter.forkedbooter.runsuitesinprocess(forkedbooter.java:153)     @ org.apache.maven.surefire.booter.forkedbooter.main(forkedbooter.java:103) caused by: org.springframework.beans.factory.parsing.beandefinitionparsingexception:     configuration problem: unable locate spring namespacehandler xml schema namespace [http: //www.springframework.org/schema/jdbc]  

mu understanding is unable find spring-jdbc in classpath. ran mvn dependency:tree in console confirm doubt. if run mvn:dependency:tree in eclipse, can see spring-jdbc.

------------------------update--------------------------

my pom file has dependency on other pom file(lets xyz.xml). actual dependencies defined in xyz.xml. spring-jdbc dependency added in our local repo.

check xml configuration file namespace declaration:

xmlns:jdbc="http://www.springframework.org/schema/jdbc" 

and schemalocation:

http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd  

check if spring-jdbc-3.0 jars correctly placed in web-inf lib folder.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -