Hi Heiner. Thanks for the quick response. I tried something like this already, no change. If I try the remote Port Forwarding with Putty on 778, it works fine. All systems are windows systems at the moment, so I guess this is not the problem.
Any other ideas? Or any hint how to get a more concrete idea what happens? Thanks a lot Bernd -----Ursprüngliche Nachricht----- Von: Heiner Westphal [mailto:westp...@verit.de] Gesendet: Freitag, 16. Oktober 2009 23:43 An: Bernd Rücker Cc: jsch-users@lists.sourceforge.net Betreff: Re: [JSch-users] Remote Port Forwarding gives exception Hi Bernd, wild guess: port 778 is < 1024 and thus restricted to admin/root access by many operating systems. Maybe you give port 7778 a try? Have fun, Heiner Bernd Rücker wrote: > Hi all. > > > > I have a problem with Jsch for remote port forwarding. I set up a > connection without problems. Local port forwarding works as well. > > > > But when using remote port forwarding: > > session.setPortForwardingR(778, "localhost", 3306); > > > > I get an exception: > > Caused by: _com.jcraft.jsch.JSchException_: remote port forwarding > failed for listen port 778 > > at com.jcraft.jsch.Session.setPortForwarding(_Session.java:1658_) > > at com.jcraft.jsch.Session.setPortForwardingR(_Session.java:1597_) > > at com.jcraft.jsch.Session.setPortForwardingR(_Session.java:1587_) > > at > com.camunda.bpp.gatekeeper.agents.SshAgent.start(_SshAgent.java:47_) > > > > Anybody any idea? > > > > When I use remote port forwarding via Putty or another SSH client, it > works fine, so it must be a problem with Jsch. Any help would be > appreciated! > > > > By the way, the Exception is thrown because of a reply=0 (whatever that > means?): > > > > private void setPortForwarding(String bind_address, int rport) throws > JSchException{ > > synchronized(grr){ > > Buffer buf=new Buffer(100); // ?? > > Packet packet=new Packet(buf); > > > > String address_to_bind=ChannelForwardedTCPIP.normalize(bind_address); > > > > try{ > > // byte SSH_MSG_GLOBAL_REQUEST 80 > > // string "tcpip-forward" > > // boolean want_reply > > // string address_to_bind > > // uint32 port number to bind > > packet.reset(); > > buf.putByte((byte) SSH_MSG_GLOBAL_REQUEST); > > buf.putString("tcpip-forward".getBytes()); > > // buf.putByte((byte)0); > > buf.putByte((byte)1); > > buf.putString(address_to_bind.getBytes()); > > buf.putInt(rport); > > write(packet); > > } > > catch(Exception e){ > > if(e instanceof Throwable) > > throw new JSchException(e.toString(), (Throwable)e); > > throw new JSchException(e.toString()); > > } > > > > grr.setThread(Thread.currentThread()); > > try{ Thread.sleep(10000);} > > catch(Exception e){ > > } > > int reply=grr.getReply(); > > grr.setThread(null); > > if(reply==0){ > > throw new JSchException("remote port forwarding failed for listen > port "+rport); > > } > > } > > } > > > > Cheers > > Bernd > > > > > ------------------------------------------------------------------------ > > -------------------------------------------------------------------------- ---- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > > > ------------------------------------------------------------------------ > > _______________________________________________ > JSch-users mailing list > JSch-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jsch-users -- Heiner Westphal verit Informationssysteme GmbH Europaallee 10 67657 Kaiserslautern E-Mail: heiner.westp...@verit.de Telefon: +49 631 520 840 00 Telefax: +49 631 520 840 01 Web: http://www.verit.de Registergericht: Amtsgericht Kaiserslautern Registernummer: HRB 3751 Geschäftsleitung: Michael Schneider, Torsten Stolpmann ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ JSch-users mailing list JSch-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jsch-users