[英]No protocol error, java, when uploading file
我正在运行一个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"
但是它仍然给出相同的错误。 我不知道问题出在哪里。 谢谢
规范实际上需要一个HTTP URL,而我是从本地系统给它一个文件,形式为file:///
,它无法解析为FTP。 因此,我得到了: ERROR [Thread-1]: Error getting url: no protocol: . . .
ERROR [Thread-1]: Error getting url: no protocol: . . .
。 要解决此问题,我将文件放在XAMPP服务器上path/to/opt/lampp/htdocs/file
并可以通过以下方式对其进行评估: http://localhost:file
,这是一个有效的HTTP URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.