In memory test is not able to get oracle.jdbc.driver.oracledriver

53 views
Skip to first unread message

Nimesh Nambiar

unread,
Jul 18, 2016, 8:32:45 AM7/18/16
to CDAP User
Hi,

We have application with connect with Oracle DB and get required information as per our requirement.
when we write a Junit / Groovy test case to verify if DB connection and fetching from DB also work file without any issue.

But when we run with In Memory CDAP instance we are getting following error

2016-07-18 17:45:49,914 - ERROR [WorkflowDriver:c.t.e.p.w.u.n.ConfigMonUtil@38] - oracle.jdbc.driver.OracleDriver
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=NO)(ADDRESS=(PROTOCOL=TCP)(HOST=SomeHost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=SomeServerName)))
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)

But the com.oracle:ojdbc6:11.2.0.1.0 jar is present in the classpath.

What might be the issue, did anyone got same type of issue, please let us know on this.

Thanks
Neemesh

Terence Yim

unread,
Jul 19, 2016, 1:02:37 PM7/19/16
to Nimesh Nambiar, CDAP User
Hi Nimesh,

Are you extending from TestBase and using the deployApplication() method to deploy and run your application? If that’s the case, the deployApplication() method takes extra arguments that you can pass in extra files to be bundled in the local application jar, which the test-framework created to deploy to the in memory CDAP. Specifically, you can pass in the jar file that contains the Oracle JDBC driver. If you have the Oracle JDBC driver in your classpath, one way to get hold to the JAR file path is by doing this.

@Test
public void testMethod() {
  String path = getClass().getResource(“/oracle/jdbc/driver/OracleDriver.class”).getPath();
  File jdbcJarFile = new File(URI.create(path.substring(0, path.indexOf("!/"))));
  ApplicationManager appManager = deployApplication(MyAppClass.class, jdbcJarFile);
  ….
}

Terence

--
You received this message because you are subscribed to the Google Groups "CDAP User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cdap-user+...@googlegroups.com.
To post to this group, send email to cdap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cdap-user/19144a04-7e20-40a9-8f58-3acac203df22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages