05-14-2019 09:15 AM
Hi Team
I am facing issue while running the Java class using Action element on CVP server. The Java class is not taking user name which it suppose to take from properties file it is taking something by its own not sure why it is happening on CVP server. However when I run this Java class without doAction method on CVP Call Studio server it takes values from properties file and do the database connection properly and returns values as well. But same logic under doAction element on CVP server at run time not making connection with Database due login failure.... error and login failure is coming due to incorrect user been used for login. See the Vxml App Server logs for application.
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.194,Subdialog_Start_01,exit,done
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.194,GetAgent,enter,
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.194,GetAgent,custom,Db Library Path =,C:\Cisco\CVP\jre\bin;C:\Cisco\CVP\VXMLServer\Tomcat\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;
C:\Cisco\CVP\lib;C:\Cisco\CVP\bin;C:\Cisco\CVP\wsm\CLI;C:\Cisco\CVP\perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;;.
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.194,GetAgent,custom,UserName=,XX
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.194,GetAgent,custom,Password=,XXXXXXXXXX
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.194,GetAgent,custom,URL=,jdbc:sqlserver://XX.XX.XX.XX:1433;databaseName=fdxl_hds;integratedSecurity=true;
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.240,GetAgent,custom,Exception in Database code occurred=,Login failed for user 'FDXL\FDXLCVP01$'. ClientConnectionId:1a38a6c9-1aa9-4420-b902-8d517a5135b0
10.45.96.41.1557813740725.72.VRUSurveyRating,05/14/2019 14:02:22.240,GetAgent,exit,done
Java code below.
public class Pick_Agent extends ActionElementBase {
public String userName="";
public void doAction(String name, ActionElementData data) throws AudiumException
{
//System.out.println("T");
Connection con = null;
Properties prop = new Properties();
ResultSet rs = null;
try
{
String path = System.getProperty("java.library.path");
InputStream stream = new FileInputStream(new File("C:\\config_files\\db_connect.properties"));
prop.load(stream);
path = prop.getProperty("sqlDLLpath") + ";" + path;
data.addToLog("Db Library Path =", path);
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);
}
catch (Exception ex){
throw new RuntimeException(ex);
}
try
{
InputStream stream = new FileInputStream(new File("C:\\config_files\\db_connect.properties"));
prop.load(stream);
userName = prop.getProperty("Username");
data.addToLog("UserName=", userName);
String password = prop.getProperty("Password");
data.addToLog("Password=", password);
String url=prop.getProperty("Url");
data.addToLog("URL=", url);
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(url, userName, password);
data.addToLog("Database connection: ","Success" );
Statement s1 = con.createStatement();
rs = s1.executeQuery("SELECT TOP 1 AgentPeripheralNumber FROM t_Termination_Call_Detail where RouterCallKeyDay=152799 and RouterCallKey=219 and AgentPeripheralNumber is not null order by DateTime desc");
if(rs!=null)
{
while(rs.next())
{
data.setSessionData("AgentID", rs.getString(1));
data.addToLog("AgentID=", data.getSessionData("AgentID").toString());
}
}
//while (rs.next()!=null)
//rs.next();
}
catch (Exception ex)
{
data.addToLog("Exception in Database code occurred=",ex.getMessage());
}
}
public static void main(String args[])
{
Pick_Agent pk = new Pick_Agent();
System.out.println(pk.userName);
System.out.println("Done");
}
}
05-14-2019 10:31 AM
Go to Cisco\CVP\VXMLServer\Tomcat\conf and check context.xml file whether the login user is configured.
05-15-2019 09:11 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide