Reputation: 482
I'm running a jar file but I get the following errors when I want to upload a file (which exists).
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)
The part of the AppInterface.java file where the error is generated is (I commented line 140 for easy tracking):
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;
The options for the send
command are:
- 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"
I've tried the following:
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"
But it still gives the same error. I don't know where the problem is. Thanks
Upvotes: 0
Views: 811
Reputation: 482
The specifications actually required a HTTP url and I was giving it a file from my local system as file:///
which it couldn't resolve as FTP. Hence, I was getting: ERROR [Thread-1]: Error getting url: no protocol: . . .
. To workaround it, I put the file on the XAMPP server - path/to/opt/lampp/htdocs/file
- and could assess it through: http://localhost:file
which was a valid HTTP url.
Upvotes: 1