- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试访问 uniprot 网站以检索蛋白质序列列表及其配置文件(XML 文件)。文件大小很大。我正在使用 JBPM 完整包附带的 eclipse。另外,我在虚拟盒子下使用ubuntu。现在,当我运行代码时,我得到了这个堆栈跟踪:
java.io.IOException: Premature EOF
at sun.net.www.http.ChunkedInputStream.fastRead(ChunkedInputStream.java:234)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:662)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2512)
at edu.uga.uniprot.amna.QueryExecuter.ExecuteQuery(QueryExecuter.java:40)
at edu.uga.uniprot.amna.Uniprot.getProteenStringByDFamily(Uniprot.java:40)
at edu.uga.uniprot.amna.Uniprot.getProteensByDFamily(Uniprot.java:55)
at org.drools.bpmn2.Process_org_drools_bpmn2_Hello_World_0.action4(Process_org_drools_bpmn2_Hello_World_0.java:60)
at org.drools.bpmn2.Process_org_drools_bpmn2_Hello_World_0Action4Invoker.execute(Process_org_drools_bpmn2_Hello_World_0Action4Invoker.java:14)
at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:47)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)
at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)
at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:188)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:302)
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:154)
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:124)
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1095)
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:306)
at com.sample.ProcessTest.main(ProcessTest.java:49)
java.lang.RuntimeException: unable to execute Action
at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:49)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)
at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)
at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:188)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:302)
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:154)
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:124)
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1095)
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:306)
at com.sample.ProcessTest.main(ProcessTest.java:49)
Caused by: java.lang.NullPointerException
at java.io.StringReader.<init>(StringReader.java:33)
at edu.uga.uniprot.amna.Uniprot.loadProteenFromString(Uniprot.java:117)
at edu.uga.uniprot.amna.Uniprot.getProteensByDFamily(Uniprot.java:58)
at org.drools.bpmn2.Process_org_drools_bpmn2_Hello_World_0.action4(Process_org_drools_bpmn2_Hello_World_0.java:60)
at org.drools.bpmn2.Process_org_drools_bpmn2_Hello_World_0Action4Invoker.execute(Process_org_drools_bpmn2_Hello_World_0Action4Invoker.java:14)
at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:47)
... 14 more
谁能帮忙解决这个错误或者是什么原因造成的?
这是生成错误的代码:
public static String ExecuteQuery(String queryURL, boolean writeFile) {
URL url;
try {
System.out.println("Strat getting Data");
String output = "";
int read;
RandomAccessFile file = null;
url = new URL(queryURL);
HttpURLConnection connection =
(HttpURLConnection) url.openConnection();
connection.setRequestProperty("Content-Type", "application/xml");
connection.connect();
//read the result from the server
if(writeFile == true) {
file = new RandomAccessFile(fileName, "rw");
}
InputStream stream = connection.getInputStream();
byte[] buffer = new byte[1024];
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
while((read = stream.read(buffer, 0, 1024)) != -1) {
//System.out.println(new String(buffer));
output = output + new String(buffer).substring(0, read);
if(writeFile == true) {
file.write(buffer, 0, read);
}
buffer = new byte[1024];
}
System.out.println(output);
return output;
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
最佳答案
此错误是由于您将 null 值传递到 Uniprot.java 第 117 行的 new StringReader() 引起的。
您可以通过堆栈跟踪看到这一点:
Caused by: java.lang.NullPointerException
at java.io.StringReader.<init>(StringReader.java:33)
at edu.uga.uniprot.amna.Uniprot.loadProteenFromString(Uniprot.java:117)
at edu.uga.uniprot.amna.Uniprot.getProteensByDFamily(Uniprot.java:58)
StringReader 的构造函数如下:
public StringReader(String s) {
this.str = s;
this.length = s.length(); // line 33
}
查看更多StringReader .
关于java - 需要修复此: java. io.IOException:过早的EOF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8286349/
我的测试代码: int SIZE = 1900; int[][] array = new int[SIZE][]; for (int i = 0; i < SIZE; i++) { array[i
我有一堆 WAV 文件和一个将它们复制到另一个目录的脚本,但使用 SoX 处理了一些文件。输出的文件都应该有 1 个 channel ,采样率不超过 44.1khz。我的大多数文件要么有一个以上的 c
我正在运行一个相当占用内存的 Python 脚本,但似乎我的机器正在提前终止进程。我安装了 16GB(并通过 lshw -class memory 确认),但我的进程似乎在使用量达到 4GB 左右时被
我很难确定在使用 .NET 的 HttpWebRequest 类调用远程服务器(特别是 REST Web 服务)时是否有办法处理潜在的连接问题。根据我的调查,WebClient 类的行为是相同的,这在
所以我有这个网址: http://test.com/afolder/who-else-wants-to-make-horror-movies%3f/ 这是 URL 编码版本: http://test.
我是一名优秀的程序员,十分优秀!