You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by maned ali <ma...@gmail.com> on 2008/09/18 15:09:54 UTC

Re: Running FTPServer in a Web/Enterprise Application

I have the exact problem; the FtpServer (with listener) starts fine, but a
FTP client (such as FileZilla Ftp client used as a test case) can only make
connections to it, and then fails (while waiting for 'welcome message').  At
the same time, my main application throws exception attached below.

The main application 'EngineServer' that embeds the FtpServer; it has a
number of threads doing other things.  The configuration for the FtpServer
is also attached below, and it is imported to the main configuration xml
used by 'EngineServer'.

*Exception in thread "pool-3-thread-2"
java.lang.IncompatibleClassChangeError
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.register(DefaultIoFilterChain.java:266)

        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.addLast(DefaultIoFilterChain.java:165)

        at
org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder.buildFilterChain(DefaultIoFilterChainBuilder.java:451)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor.addNow(AbstractPollingIoProcessor.java:415)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor.add(AbstractPollingIoProcessor.java:397)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$200(AbstractPollingIoProcessor.java:58)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:853)

        at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)

        at java.lang.Thread.run(Thread.java:613) *

*<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1
http://mina.apache.org/ftpserver/ftpserver-1.0.xsd"
        id="ftpServer">
        <listeners>
                <nio-listener name="default" port="2221"
implicit-ssl="false">
                </nio-listener>
        </listeners>
</server>*


Sisk, Brad wrote:
The homepage for Apache FTPServer says it "can be integrated into Spring
(web) applications, in addition to just running embedded on a server.
It says you just register the FTPServer class in a <beans> element in
one of Spring's Deployment Descriptor XML files.  But there is no
documentation on doing this.



We need FTPServer to be run as part of a larger web or enterprise
application, running on Glassfish server. According to the homepage,
this is possible as long as said web or enterprise application is a
Spring App.



However, when I simply add a <bean> declaration to Spring's <beans>
list, in the XML file, and place FTPServer with all the other bean
classes for the app (WEB-INF/classes), Spring DOES successfully
instantiate an FTPServer bean on startup---however, any attempt to log
iinto the FTPServer from any FTP client fails. You can't even log into
it.  It doesn't reject the login-it just times out. Never returns.
Eventually, the entire Spring App then throws an Exception-a Stack
overflow relating to some thread pool.



I can rule out some bug in the source as the cause:  it runs perfectly
fine, handles all FTP commands properly, when you just right click and
select 'Run' on the FTPServer bean, directly, In other words, works fine
as a standalone JavaApplication-but not in a Spring (web) Application.
Uploads and Downloads perfectly when run as a standalone Java app.



Has anyone gotten it to work as a bean in a Spring or other Web
application (not merely embedded as a Java Application)?  Is it true it
can be done?  What must I do to set that up in Spring?



Thanks.

Re: Running FTPServer in a Web/Enterprise Application

Posted by maned ali <ma...@gmail.com>.
 I have the exact problem; the FtpServer (with listener) starts fine, but a
FTP client (such as FileZilla Ftp client used as a test case) can only make
connections to it, and then fails (while waiting for 'welcome message').  At
the same time, my main application throws exception attached below.

The main application 'EngineServer' that embeds the FtpServer; it has a
number of threads doing other things.  The configuration for the FtpServer
is also attached below, and it is imported to the main configuration xml
used by 'EngineServer'.

*Exception in thread "pool-3-thread-2"
java.lang.IncompatibleClassChangeError
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.register(DefaultIoFilterChain.java:266)

        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.addLast(DefaultIoFilterChain.java:165)

        at
org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder.buildFilterChain(DefaultIoFilterChainBuilder.java:451)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor.addNow(AbstractPollingIoProcessor.java:415)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor.add(AbstractPollingIoProcessor.java:397)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$200(AbstractPollingIoProcessor.java:58)

        at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:853)

        at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)

        at java.lang.Thread.run(Thread.java:613) *

*<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="* <de...@mina.apache.org>*
http://mina.apache.org/ftpserver/spring/v1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1
http://mina.apache.org/ftpserver/ftpserver-1.0.xsd"
        id="ftpServer">
        <listeners>
                <nio-listener name="default" port="2221"
implicit-ssl="false">
                </nio-listener>
        </listeners>
</server>*


Sisk, Brad wrote:
The homepage for Apache FTPServer says it "can be integrated into Spring
(web) applications, in addition to just running embedded on a server.
It says you just register the FTPServer class in a <beans> element in
one of Spring's Deployment Descriptor XML files.  But there is no
documentation on doing this.



We need FTPServer to be run as part of a larger web or enterprise
application, running on Glassfish server. According to the homepage,
this is possible as long as said web or enterprise application is a
Spring App.



However, when I simply add a <bean> declaration to Spring's <beans>
list, in the XML file, and place FTPServer with all the other bean
classes for the app (WEB-INF/classes), Spring DOES successfully
instantiate an FTPServer bean on startup---however, any attempt to log
iinto the FTPServer from any FTP client fails. You can't even log into
it.  It doesn't reject the login-it just times out. Never returns.
Eventually, the entire Spring App then throws an Exception-a Stack
overflow relating to some thread pool.



I can rule out some bug in the source as the cause:  it runs perfectly
fine, handles all FTP commands properly, when you just right click and
select 'Run' on the FTPServer bean, directly, In other words, works fine
as a standalone JavaApplication-but not in a Spring (web) Application.
Uploads and Downloads perfectly when run as a standalone Java app.



Has anyone gotten it to work as a bean in a Spring or other Web
application (not merely embedded as a Java Application)?  Is it true it
can be done?  What must I do to set that up in Spring?



Thanks.