I have installed TeamCity (5.0 EAP version) on a Windows 2003 server. Both the Tomcat web server and the build agent are started as windows services.
The Subversion server is installed on a Linux server with Apache Tomcat web server. The Subversion server is protected with HTTPS.
When I tried to connect to the SVN-server through TeamCity, I always received the authentication error:
svn: Authentication required for '<https://<server name>:443>'
And the strange thing is that it worked fine if I used the SvnKit command tool, with the same user. So it was no certificate problem.
Searching the Internet for solutions always ended up with suggestions to change the svnkit.http.methods parameter.
But it had no effect on My problem. I was sure that NTLM authentication should be used, and from version 4.0.2 of TeamCity, the NTLM protocol is used by default.
Finally, I found out that SvnKit includes two NTLM implementations, the default is pure Java. But its also possible to use the native NTLM through the JNA library.
I added the svnkit.http.ntlm=jna parameter and suddenly the SVN connection was successful!!!
So much pain for this small window :-)
JNA is included in the TeamCity Windows build agent package, so its not even necessary to install it on the server.
The SvnKit parameter must be defined in two places, for the build agent and for the web server:
1. The build agent properties file, i.e. <install path>TeamCity\buildAgent\launcher\conf\wrapper.conf:
# TeamCity agent JVM parameters wrapper.app.parameter.2=-ea wrapper.app.parameter.3=-Xmx512m # The next line can be removed (and the rest of the lines renumbered) to prevent memory dumps on OutOfMemoryErrors wrapper.app.parameter.4=-XX:+HeapDumpOnOutOfMemoryError # Preventing process exiting on user log off wrapper.app.parameter.5=-Xrs # Uncomment the next line (insert the number instead of "N" and renumber the rest of the lines) to improve JVM performance # wrapper.app.parameter.N=-server wrapper.app.parameter.6=-Dlog4j.configuration=file:../conf/teamcity-agent-log4j.xml wrapper.app.parameter.7=-Dsvnkit.http.ntlm=jna wrapper.app.parameter.8=-Dteamcity_logs=../logs/ wrapper.app.parameter.9=jetbrains.buildServer.agent.AgentMain # TeamCity agent parameters wrapper.app.parameter.10=-file wrapper.app.parameter.11=../conf/buildAgent.properties
2. Configure the Tomcat web server.
Open the configuration window with <install path>TeamCity\bin\tomcat6w.exe //ES//TeamCity.
Add the SvnKit parameter in the Java tab – Java Options:
Restart both services to get the new parameter initiated.
Thanks a million for this fix. I was struggling to get our setup working for the longest time; for some reason it worked with some accounts and not others. This made subversion access over https: work as expected.
ReplyDeleteUnfortunately this dont work for me.
ReplyDeleteI use Subversion as VCS root and have a https://... URL as well.
I did these two steps but without any success.
Any further ideas?!
Thank you for your help!!!
Hey, thanks for that JNA fix, stumbled across this after working for days on a Hudson problem with Subversion over HTTP, worked great. Thanks!
ReplyDelete