0
我正在使用eclipse進行開發,並且在構建路徑中包含了該包,但仍然出現此錯誤。使用ganymed-ssh2包的java scp文件
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error() that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: ch/ethz/ssh2/Connection
Push_Individual_Engine.putFile(Push_Individual_Engine.java:107)
Push_Individual_Engine.doPost(Push_Individual_Engine.java:80)
Push_Individual_Engine.doGet(Push_Individual_Engine.java:47)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.ClassNotFoundException: ch.ethz.ssh2.Connection
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
Push_Individual_Engine.putFile(Push_Individual_Engine.java:107)
Push_Individual_Engine.doPost(Push_Individual_Engine.java:80)
Push_Individual_Engine.doGet(Push_Individual_Engine.java:47)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.30 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.30
這是我使用的代碼,
private void putFile(File f){
Connection Conn = null;
try {
Conn = new Connection("servername");
ConnectionInfo info = Conn.connect();
Conn.authenticateWithPassword("username" , "password");
SCPClient SCP = new SCPClient(Conn);
SCP.put(f.toString(), "foldername", "0755");
Conn.close();
} catch (Exception e) {
try {
Conn.close();
} catch (Exception e1) {}
}
}
什麼想法?
非常感謝很多隊友......它幫助我擺脫了錯誤,但是當我試圖運行servlet文件(這是在做scp操作)時,它會提示我一個「保存文件」對話框。有關於此的任何想法? – Maverick 2011-05-11 19:36:12
我建議你問一個新的問題。 – 2011-05-11 19:37:45