Scriptella - Unable to instantiate driver for class scriptella.driver.xls.Driver

1.4k views Asked by At

My second question: I'm very newbie with Linux/Java/Scriptella and I'm trying a jdbc connection with scriptella on a xls local file, but I'm receiving the following errors:

4-dic-2013 0.41.46 <GRAVE> Script /home/maurizio/Scrivania/JATROPHA/applicazioni/prova_per_scriptella.etl execution failed.
Unable to instantiate driver for class scriptella.driver.xls.Driver
JDBC provider exception: Couldn't find appropriate jdbc driver : net.pcal.sqlsheet.XlsDriver. Please check class path settings
Error codes: []
4-dic-2013 0.41.46 <GRAVE> Scriptella bug report. Submit to issue tracker.
Scriptella version: 1.1
Exception: 
scriptella.execution.EtlExecutorException: Unable to instantiate driver for class scriptella.driver.xls.Driver
JDBC provider exception: Couldn't find appropriate jdbc driver : net.pcal.sqlsheet.XlsDriver. Please check class path settings
Error codes: []
    at scriptella.execution.EtlExecutor.execute(EtlExecutor.java:190)
    at scriptella.tools.launcher.EtlLauncher.execute(EtlLauncher.java:276)
    at scriptella.tools.launcher.EtlLauncher.launch(EtlLauncher.java:193)
    at scriptella.tools.launcher.EtlLauncher.main(EtlLauncher.java:321)
Caused by: java.lang.IllegalStateException: Unable to instantiate driver for class scriptella.driver.xls.Driver
    at scriptella.core.DriverFactory.getDriver(DriverFactory.java:98)
    at scriptella.core.DriverFactory.getDriver(DriverFactory.java:58)
    at scriptella.driver.auto.Driver.getConnection(Driver.java:96)
    at scriptella.driver.auto.Driver.connect(Driver.java:77)
    at scriptella.core.ConnectionManager.getConnection(ConnectionManager.java:81)
    at scriptella.core.Session.<init>(Session.java:57)
    at scriptella.execution.EtlExecutor.prepare(EtlExecutor.java:248)
    at scriptella.execution.EtlExecutor.execute(EtlExecutor.java:178)
    ... 3 more
Caused by: scriptella.jdbc.JdbcException: Couldn't find appropriate jdbc driver : net.pcal.sqlsheet.XlsDriver. Please check class path settings
    at scriptella.jdbc.GenericDriver.loadDrivers(GenericDriver.java:87)
    at scriptella.driver.xls.Driver.<init>(Driver.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:534)
    at java.lang.Class.newInstance(Class.java:374)
    at scriptella.core.DriverFactory.getDriver(DriverFactory.java:96)
    ... 10 more
Caused by: java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at scriptella.jdbc.GenericDriver.loadDrivers(GenericDriver.java:67)
    ... 17 more
Caused by: java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    ... 20 more

I'm using Ubuntu 10.04 Lucid Lynx.

I start scriptella via console in directory /home/maurizio/Scrivania/JATROPHA/applicazioni/ with the command scriptella/scriptella-1.1/bin/scriptella.sh -debug "prova_per_scriptella.etl" My ETL file prova_per_scriptella.etl contains the following rows:

<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
  <description>Prova connessione Firebird e XLS</description>
  <connection 
    id="fb_destination" 
    driver="org.firebirdsql.jdbc.FBDriver"
    url="jdbc:firebirdsql:localhost/3050:jatropha" 
    user="SYSDBA" 
    password="jatro201"
    classpath="/home/maurizio/Scrivania/JATROPHA/applicazioni/jaybird/Jaybird-2.2.3JDK_1.6/jaybird-2.2.3.jar"
  />
  <connection 
    id="xls_source" 
    url="jdbc:xls:file:prova_per_scriptella.xls"
    classpath="/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/sqlsheet-6.5.jar"
  />
</etl>

The env var $_SCRIPTELLA_CP of batch command scriptella/scriptella-1.1/bin/scriptella.sh results in

:/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/commons-jexl.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/commons-logging.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/jaybird-2.2.3.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/jsqlparser-0.8.0.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/mini-j2ee.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/scriptella-core.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/scriptella-drivers.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/scriptella-tools.jar:
/home/maurizio/Scrivania/JATROPHA/applicazioni/scriptella/scriptella-1.1/lib/sqlsheet-6.5.jar

My scriptella lib directory contains the following files:

commons-jexl.jar
commons-logging.jar
jaybird-2.2.3.jar
jsqlparser-0.8.0.jar
mini-j2ee.jar
scriptella-core.jar
scriptella-drivers.jar
scriptella-tools.jar
sqlsheet-6.5.jar

Any help would be very appreciated. Thanks in advance.

2

There are 2 answers

0
user1920897 On

I also had problems getting this to work. Rather than downloading the latest version as suggested by otty, it seems like a better idea to look at the pom.xml file for the net.pcal.sqlsheet.XlsDriver (which is what scriptella.driver.xls.Driver tries to instantiate. This way we are using the correct dependencies.

0
Otty On

This was asked a while ago but I thought I may answer this anyway as I just had the same issue.

The key to the answer is at the end of the stack trace Caused by: java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook.

This can be fixed by including all the libs included in the latest poi download found here.