我有一个 Scriptella etl 文件,我在其中解析 csv 文件并使用示例 janino 脚本。尽管我在 libs 文件夹中找到了未找到 scriptella 的驱动程序,但我总是遇到异常。
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>
这是我从命令提示符运行 etl.xml 时遇到的异常。
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