报错:
Exception in thread "Thread-18" java.lang.InstantiationError: sun.net.ftp.FtpClient
at com.aio.util.FtpUtils.connectServer(FtpUtils.java:60)
at com.aio.util.FtpListener$1.run(FtpListener.java:53)
java.lang.NullPointerException
at com.aio.util.DWRScriptSessionListener.sessionDestroyed(DWRScriptSessionListener.java:30)
at org.directwebremoting.impl.DefaultScriptSessionManager.fireScriptSessionDestroyedEvent(DefaultScriptSessionManager.java:456)
at org.directwebremoting.impl.DefaultScriptSessionManager.invalidate(DefaultScriptSessionManager.java:362)
at org.directwebremoting.impl.DefaultScriptSession.invalidate(DefaultScriptSession.java:139)
at org.directwebremoting.impl.DefaultScriptSession.invalidateIfNeeded(DefaultScriptSession.java:391)
at org.directwebremoting.impl.DefaultScriptSession.addScript(DefaultScriptSession.java:187)
at com.aio.util.MessagePush$4.run(MessagePush.java:74)
at org.directwebremoting.impl.DefaultTaskDispatcher.dispatchTask(DefaultTaskDispatcher.java:57)
at org.directwebremoting.Browser.withAllSessions(Browser.java:74)
at org.directwebremoting.Browser.withAllSessions(Browser.java:59)
at com.aio.util.MessagePush.getCombackPregroup(MessagePush.java:79)
at com.aio.util.FtpListener$ProgressThread.run(FtpListener.java:105)
ftp链接时代码:
public boolean connectServer() {
** ftpClient = new FtpClient(); **
try {
if (this.port != -1) {
ftpClient.openServer(this.ip, this.port);
} else {
ftpClient.openServer(this.ip);
}
ftpClient.login(this.username, this.password);
if (this.path.length() != 0) {
ftpClient.cd(this.path);// path是ftp服务下主目录的子目录
}
ftpClient.binary();// 用2进制上传、下载
System.out.println("已登录到\"" + ftpClient.pwd() + "\"目录");
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
我跟踪了一下每次走到new FtpClient()时就报错,谁知道怎么解决!!!!