users@glassfish.java.net

Using Apache Commons FTP Client With GlassFish 3.1.2

From: <forums_at_java.net>
Date: Fri, 9 Mar 2012 11:39:50 -0600 (CST)

Evening All,

We are tring to port a mission criitcal application from WebSphere V7 to
Glassfish 3.1.2.  Part of the application FTP's files down on a nightly
basis from one of our customers FTP servers.  This software has been hapily
running in a production environment for over 2 years but we are now tring to
port it to GlassFish and are getting the followind error (full stack trace
below) ...

FYI - We are using Apache commons net 3.1

*
SEVERE: java.net.SocketException: Software caused connection abort: socket
write error

*

A cut down version of the code is as follows ...

try {
   FTPClient ftpClient = new FTPClient();
   FTPClientConfig ppFTPServerConfig = new FTPClientConfig();
   ftpClient.configure(ppFTPServerConfig);
   ftpClient.connect(ftpServerName);
   ftpClient.login(ftpServerUsername, ftpServerPassword);

   int reply = ftp.getReplyCode [1]();

   if (!FTPReply.isPositiveCompletion(reply)) {
   
    System.out.println(ftpClient.listFiles());

   }
} catch (Exception e) {
 e.printStackTrace();
}

The code fails with the above exception when trying to list the files.

 Any ideas? I'm stumped

Many thanks in advance for any comments.

 

*
SEVERE: java.net.SocketException: Software caused connection abort: socket
write error
 at java.net.SocketOutputStream.socketWrite0(Native Method)
 at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
 at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
 at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
 at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
 at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
 at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
 at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
 at java.io.BufferedWriter.flush(BufferedWriter.java:254)
 at org.apache.commons.net.ftp.FTP.__send(FTP.java:501 [2])
 at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:475 [3])
 at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:552 [4])
 at org.apache.commons.net.ftp.FTP.port(FTP.java:877 [5])
 at
org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:709)
 at
org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:657)
 at
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3097)
 at
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3072)
 at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2731)
 at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2778)
 at
uk.co.acl.paypoint.sessions.FieldFaultDataPoller.downloadFieldFaultData(FieldFaultDataPoller.java:97)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at
org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
 at
org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
 at
com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)
 at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
 at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
 at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
 at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
 at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor$2.run(InterceptorManager.java:856)
 at java.security.AccessController.doPrivileged(Native Method)
 at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:853)
 at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
 at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
 at
com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)
 at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)
 at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)
 at
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
 at $Proxy212.downloadFieldFaultData(Unknown Source)
 at
uk.co.acl.paypoint.sessions.__EJB31_Generated__FieldFaultDataPoller__Intf____Bean__.downloadFieldFaultData(Unknown
Source)
 at
uk.co.acl.paypoint.gwt.server.servlets.DownloadFieldFaultDataNow.doGet(DownloadFieldFaultDataNow.java:33)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
 at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:323)
 at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:321)
 at java.security.AccessController.doPrivileged(Native Method)
 at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
 at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:356)
 at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:212)
 at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1535)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
 at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
 at
com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
 at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
 at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
 at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
 at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
 at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
 at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
 at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
 at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
 at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
 at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
 at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
 at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
 at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
 at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
 at java.lang.Thread.run(Thread.java:722)

SEVERE:  at java.net.SocketOutputStream.socketWrite0(Native Method)
SEVERE:  at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
SEVERE:  at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
SEVERE:  at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
SEVERE:  at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
SEVERE:  at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
SEVERE:  at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
SEVERE:  at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
SEVERE:  at java.io.BufferedWriter.flush(BufferedWriter.java:254)
SEVERE:  at org.apache.commons.net.ftp.FTP.__send(FTP.java:501 [6])
SEVERE:  at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:475 [7])
SEVERE:  at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:552 [8])
SEVERE:  at org.apache.commons.net.ftp.FTP.port(FTP.java:877 [9])
SEVERE:  at
org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:709)
SEVERE:  at
org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:657)
SEVERE:  at
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3097)
SEVERE:  at
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3072)
SEVERE:  at
org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2731)
SEVERE:  at
org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2778)
SEVERE:  at
uk.co.acl.paypoint.sessions.FieldFaultDataPoller.downloadFieldFaultData(FieldFaultDataPoller.java:97)
SEVERE:  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
SEVERE:  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
SEVERE:  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
SEVERE:  at java.lang.reflect.Method.invoke(Method.java:601)
SEVERE:  at
org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
SEVERE:  at
org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
SEVERE:  at
com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)
SEVERE:  at
com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
SEVERE:  at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
SEVERE:  at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
SEVERE:  at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
SEVERE:  at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)
SEVERE:  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
SEVERE:  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
SEVERE:  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
SEVERE:  at java.lang.reflect.Method.invoke(Method.java:601)
SEVERE:  at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor$2.run(InterceptorManager.java:856)
SEVERE:  at java.security.AccessController.doPrivileged(Native Method)
SEVERE:  at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:853)
SEVERE:  at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
SEVERE:  at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
SEVERE:  at
com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)
SEVERE:  at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)
SEVERE:  at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)
SEVERE:  at
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
SEVERE:  at $Proxy212.downloadFieldFaultData(Unknown Source)
SEVERE:  at
uk.co.acl.paypoint.sessions.__EJB31_Generated__FieldFaultDataPoller__Intf____Bean__.downloadFieldFaultData(Unknown
Source)
SEVERE:  at
uk.co.acl.paypoint.gwt.server.servlets.DownloadFieldFaultDataNow.doGet(DownloadFieldFaultDataNow.java:33)
SEVERE:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
SEVERE:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
SEVERE:  at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
SEVERE:  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
SEVERE:  at java.lang.reflect.Method.invoke(Method.java:601)
SEVERE:  at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:323)
SEVERE:  at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:321)
SEVERE:  at java.security.AccessController.doPrivileged(Native Method)
SEVERE:  at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
SEVERE:  at
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:356)
SEVERE:  at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:212)
SEVERE:  at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1535)
SEVERE:  at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
SEVERE:  at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
SEVERE:  at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
SEVERE:  at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
SEVERE:  at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
SEVERE:  at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
SEVERE:  at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
SEVERE:  at
com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
SEVERE:  at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
SEVERE:  at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
SEVERE:  at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
SEVERE:  at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
SEVERE:  at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
SEVERE:  at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
SEVERE:  at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
SEVERE:  at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
SEVERE:  at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
SEVERE:  at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
SEVERE:  at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
SEVERE:  at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
SEVERE:  at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
SEVERE:  at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
SEVERE:  at java.lang.Thread.run(Thread.java:722)

*

 

 


[1] ftp://ftp.getReplyCode
[2] ftp://ftp.java:501
[3] ftp://ftp.java:475
[4] ftp://ftp.java:552
[5] ftp://ftp.java:877
[6] ftp://ftp.java:501
[7] ftp://ftp.java:475
[8] ftp://ftp.java:552
[9] ftp://ftp.java:877

--
[Message sent by forum member 'kytie']
View Post: http://forums.java.net/node/884136