Junit Lisa Task for Devtest execution does throws an error while connecting to a database

Document ID : KB000006612
Last Modified Date : 14/02/2018
Show Technical Document Details

Using DevTest task to execute Test Cases through Jenkins.

The Test Case connects to an Oracle Database and queries it.

The same Test Case, when staging on the DevTest Server, runs with no errors.

When the same Test Case gets executed through junitlisa task its throws the following error:


[junitlisa] java.sql.SQLRecoverableException: Listener refused the connection with the following error:

[junitlisa] ORA-12514, TNS:listener does not currently know of service requested in connect descriptor



All supported DevTest releases and platforms.

This is an configuration issue in Jenkins to make a JDBC connection to Oracle database.

As seen from the example below,  running a Test Case with one JDBC step querying an Oracle database from ANT outside of Jenkins.

1) Download ANT.  

2) Set ANT_HOME system environment variable.

3) Get the junit jar file to put in the ANT_HOME\lib folder.

4) Run your xml from ANT:

C:\CA\DevTest9.5.1\examples>ant -buildfile oracle_jdbc.xml

Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_121\lib\tools.jar

Buildfile: C:\CA\DevTest9.5.1\examples\oracle_jdbc.xml



    [mkdir] Created dir: C:\CA\DEVTES~1.1\reports\junit

[junitlisa] value = false

[junitlisa] Locale: en_US

[junitlisa] Setting System.out and System.err to: Cp1252

[junitlisa] LISA_HOME set to C:\CA\DEVTES~1.1\

[junitlisa] DevTest temporary directory is C:\Users\nunma04\lisatmp_9.5.1

[junitlisa] Configuring logging from 'C:\CA\DEVTES~1.1\logging.properties'

[junitlisa] log4j:WARN No appenders could be found for logger (com.itko.lisa.test.TestExecHelper).

[junitlisa] log4j:WARN Please initialize the log4j system properly.

[junitlisa] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

[junitlisa] DevTest Solutions, Copyright (c) 2002-2017 CA, All rights reserved.

[junitlisa] DevTest Regression Runner - Stage and Execute Tests with Auditing

[junitlisa] Generated rules from C:\CA\DEVTES~1.1\rules.xml

[junitlisa] [DevTest AGENT:C][WARN][6136][1][main][Apr 14, 2017 3:20:57 PM] Could not establish connection to Agent broker at tcp://localhost:2009?daemon=true

[junitlisa] [DevTest AGENT:C][WARN][6136][1][main][Apr 14, 2017 3:20:58 PM] Could not establish connection to Agent broker at tcp://NUNMA04:2009?daemon=true

[junitlisa] Security is enabled

[junitlisa] User information is valid

[junitlisa] User added to the Environment: admin

[junitlisa] Running suite of 1

[junitlisa] Running com.itko.lisa.testing.JUnitRunLISA

[junitlisa] Test Running...

[junitlisa] 2017-04-14 15:21:02 TestRun Info for jdbc [Run1User1Cycle]: avgNodeTime (ms) = 0 instances = 1 cycles = 0 failed = 0 steps = 0 steps/sec = 0 cycles/sec = 0

[junitlisa] Fri Apr 14 15:21:02 CDT 2017  Coordinator20: Test ended. Passed: 1 Failed: 0 Aborted: 0  Errors: 0

[junitlisa] Test ended.

[junitlisa] Monitoring Tests Details (**hostname may need to be updated**):

[junitlisa] http://NUNMA04:1507/devtest/#/main/testMonitorTests/detail//E0A174AC214F11E7BAB782A420524153//0

[junitlisa] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.158 sec

[junitlisareport] Creating default fileset

[junitlisareport] Creating default report

[junitlisareport] Processing C:\CA\DEVTES~1.1\reports\junit\TESTS-TestSuites.xml to C:\Users\nunma04\AppData\Local\Temp\null1394740039

[junitlisareport] Loading stylesheet jar:file:/C:/apache-ant-1.9.6/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl

[junitlisareport] Transform time: 739ms

[junitlisareport] Deleting: C:\Users\nunma04\AppData\Local\Temp\null1394740039

     [echo] The JUnit report is available at C:\CA\DEVTES~1.1/reports/junit/index.html



Total time: 29 seconds


You can see the database call in the Simulator log:

2017-04-14 20:21:02,628Z (15:21) [jdbc [Run1User1Cycle]/0] DEBUG com.itko.lisa.simulator.EventHandler - (testEvent) received Step request

2017-04-14 20:21:02,628Z (15:21) [jdbc [Run1User1Cycle]/0] DEBUG com.itko.lisa.jdbc.JDBCNode    - Executing query: select * from ACL_USERS

2017-04-14 20:21:02,644Z (15:21) [jdbc [Run1User1Cycle]/0] DEBUG com.itko.lisa.test.TestExec    - removeStateValue 'com.itko.lisa.jdbc.JDBCNode.jdbc:oracle:thin:@'

2017-04-14 20:21:02,644Z (15:21) [jdbc [Run1User1Cycle]/0] DEBUG com.itko.lisa.test.TestExec    - setStateValue 'lisa.JDBC.rsp.time' to '16'

2017-04-14 20:21:02,644Z (15:21) [jdbc [Run1User1Cycle]/0] DEBUG com.itko.lisa.history.NodeExecHistory - notifyPropSet: lisa.JDBC.rsp.time to 16

2017-04-14 20:21:02,644Z (15:21) [jdbc [Run1User1Cycle]/0] DEBUG com.itko.lisa.test.TestExecHelper - getCurrentThreadContextTestExec(): currentThread=jdbc [Run1User1Cycle]/0, testExec=LISA_SOURCE_PROJ_ROOT=C:\CA\DevTest9.5.1\examples<BR>


5) If you get the same error with these steps please of a case with CA Support and we will be happy to assist you.


Other verification:

We used a tool called DB Visualizer to connect to an Oracle Database and was getting the same error:



 Made one change to resolve it, changes the Connection Type to go against the ORACLE SID and it resolves the error:




So the problem is that the Oracle database being queried is not aware of the Jenkins service.

You will have to configure Jenkins to be able to make JDBC calls to your Oracle database.


Additional Information:

There have been other issues with running tests from Jenkins to Oracle getting the same error:


It was searched and found Jenkins provides a Database Plugin for JDBC connections, but not sure how it is used, you should contact your Jenkins group to help with this kind of issue, for this example others where running the same kind of JUNITLISA tests, but going to DB2 instead of Oracle.: