2017-07-23 3 views
0

Ich führe eine Jar-Datei, aber ich bekomme die folgenden Fehler, wenn ich eine Datei hochladen möchte (die existiert).Kein Protokollfehler, Java, beim Hochladen der Datei

[email protected]:~/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) 

Der Teil der AppInterface.java Datei, wo der Fehler erzeugt wird, ist (I kommentierte Linie 140 für eine einfache 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; 

Die Optionen für den send Befehl sind:

- 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" 

ich habe folgendes versucht:

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" 

Aber es gibt immer noch den gleichen Fehler. Ich weiß nicht, wo das Problem liegt. Danke

+0

Eigentlich sind die Optionen für den Befehl: 'senden Sie eine LO (test LO.xml) in den LTserver, Sprache ist auf Tschechisch festgelegt. test.xml muss sich im Verzeichnis Docs befinden, wie in der Eigenschaftendatei angegeben. \t $ java -jar lt4el-cmd.jar senden -l cs "test LO.xml" Standardmäßig ist ID ein Dateiname ("test LO.xml" in unserem Beispiel). Um eine andere ID zuzuweisen, können Sie sie dem Dateinamen voranstellen (getrennt durch einen Doppelpunkt). Z.B. um die Lernobjekt-ID "lo1" zu geben: \t $ java -jar lt4el-cmd.jar send -l cs "lo1: test LO.xml" 'Also' file: 'dient nur dazu, ihm einen Namen zu geben. Ich weiß nicht, ob das hilft – TheSolider

+0

Sortierung: Ich weiß jetzt, dass Sie nicht versuchen, die Datei über eine URL mit dem Dateischema zu übergeben, so dass mein vorheriger Kommentar nutzlos ist. Keine Ahnung, warum du das bekommst. Fehler beim Abrufen der URL: no protocol: Here.doc' though; Es scheint so, als ob du dich nicht um URLs kümmern solltest und die Anwendung sollte sie alleine behandeln. Von dem, was ich bekomme, sollten Sie jedoch zwei Dinge in Ihrer Argumentation passieren; In ihrem Beispiel entspricht "test LO.xml" zwei Dateien, einer "test.xml", die sich im Verzeichnis Docs befinden muss, und einer "LO.xml", die davon ausgeht, dass sie sich im aktuellen Verzeichnis befindet. – Aaron

+0

Ich dachte, das war nur ein Tippfehler und der Name der Datei ist tatsächlich 'test LO.xml' – TheSolider

Antwort

0

Die Spezifikationen erforderten tatsächlich eine HTTP-URL und ich gab es eine Datei von meinem lokalen System als file:///, die es nicht als FTP auflösen konnte. Daher erhielt ich: ERROR [Thread-1]: Error getting url: no protocol: . . .. Um es zu umgehen, legte ich die Datei auf dem XAMPP-Server - path/to/opt/lampp/htdocs/file - und konnte es durch überprüfen: , die eine gültige HTTP-URL war.