我正在运行一个jar文件但是当我想上传一个文件(存在)时,我收到以下错误。
ufuoma@ufuoma-VirtualBox:~/ltserver$ java -jar lt4el-cmd.jar send -l en "file:Here.doc"
ERROR [Thread-1]: Error getting url: no protocol: Here.doc (AppInterface.java:140)
AppInterface.java文件中生成错误的部分是(为了便于跟踪,我注释了第140行):
public void run() {
byte[] anaContent;
byte[] ontContent;
byte[] dceContent;
Document doc = null;
try {
//create new Document object, initial status == FAILED
DocumentStatus status = new DocumentStatus(DocumentStatus.Status.PROCESSING, "Preprocessing");
doc = new Document(id, LangCode.toInt(lang), status, true, 0);
doc.lockRW();
//add the document and process it
docControl.addDocument(doc);
} catch (Exception e) {
String error = "Error adding document: "+e.getMessage();
/*Line 140*/ log.error(error);
try {
if (doc != null) {
docControl.setDocumentStatus(doc, DocumentStatus.Status.FAILED, error);
doc.unlockRW();
}
db.sync(); //FIXME
} catch (Exception ex) {
// ignore
}
return;
}
try {
// save the document data
log.debug("reading URL...");
docControl.setDocumentStatus(doc, DocumentStatus.Status.PROCESSING, "Reading source document");
readURL(url);
} catch (Exception e) {
String error = "Error getting url: "+e.getMessage();
log.error(error);
try {
docControl.setDocumentStatus(doc, DocumentStatus.Status.FAILED, error);
doc.unlockRW();
db.sync(); //FIXME
} catch (Exception ex) {
// ignore
}
return;
send
命令的选项是:
- send a LO (test.xml) into the LTserver, language is set to Czech. test.xml must reside in the Docs directory as specified in the property file.
$ java -jar lt4el-cmd.jar send -l cs "test LO.xml"
By default, ID is a file name ("test LO.xml" in our example). To assign different ID, you can prepend it to the file name (separated by a colon). E.g. to give the learning object ID "lo1":
$ java -jar lt4el-cmd.jar send -l cs "lo1:test LO.xml"
我尝试过以下方法:
java -jar lt4el-cmd.jar send -l en "file:Here.doc"
java -jar lt4el-cmd.jar send -l en "Here.doc"
java -jar lt4el-cmd.jar send -l en "file:/path/to/Here.doc"
java -jar lt4el-cmd.jar send -l en "/path/to/Here.doc"
但它仍然会出现同样的错误。我不知道问题出在哪里。感谢
答案 0 :(得分:1)
规范实际上需要一个HTTP URL,我从本地系统给它一个文件file:///
,它无法解析为FTP。因此,我得到了:ERROR [Thread-1]: Error getting url: no protocol: . . .
。要解决此问题,我将文件放在XAMPP服务器上 - path/to/opt/lampp/htdocs/file
- 并可以通过以下方式对其进行评估:http://localhost:file
这是一个有效的HTTP网址。