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 Ian Goodacre <Ia...@xtra.co.nz> on 2011/08/26 12:54:41 UTC

windows service ftpd.exe

Hi all,

Can anyone point me to the source for ftpd.exe?

I have configured logging to SQL Server using the included JDBCAppender
and Microsoft SQL Server JDBC Driver 3.0 connecting to SQL Server 2008
on Windows Server 2008.

When I run from command line with ftpd.bat it works fine. I can run
ftpd.bat as a service using srvany and this also works.

But, when I use the provided service wrapper (service install, ftpdw,
etc.) JDBC driver manager reports it can't find a driver.

The configuration (other than the service wrapper) is the same in all
cases. I have tried running the service as SYSTEM and a regular user -
no difference.

So, I would like to see what the service wrapper is doing. I see the
executable but I don't see the source is the source zip.

Any pointers would be appreciated.

Regards,
Ian


Re: windows service ftpd.exe

Posted by Ian Goodacre <Ia...@xtra.co.nz>.
Hi Sai,

Thank you very much for your assistance.

I finally got it working!!

What made the difference was adding a driver specification to the log4j
appender definition in log4j.properties. I now have:

log4j.appender.S=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.S.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
log4j.appender.S.URL=jdbc:sqlserver://aphrodite;databaseName=MobileFrame;integratedSecurity=true;
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.sql=INSERT INTO [dbo].[XW_FTPLOG] (LEVEL, LOG_TIME,
LOGIN, REMOTE_IP, MESSAGE) VALUES ( '%5p', '%d', '%X{userName}', '%
X{remoteIp}', '%m%n' );

Previously, the log4j.appender.S.driver line wasn't there. Why it found
the driver without it when run from the command line but didn't find it
when run as a service I have no idea. But now it is working beautifully.

Now my only problem is log messages with single quotes in them. I
understand other implementations of JDBCAppender deal with that better,
or maybe I can add a filter to log4j to escape them.

Thanks again,
Ian


Re: windows service ftpd.exe

Posted by Ian Goodacre <Ia...@xtra.co.nz>.
Yes, ftpdw.exe runs and all the parameters look OK (though this is a
very uninformed assessment). In particular, classpath is the same as
when run from the command line.

My understanding is that the java bin folder is in the library path by
default and I don't see any failed attempt to find the DLL in the logs
from process monitor. It is more as is the driver rejects the URI before
getting to authentication. The driver jar file is being opened and read
successfully when running as a service, so no permissions issues there.


I added '-D C:\java\jdk1.7.0\bin' to Java Options using ftpdw.exe,
restarted the service and got the same error.

UAC is turned off.

I have attached error.log and ftpd.log after setting log4j log level to
TRACE, but I suspect the error has occurred before anything is written
to the log.

Do you know a way to get more information from the JDBC driver manager
and/or Microsoft SQL Server JDBC driver?

On Fri, 2011-08-26 at 18:23 -0500, Sai Pullabhotla wrote:
> Can you run the ftpdw.exe from the bin folder of the FTP server
> folder? If it does launch, go to the Java tab and make sure all
> settings (JVM path, Java Class Path). Make sure the folder in which
> you placed the DLL is in java.library.path. I'm not quite sure if jre
> \bin is automatically searched for DLLs or not. You can also place the
> DLL in any other folder and hopefully be able to add the path for the
> DLL in the ftpdw.exe window (under the Java Options using -D option). 
> 
> If everything looks good, then I suspect you might be running into
> some permissions issue on the jar/dlls. Make sure the service is
> running under the correct profile (local system account or another
> valid local/domain profile) that has appropriate permissions to the
> FTP server folder and sub-folders. Finally, if UAC is ON, I would try
> turning that off temporarily and see if you get better luck. 
> 
> If none of this works, posting the log file (in debug mode) with
> complete stacktrace might help. 
> 
> Sai Pullabhotla


Re: windows service ftpd.exe

Posted by Sai Pullabhotla <sa...@jmethods.com>.
Can you run the ftpdw.exe from the bin folder of the FTP server folder? If
it does launch, go to the Java tab and make sure all settings (JVM path,
Java Class Path). Make sure the folder in which you placed the DLL is in
java.library.path. I'm not quite sure if jre\bin is automatically searched
for DLLs or not. You can also place the DLL in any other folder and
hopefully be able to add the path for the DLL in the ftpdw.exe window (under
the Java Options using -D option).

If everything looks good, then I suspect you might be running into some
permissions issue on the jar/dlls. Make sure the service is running under
the correct profile (local system account or another valid local/domain
profile) that has appropriate permissions to the FTP server folder and
sub-folders. Finally, if UAC is ON, I would try turning that off temporarily
and see if you get better luck.

If none of this works, posting the log file (in debug mode) with complete
stacktrace might help.

Sai Pullabhotla


On Fri, Aug 26, 2011 at 5:46 PM, Ian Goodacre <Ia...@xtra.co.nz>wrote:

> Hi Sai,
>
> I too have been thinking of class and library path.
>
> I didn't change either: I added the SQL Server driver jar to ftpserver's
> common\lib folder and the dll to java's bin folder.
>
> If I delete sqljdbc4.jar from the lib folder I get the same error when
> running from the command line as the service produces but when I run the
> service with the jar present I can see with process monitor that the jar
> is found and read (at least in part) and that ftpd.exe reads classpath
> from the registry and it includes this jar. So, I think the classpath is
> OK and the jar is found by the service OK.
>
> Interestingly, when run as a service, the error is produced before
> sqljdbc_auth.dll is read. In fact, I found no reference to
> sqljdbc_auth.dll.
>
> When I run from the batch file much more of sqljdbc4.jar is read, there
> are interactions with SQL Server and, eventually, sqljdbc_auth.dll is
> also read.
>
> So, it appears that for some reason when run as a service sqljdbc4.jar
> is accessed but for some reason doesn't accept the URI, without even
> communicating with SQL Server.
>
> Ian
>
>
>
>
>
>

Re: windows service ftpd.exe

Posted by Ian Goodacre <Ia...@xtra.co.nz>.
Hi Sai,

I too have been thinking of class and library path.

I didn't change either: I added the SQL Server driver jar to ftpserver's
common\lib folder and the dll to java's bin folder.

If I delete sqljdbc4.jar from the lib folder I get the same error when
running from the command line as the service produces but when I run the
service with the jar present I can see with process monitor that the jar
is found and read (at least in part) and that ftpd.exe reads classpath
from the registry and it includes this jar. So, I think the classpath is
OK and the jar is found by the service OK.

Interestingly, when run as a service, the error is produced before
sqljdbc_auth.dll is read. In fact, I found no reference to
sqljdbc_auth.dll.

When I run from the batch file much more of sqljdbc4.jar is read, there
are interactions with SQL Server and, eventually, sqljdbc_auth.dll is
also read.

So, it appears that for some reason when run as a service sqljdbc4.jar
is accessed but for some reason doesn't accept the URI, without even
communicating with SQL Server.

Ian






Re: windows service ftpd.exe

Posted by Sai Pullabhotla <sa...@jmethods.com>.
Looks like a class path issue to me. Where did you update the classpath to
include the Jar file for the SQL Server driver?

Sai Pullabhotla


On Fri, Aug 26, 2011 at 5:54 AM, Ian Goodacre <Ia...@xtra.co.nz>wrote:

> Hi all,
>
> Can anyone point me to the source for ftpd.exe?
>
> I have configured logging to SQL Server using the included JDBCAppender
> and Microsoft SQL Server JDBC Driver 3.0 connecting to SQL Server 2008
> on Windows Server 2008.
>
> When I run from command line with ftpd.bat it works fine. I can run
> ftpd.bat as a service using srvany and this also works.
>
> But, when I use the provided service wrapper (service install, ftpdw,
> etc.) JDBC driver manager reports it can't find a driver.
>
> The configuration (other than the service wrapper) is the same in all
> cases. I have tried running the service as SYSTEM and a regular user -
> no difference.
>
> So, I would like to see what the service wrapper is doing. I see the
> executable but I don't see the source is the source zip.
>
> Any pointers would be appreciated.
>
> Regards,
> Ian
>
>