18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

error in reading data from excel in new version of sahi

edited November -1 in Sahi - Open Source
Hi,
I am trying to read data from an excel sheet by this code

var $driver="com.hxtt.sql.excel.ExcelDriver";
var $datafile="jdbc:excel:/D:/sahi/data/test.xls";
var $db=_getDB($driver,$datafile,"","");

var $rs = [];
$rs[0]=[];
var $rs = $db.select("select * from sheet1");
This piece of code is working fine with the older version of sahi(i.e sahi_20081026).

But in the latest version of sahi(sahi_20090304) the same code is showing "--Stopped Playback: FAILURE--"

The logs in sahi console is showing this error

java.lang.ClassNotFoundException: com.hxtt.sql.excel.ExcelDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at net.sf.sahi.util.ClassLoadHelper.getClass(ClassLoadHelper.java:23)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:99)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:142)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:201)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:84)
at org.mozilla.javascript.gen.c1._c16(<cmd>:92)
at org.mozilla.javascript.gen.c1.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:64)
at org.mozilla.javascript.gen.c2._c0(<cmd>:9)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.gen.c2.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1144)
at net.sf.sahi.rhino.ScriptRunner.run(ScriptRunner.java:94)
at java.lang.Thread.run(Thread.java:595)

Comments

  • narayannarayan Administrators
    Add the jdbc jar to the classpath in sahi.bat again.
  • edited March 2009
    Hi Narayan,
    I have added the jdbc.jar classpath in sahi.bat.
    Still i m getting "--Stopped Playback: FAILURE--",and in the log file of sahi
    it is showing the error "JSERROR TypeError: Cannot find function getIdleTimeout."
    But in the older version of sahi the same code is working fine.

    For ur information here i will like to add that the code for retrive data from Ms-Access is working fine in the latest
    version of sahi also.

    thanks and regards
  • socheasochea Members
    Hi,

    Change your statement for the following

    Your statement: var $rs = $db.select("select * from sheet1");
    Changed into: var $rs = $db.select("select * from [sheet1$]");

    You can also look here: /w/working-with-excel-sheets on the Sahi website

    Hope it helps!
Sign In or Register to comment.