Servlets 在unix上的Weblogic服务器上使用JSCH scp时线程卡住

Servlets 在unix上的Weblogic服务器上使用JSCH scp时线程卡住,servlets,ftp,zip,weblogic,jsch,Servlets,Ftp,Zip,Weblogic,Jsch,我在部署在LinuxEnv上的WebLogicServer上的web应用程序中使用JSCH从LinuxBox复制文件。但是我得到了暂停时间 线程-489“[Stick]ExecuteThread:'57'用于队列:'weblogic.kernel.Default(自调优)'” 我的JSCH代码如下: try { JSch jsch=new JSch(); Session session = jsch.getSession("us

我在部署在LinuxEnv上的WebLogicServer上的web应用程序中使用JSCH从LinuxBox复制文件。但是我得到了暂停时间

线程-489“[Stick]ExecuteThread:'57'用于队列:'weblogic.kernel.Default(自调优)'” 我的JSCH代码如下:

        try
    {

        JSch jsch=new JSch();
            Session session = jsch.getSession("username", "hostname", 22);
            session.setPassword("password");
    java.util.Properties config = new java.util.Properties();
    config.put("StrictHostKeyChecking", "no");
    session.setConfig(config);
    session.connect();
            ZipEntry zipEntry = new ZipEntry("filename.trace");
    zos.putNextEntry(zipEntry);
       String rfile= "filename.trace";


       log.debug("Remote File: "+rfile);

      String command="scp -f "+rfile;

      log.debug("Trace shell command: "+command);

      Channel channel=session.openChannel("exec");
      ((ChannelExec)channel).setCommand(command);

      log.debug("Trace shell command set.");

      // get I/O streams for remote scp
      OutputStream out=channel.getOutputStream();
      InputStream in=channel.getInputStream();

      channel.connect();
      log.debug("Trace shell command executed.");
      byte[] buf=new byte[1024];

      // send '\0'
      buf[0]=0; 
      out.write(buf, 0, 1); 
      out.flush();

      while(true){
    int c= checkAck(in);
        if(c!='C'){
      break;
    }

        // read '0644 '
        in.read(buf, 0, 5);

        long filesize=0L;
        while(true){
          if(in.read(buf, 0, 1)<0){
            // error
            break; 
          }
          if(buf[0]==' ')break;
          filesize=filesize*10L+(long)(buf[0]-'0');
        }

        String file=null;
        for(int i=0;;i++){
          in.read(buf, i, 1);
          if(buf[i]==(byte)0x0a){
            file=new String(buf, 0, i);
            break;
      }
        }

    log.debug("filesize="+filesize+", file="+file);

        // send '\0'
        buf[0]=0;
        out.write(buf, 0, 1); 
        out.flush();

        // read a content of lfile

         //fos=new FileOutputStream(prefix==null ? lfile : prefix+file);
        int foo;
        while(true){
          if(buf.length<filesize) foo=buf.length;
      else foo=(int)filesize;
          foo=in.read(buf, 0, foo);
          if(foo<0){
            // error 
            break;
          }
          zos.write(buf, 0, foo);
          filesize-=foo;
          if(filesize==0L) break;
        }
        //fos.close();

        //fos=null;

    if(checkAck(in)!=0){
      //System.exit(0);
        throw new Exception();
    }


        // send '\0'
        buf[0]=0;zos.write(buf, 0, 1); zos.flush();

        //in.close();
      } 
      zos.closeEntry();
      in.close();
    }
    catch(Exception e){
      log.debug(e);
      e.printStackTrace();
      try{if(zos!=null)zos.closeEntry();}catch(Exception ee){throw new Exception(ee);}
    }
以下是env的详细信息 AppServer:Weblogic 10.3.4 Appserver:Linux 位于Linux box上的远程文件 Java版本:1.6


你知道是什么导致了这个问题吗?

你的代码进展得有多快?你有卡住的线路号吗?你确定你实际上正在突破你的
,而
循环,并且它们没有被无限地卡住代码被卡住在int c=checkAck(in);根据这一点,你不应该使用这个
checkAck
,尽管这个家伙有一个类似的问题,我删除了checkAck,代码现在没有挂起。但是我得到的文件大小是0字节。我在本地WindowsEnv上安装的weblogic上实现了这一点。由于我们调用本机脚本,Linux环境上的行为会有所不同吗?由于它是我正在向ZipoutStream写入的web应用程序,这会是一个问题吗?实际错误是“code']”,这超过了配置的时间(StuckThreadMaxTime)为“600”秒。堆栈跟踪:Thread-564“[STUCK]ExecuteThread:'61'用于队列:'weblogic.kernel.Default(自调优)'”{--正在等待通知:com.jcraft.jsch.Channel$MyPipedInputStream@1e23d780[fat lock]java.io.PipedInputStream.read(PipedInputStream.java:288)“代码”
           ZipEntry zipEntry = new ZipEntry(remotefile);
       zos.putNextEntry(zipEntry);         

       String command="scp -f "+remotefile;

       Channel channel=session.openChannel("exec");
       ((ChannelExec)channel).setCommand(command);



       InputStream in=channel.getInputStream();
       channel.connect();

        byte[] bytes = new byte[1024];
        int length;

        //log.debug("length:"+in.read(bytes));

        while ((length = in.read(bytes)) >= 0) 
        {
            log.debug("length:"+length);
            zos.write(bytes, 0, length);
        }

        //log.debug(""+);
        zos.flush();
        zos.closeEntry();
        in.close();``