java - ClassNotFoundException: oracle.jdbc.OracleDriver when running tests using cargo maven2 plugin -
i'm trying run functional tests on cargo maven2 plugin.these tests run fine on local tomcat server when launched without using cargo maven2 plugin. plugin boots when run tests return 500 error code following trace:
caused by: org.apache.tomcat.dbcp.dbcp.sqlnestedexception: cannot load jdbc driver class 'oracle.jdbc.oracledriver' @ org.apache.tomcat.dbcp.dbcp.basicdatasource.createconnectionfactory(basicdatasource.java:1429) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.createdatasource(basicdatasource.java:1371) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.getconnection(basicdatasource.java:1044) ... 109 more caused by: java.lang.classnotfoundexception: oracle.jdbc.oracledriver @ java.lang.classloader.findclass(classloader.java:531) @ java.lang.classloader.loadclass(classloader.java:425) @ persistence.spi.hibernate.transformingclassloader.loadclass(transformingclassloader.java:46) @ java.lang.classloader.loadclass(classloader.java:358) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.createconnectionfactory(basicdatasource.java:14
i have added ojdbc 6
jar in pom , excluded references ojdbc 5 , ojdbc 14.
here's cargo configuration:
<plugin> <groupid>org.codehaus.cargo</groupid> <artifactid>cargo-maven2-plugin</artifactid> <version>1.4.14</version> <configuration> <container> <containerid>tomcat7x</containerid> <type>installed</type> <zipurlinstaller> <url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.zip</url> <downloaddir>${project.build.directory}/downloads</downloaddir> <extractdir>${project.build.directory}/extracts</extractdir> </zipurlinstaller> <systemproperties> <java.io.tmpdir>target/tmp</java.io.tmpdir> </systemproperties> <output>${project.build.directory}/cargo-container.log</output> <log>${project.build.directory}/cargo.log</log> </container> <deployables> <deployable> <groupid>x.rest</groupid> <artifactid>x-war</artifactid> <type>war</type> </deployable> </deployables> <configuration> <type>standalone</type> <home>${project.build.directory}/tomcat7x/container</home> <properties> <cargo.tomcat.ajp.port>9414</cargo.tomcat.ajp.port> <cargo.servlet.port>9484</cargo.servlet.port> <cargo.rmi.port>9496</cargo.rmi.port> <cargo.logging>high</cargo.logging> <war>${project.build.directory}/x-war.war</war> <!-- section added me didn't fix problem --> <cargo.datasource.datasource> cargo.datasource.jndi=jdbc/db| cargo.datasource.type=javax.sql.datasource| cargo.datasource.driver=oracle.jdbc.oracledriver| cargo.datasource.url=jdbc:oracle:thin:abc/abc@domain.net:22:node1| cargo.datasource.username=abc| cargo.datasource.password=abc </cargo.datasource.datasource> </properties> <configfiles> <configfile> <file>${project.basedir}/src/test/resources/war-dependencies/stable-dev/context.xml</file> <todir>conf</todir> <tofile>context.xml</tofile> </configfile> </configfiles> <files> <file> <file>${project.basedir}/src/test/resources/war-dependencies/stable-dev/service.keystore</file> <todir>shared/classes</todir> </file> </files> </configuration> </configuration> <executions> <!-- executions here deal integration-test phase. not hitting rest service via tests in test phase. need assured our container , running. cargo started in pre-integration-test phase. --> <execution> <id>start-container</id> <phase>pre-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> <!-- <execution> <id>stop-container</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution>--> </executions> </plugin>
i newbie web service world suggestions/pointers appreciated. may i'm missing configuration somewhere?
the reason got no exception on tomcat might due existing ojdbc6.jar file in lib folder of tomcat.
however, oracle jdbc driver jar file cannot found in public maven repository due legal issue.
here official instruction of getting oracle jdbc driver maven repository
get oracle jdbc drivers oracle maven repository - netbeans, eclipse & intellij
there simple , straight forward solution.
install jar file directly local repository copying jar file @ local drive, open command prompt ,go the current directory of jar file , execute following command
mvn install:install-file -dgroupid=com.oracle -dartifactid=ojdbc6 -dpackaging=jar -dversion=11.2.0.4.0 -dfile=ojdbc6.jar -dgeneratepom=true
Comments
Post a Comment