Вопрос

I have a Scriptella etl file where I parse a csv file and also use a sample janino script. I always get an exception of driver not found for scriptella, although i have it in libs folder.

etl.xml

<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
<description>
    Queries CSV data from from file and store the results in a DB and other CSV file.
</description>
<connection id="in" driver="csv" url="input.csv"/>
 <connection id="out" driver="csv" url="output.csv">
  #Use empty quote to turn off quoting
    quote=
</connection>
<connection id="java" driver="janino" classpath="../lib/janino.jar"/>
   <script connection-id="out"><!--Writing header if necessary-->
   Name,Age,VIP
   </script>
<query connection-id="in">
    <!--Empty CSV query means select all-->
    <script connection-id="java">
      import java.io.*;
       String ntteCode;
    Object o = get("Age");
    if (o == null)
        ntteCode = "";
    else
        ntteCode = o.toString().trim();
        system.out.println("-----------"+ntteCode);
    </script>
</query>
</etl>

And here is the exception that I get when I run the etl.xml from command prompt.

E:\scriptella-1.0>java -jar scriptella.jar jstack_etl.xml
Apr 19, 2013 4:44:07 PM <INFO> Execution Progress.Initializing properties: 1%
Apr 19, 2013 4:44:07 PM <INFO> Execution Progress.Connection id=in, CsvConnection,            Dialect{CSV 1.0} registered: 2%
Apr 19, 2013 4:44:07 PM <INFO> Execution Progress.Connection id=out, CsvConnection,   Dialect{CSV 1.0} registered: 3%
Apr 19, 2013 4:44:07 PM <SEVERE> Script E:\scriptella-1.0\jstack_etl.xml execution failed.
Unable to initialize driver for ConnectionParameters{properties={}, url='null',   user='null', password='null', schema='null', catalog='null'}
:Unable to instantiate driver for class scriptella.driver.janino.Driver
Janino provider exception: Janino not found on the class path. Check if connection    classpath attribute points to janino.jar
Error codes: []
Driver exception: java.lang.ClassNotFoundException: org.codehaus.janino.ScriptEvaluator
Это было полезно?

Решение

You need to download the janino driver here: http://dist.codehaus.org/janino/changelog.html

copy the following libraries to the scriptella/lib directory:

  • commons-compiler.jar
  • janino.jar
  • commons-compiler-jdk.jar

Try to start scriptella with the script in the bin directory:

  • scriptella.bat
  • scriptella.sh

This script will add the libraries to the classpath. You can add the libraries also manually with this command:

java -classpath lib/commons-compiler.jar;lib/janino.jar;lib/commons-compiler-jdk.jar -jar scriptella.jar jstack_etl.xml
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top