我建立了一个安全的http连接,然后尝试从中获取PERCENTAGE OF TRAIN: 1.0
The reader log level is set to INFO
Adding annotator pos
Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0.8 sec].
Adding annotator lemma
Adding annotator parse
Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ... done [0.6 sec].
Jan 17, 2017 4:55:06 PM edu.stanford.nlp.ie.machinereading.MachineReading makeResultsPrinters
INFO: Making result printers from
Jan 17, 2017 4:55:06 PM edu.stanford.nlp.ie.machinereading.MachineReading makeResultsPrinters
INFO: Making result printers from edu.stanford.nlp.ie.machinereading.RelationExtractorResultsPrinter
Jan 17, 2017 4:55:06 PM edu.stanford.nlp.ie.machinereading.MachineReading makeResultsPrinters
INFO: Making result printers from
Jan 17, 2017 4:55:06 PM edu.stanford.nlp.ie.machinereading.MachineReading loadOrMakeSerializedSentences
INFO: Parsing corpus sentences...
Jan 17, 2017 4:55:06 PM edu.stanford.nlp.ie.machinereading.MachineReading loadOrMakeSerializedSentences
INFO: These sentences will be serialized to /home/ubuntu/stanford-corenlp-full-2016-10-31/tmp/roth_sentences.ser
Jan 17, 2017 4:55:06 PM edu.stanford.nlp.ie.machinereading.domains.roth.RothCONLL04Reader read
INFO: Reading file: ../re-training-data.corp
Jan 17, 2017 4:55:07 PM edu.stanford.nlp.ie.machinereading.GenericDataSetReader preProcessSentences
SEVERE: GenericDataSetReader: Started pre-processing the corpus...
Jan 17, 2017 4:55:07 PM edu.stanford.nlp.ie.machinereading.GenericDataSetReader preProcessSentences
INFO: Annotating dataset with edu.stanford.nlp.pipeline.StanfordCoreNLP@5f9d02cb
Jan 17, 2017 4:58:32 PM edu.stanford.nlp.ie.machinereading.GenericDataSetReader preProcessSentences
SEVERE: GenericDataSetReader: Pre-processing complete.
Jan 17, 2017 4:58:32 PM edu.stanford.nlp.ie.machinereading.GenericDataSetReader parse
SEVERE: Changing NER tags using the CoreNLP pipeline.
Replacing old annotator "parse" with signature [edu.stanford.nlp.pipeline.ParserAnnotator#parse.maxlen:100;#] with new annotator with signature [edu.stanford.nlp.pipeline.ParserAnnotator##]
Adding annotator pos
Adding annotator lemma
Adding annotator ner
Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [1.4 sec].
Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [0.5 sec].
Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [0.5 sec].
Jan 17, 2017 4:58:45 PM edu.stanford.nlp.ie.machinereading.MachineReading loadOrMakeSerializedSentences
INFO: Done. Parsed 1183 sentences.
Jan 17, 2017 4:58:45 PM edu.stanford.nlp.ie.machinereading.MachineReading loadOrMakeSerializedSentences
INFO: Serializing parsed sentences to /home/ubuntu/stanford-corenlp-full-2016-10-31/tmp/roth_sentences.ser...
Exception in thread "main" java.io.FileNotFoundException: tmp/roth_sentences.ser (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at edu.stanford.nlp.io.IOUtils.writeObjectToFile(IOUtils.java:77)
at edu.stanford.nlp.io.IOUtils.writeObjectToFile(IOUtils.java:63)
at edu.stanford.nlp.ie.machinereading.MachineReading.loadOrMakeSerializedSentences(MachineReading.java:914)
at edu.stanford.nlp.ie.machinereading.MachineReading.run(MachineReading.java:270)
at edu.stanford.nlp.ie.machinereading.MachineReading.main(MachineReading.java:111
。连接发生,我能够获取数据,但我实际上是向服务器发送两个授权请求?这是我的代码,它获取连接并建立输入流:
InputStream
在调用someConnection = (HttpsURLConnection) url.openConnection();
String userPass = username + ":" + password;
String basicAuth = "Basic" + new String(new Base64().encode(userPass.getBytes()));
someConnection.setRequestProperty("Authorization", basicAuth);
if (header != null) someConnection.setRequestProperty(header, headerValue);
InputStream is = someConnection.getInputStream();
方法之前没有流量。然后我看到两个授权请求:
为什么会这样做?由于某种原因,第一个请求似乎失败了。
答案 0 :(得分:1)
“Basic”和base64编码数据之间应该有空格。
如果没有这个,Authorization标头是错误的。我猜你在第一次请求时收到401并发送下一个可能从不同来源获得的其他凭证(JAAS?)。
答案 1 :(得分:1)
标题expect
的值与预期格式不匹配,应为Authorization
后跟"Basic "
编码为{64}的Base {64}变体(关于Basic access authentication的更多细节)。
在这里,您忘记在${username}:${password}
之后添加尾随空格,以便永远不会正确执行身份验证,从而导致此意外行为。