[INFO] Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'

531 views
Skip to first unread message

Vikram Verma

unread,
Jul 22, 2019, 1:40:28 AM7/22/19
to Maven JMeter Plugin Users

I have a jmx script which have JDBC request for connecting to both oracle and sql server. I am using maven project for execution of jmx script and I have already declared dependency for both of these servers in pom.xml. But I continue to get the error for both of these drivers.

POM dependencies:


        <build>      
           
<plugins>
           
<plugin>

               
<groupId>com.lazerycode.jmeter</groupId>

               
<artifactId>jmeter-maven-plugin</artifactId>

               
<version>2.9.0</version>

               
<configuration>

                   
<testResultsTimestamp>false</testResultsTimestamp>

                   
<propertiesUser>

                       
<threadgroup.count>2</threadgroup.count>

                       
<threadgroup.rampup>2</threadgroup.rampup>

                       
<threadgroup.duration>5</threadgroup.duration>

                       
<jmeter.save.saveservice.output_format>csv</jmeter.save.saveservice.output_format>

                       
<jmeter.save.saveservice.bytes>true</jmeter.save.saveservice.bytes>

                       
<jmeter.save.saveservice.label>true</jmeter.save.saveservice.label>

                       
<jmeter.save.saveservice.latency>true</jmeter.save.saveservice.latency>

                       
<jmeter.save.saveservice.response_code>true</jmeter.save.saveservice.response_code>

                       
<jmeter.save.saveservice.response_message>true</jmeter.save.saveservice.response_message>

                       
<jmeter.save.saveservice.successful>true</jmeter.save.saveservice.successful>

                       
<jmeter.save.saveservice.thread_counts>true</jmeter.save.saveservice.thread_counts>

                       
<jmeter.save.saveservice.thread_name>true</jmeter.save.saveservice.thread_name>

                       
<jmeter.save.saveservice.time>true</jmeter.save.saveservice.time>

                   
</propertiesUser>

               
</configuration>

               
<executions>

                   
<execution>

                       
<id>jmeter-tests</id>

                       
<phase>verify</phase>

                       
<goals>

                       
<goal>configure</goal>

                           
<goal>jmeter</goal>

                       
</goals>

                       
<configuration>

                               
<jmeterPlugins>

                                   
<plugin>

                                       
<groupId>kg.apc</groupId>

                                       
<artifactId>jmeter-plugins</artifactId>

                                   
</plugin>

                               
</jmeterPlugins>

                       
</configuration>

                   
</execution>

               
</executions>

                 

               
<dependencies>

         
<!-- https://mvnrepository.com/artifact/kg.apc/jmeter-plugins-manager -->

 
<dependency>

     
<groupId>kg.apc</groupId>

     
<artifactId>jmeter-plugins-manager</artifactId>

     
<version>1.3</version>

 
</dependency>

 

 
<!-- https://mvnrepository.com/artifact/kg.apc/jmeter-plugins-standard -->

 
<dependency>

     
<groupId>kg.apc</groupId>

     
<artifactId>jmeter-plugins-standard</artifactId>

     
<version>1.4.0</version>

 
</dependency>

 
<!-- https://mvnrepository.com/artifact/com.oracle.jdbc/ojdbc8 -->

 
<dependency>

     
<groupId>com.oracle.jdbc</groupId>

     
<artifactId>ojdbc8</artifactId>

             
<version>12.2.0.1</version>

 
</dependency>

 
</dependencies>

           
</plugin>

           
<plugin>

               
<artifactId>maven-antrun-plugin</artifactId>

               
<executions>

                   
<execution>

                       
<phase>pre-site</phase>

                       
<configuration>

                           
<tasks>

                               
<mkdir dir="${basedir}/target/jmeter/results/dashboard" />

                               
<copy file="${basedir}/src/test/resources/reportgenerator.properties"  

   
tofile="${basedir}/target/jmeter/bin/reportgenerator.properties" />

                               
<copy todir="${basedir}/target/jmeter/bin/report-template">

                                   
<fileset dir="${basedir}/src/test/resources/report-template" />

                               
</copy>

                               
<java jar="${basedir}/target/jmeter/bin/ApacheJMeter-3.0.jar" fork="true">

                                   
<arg value="-g" />

                                   
<arg value="${basedir}/target/jmeter/results/*.jtl" />

                                   
<arg value="-o" />

                                   
<arg value="${basedir}/target/jmeter/results/dashboard/" />

                               
</java>

                           
</tasks>

                       
</configuration>

                       
<goals>

                           
<goal>run</goal>

                       
</goals>

                   
</execution>

               
</executions>

               
<!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds -->

 

           
</plugin>

           
<plugin>

               
<groupId>org.apache.maven.plugins</groupId>

               
<artifactId>maven-compiler-plugin</artifactId>

               
<version>3.6.1</version>

               
<configuration>

                   
<source>1.8</source>

                   
<target>1.8</target>

               
</configuration>

           
</plugin>

       
</plugins>

   
</build>

</project>



Error Oracle DB:

[INFO] Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'
[INFO] java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
[INFO]  at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
[INFO]  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
[INFO]  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
[INFO]  at org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2197)
[INFO]  at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2104)
[INFO]  at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
[INFO]  at org.apache.jmeter.protocol.jdbc.config.DataSourceElement$DataSourceComponentImpl.getConnection(DataSourceElement.java:334)
[INFO]  at org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection(DataSourceElement.java:193)
[INFO]  at org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.sample(JDBCSampler.java:79)
[INFO]  at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622)
[INFO]  at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546)
[INFO]  at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486)
[INFO]  at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253)
[INFO]  at java.base/java.lang.Thread.run(Thread.java:834)

Gaetano Giacalone

unread,
Sep 24, 2019, 7:10:30 PM9/24/19
to Maven JMeter Plugin Users
Well for me I am using MSSQL, and i would assume that the same config item would stand for Oracle JDBC

in Jmeter maven plugin configuration tags add the following...

  <testPlanLibraries>
    <artifact>com.oracle.jdbc:ojdbc8:12.2.0.1</artifact>
  </testPlanLibraries>
Reply all
Reply to author
Forward
0 new messages