编译程序报错如下:
java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2438)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1245)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at com.tzsw.BigScreen.displayfile(BigScreen.java:968)
at com.tzsw.BigScreen$17.run(BigScreen.java:939)
at java.util.TimerThread.mainLoop(Timer.java:432)
at java.util.TimerThread.run(Timer.java:382)
到底什么原因有没有人知道,我用的服务器事Tomcat,数据库用Oracle,程序在Eclipse下跑的!
谁有解决方案???

解决方案 »

  1.   

    部分代码如下:
    public void displayfile() throws Exception {
        URL url = new URL(serverURL + "/screenfileservlet?deptid="+this.deptid+"&filenum="+this.filenum);
        URLConnection con = url.openConnection();
        con.setUseCaches(false);
        InputStream in = con.getInputStream();
        ObjectInputStream objStream;
        objStream = new ObjectInputStream(in);
        ScreenFile screenFile= (ScreenFile)objStream.readObject();
        if(screenFile.getCurfilenum()>screenFile.getTotalfilenum()) {
          this.filenum=1;
          displayfile();
        }
        else {
          String texttemp=screenFile.getFilecontent();
          bigscreen.setContentType("text/html");
    //如果文件过大,分成几屏,连续显示
    //System.out.println("asdfsdfasdf");
    //System.out.println((int)(texttemp.length()/fileContentLength)+1);
          if(texttemp.length()>fileContentLength && fileContentNum<=(int)(texttemp.length()/fileContentLength)) {
            if(fileContentNum==0) {
              fileColor=texttemp.substring(texttemp.indexOf("\"")+1,texttemp.indexOf("\"",texttemp.indexOf("\"")+1));
              texttemp=texttemp.substring(fileContentNum*fileContentLength,(fileContentNum+1)*fileContentLength);
              bigscreen.setText(texttemp+"</font>");
              timerflag=2;
              fileContentNum++;
            }
            else if(fileContentNum==(int)(texttemp.length()/fileContentLength)) {
              texttemp=texttemp.substring(fileContentNum*fileContentLength,texttemp.length());
              bigscreen.setText("<font color='"+fileColor+"'>"+texttemp);
              timerflag=1;
              fileContentNum=0;
              filenum++;
            }
            else {
              texttemp=texttemp.substring(fileContentNum*fileContentLength,(fileContentNum+1)*fileContentLength);
              bigscreen.setText("<font color='"+fileColor+"'>"+texttemp+"</font>");
              timerflag=2;
              fileContentNum++;
            }
          }
          else {
            bigscreen.setText(screenFile.getFilecontent());
            filenum++;
          }
        }
      }
    感觉就是这儿有问题!
      

  2.   

    自己用System.out。println()
    测试,应该是你的readObject()方法读取越位了