Hi,
I am just playing around with Apache FtpServer. My plan is to integrate
it into a spring-based webapplication as a means to exchange files like
firmware-updates for client-software with embedded clients that are
distributed in the field.
I like the idea of having that server running in the same application
context and not alongside it for things like common logins, common
logging, tracking of transaction etc. I think FtpServer would be
perfectly suited to my needs.
So far I got the basic integration going, including a context listener
to start() and stop() the server and a custom UserManager to link to the
security infrastructure already in place.
Very nice. I can now log in using a ftp client!
But I can't figure out what my server is actually serving and how to
control that. I have not explicitly set up any filesystem-related
options, my context-file for setup is attached. I suspect that is
actually the problem. So here is the question:
How do I setup the filesystem?
I am running FtpServer 1.0.0 on Windows. Developing my application in
and around Spring 2.5. The IDE is Eclipse 3.3 but I doubt that that
matters. Any other relevant information I would be happy to provide.
When I connect to the server using Filezilla as a client the client
complains that it cannot list the directory while the server logs this:
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 331
User name okay, need password for admin.
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED:
OPTS UTF8 ON
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 230
User logged in, proceed.
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED: PWD
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 200
Command OPTS okay.
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED:
TYPE I
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 257
"/" is current directory.
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED: PASV
>DEBUG [org.apache.ftpserver.impl.IODataConnectionFactory] - Initiating
passive data connection
>DEBUG [org.apache.ftpserver.impl.IODataConnectionFactory] - Opening
passive data connection on address "/127.0.0.1" and port 0
>DEBUG [org.apache.ftpserver.impl.IODataConnectionFactory] - Passive
data connection created on address "/127.0.0.1" and port 0
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 200
Command TYPE okay.
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED: LIST
>DEBUG [org.apache.ftpserver.command.impl.LIST] - Listing on a
non-existing file
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 227
Entering Passive Mode (127,0,0,1,6,211)
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 450
Non-existing file
I also tried to create a directory, hoping it would show me where it was
trying to do so:
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED:
MKD AAAA
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking authorization for /AAAA
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking if file exists
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Authorized
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking authorization for /AAAA
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking if file exists
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Authorized
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED:
MKD /AAAA
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking authorization for /AAAA
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking if file exists
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Authorized
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking authorization for /AAAA
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Checking if file exists
>DEBUG [org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile] -
Authorized
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 550
Can't create directory /AAAA.
>INFO [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - RECEIVED: PASV
>DEBUG [org.apache.ftpserver.impl.IODataConnectionFactory] - Initiating
passive data connection
>DEBUG [org.apache.ftpserver.impl.IODataConnectionFactory] - Opening
passive data connection on address "/127.0.0.1" and port 0
>DEBUG [org.apache.ftpserver.impl.IODataConnectionFactory] - Passive
data connection created on address "/127.0.0.1" and port 0
>WARN [org.apache.ftpserver.listener.nio.FtpLoggingFilter] - SENT: 550
Can't create directory /AAAA.
Ciao, MM
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
<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"
anon-enabled="true" >
<listeners>
<nio-listener name="default" port="21" implicit-ssl="false" idle-timeout="300">
<!--
<ssl>
<keystore file="mykeystore.jks" password="secret" key-password="otherSecret" />
<truststore file="mytruststore.jks" password="secret"/>
</ssl>
-->
<data-connection idle-timeout="60">
<active enabled="true" ip-check="false"/>
<passive/>
</data-connection>
</nio-listener>
</listeners>
<user-manager>
<beans:bean class="de.luematic.tacho.ftp.UserManager">
<beans:property name="tacho" ref="tacho" />
</beans:bean>
</user-manager>
</server>
</beans:beans>