TeamCity Server Startup Error

Hi,

I installed 6.0 today but ran into a server startup error. The only thing I did was to paste the authentication token. Here's some output:

java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\Daniel\.BuildServer\config\main-config.xml (The requested operation cannot be performed on a file with a user-mapped section open)
   at jetbrains.buildServer.util.FileUtil.processXmlFile(FileUtil.java:169)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionIntoMainConfigFile(VersionManager.java:192)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionToDisk(VersionManager.java:167)
   at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.writeDiskVersion(ConvertPerformer.java:104)
   at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverter(ConvertPerformer.java:96)
   at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverters(ConvertPerformer.java:78)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.upgradeIt(VersionManager.java:391)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.checkVersionsAndUpgradeSchemaIfNeeded(VersionManager.java:359)
   at jetbrains.buildServer.serverSide.versioning.VersionManager$2.run(VersionManager.java:415)
   at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withDB(TeamCityDatabaseManager.java:568)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.ensureActualDatabase(VersionManager.java:411)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerInternal(TeamCityDispatcherServlet.java:437)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerSafe(TeamCityDispatcherServlet.java:23)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.access$400(TeamCityDispatcherServlet.java:191)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet$5.run(TeamCityDispatcherServlet.java:2)
   at java.lang.Thread.run(Unknown Source)
caused by: java.io.FileNotFoundException: C:\Users\Daniel\.BuildServer\config\main-config.xml (The requested operation cannot be performed on a file with a user-mapped section open)
   at java.io.FileOutputStream.open(Native Method)
   at java.io.FileOutputStream.<init>(Unknown Source)
   at java.io.FileOutputStream.<init>(Unknown Source)
   at jetbrains.buildServer.util.FileUtil.saveDocument(FileUtil.java:175)
   at jetbrains.buildServer.util.FileUtil.processXmlFile(FileUtil.java:166)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionIntoMainConfigFile(VersionManager.java:192)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionToDisk(VersionManager.java:167)
   at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.writeDiskVersion(ConvertPerformer.java:104)
   at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverter(ConvertPerformer.java:96)
   at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverters(ConvertPerformer.java:78)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.upgradeIt(VersionManager.java:391)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.checkVersionsAndUpgradeSchemaIfNeeded(VersionManager.java:359)
   at jetbrains.buildServer.serverSide.versioning.VersionManager$2.run(VersionManager.java:415)
   at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withDB(TeamCityDatabaseManager.java:568)
   at jetbrains.buildServer.serverSide.versioning.VersionManager.ensureActualDatabase(VersionManager.java:411)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerInternal(TeamCityDispatcherServlet.java:437)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerSafe(TeamCityDispatcherServlet.java:23)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.access$400(TeamCityDispatcherServlet.java:191)
   at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet$5.run(TeamCityDispatcherServlet.java:2)
   at java.lang.Thread.run(Unknown Source)

My main-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<server rootURL="http://daniel-pc:8080">
  <version number="383" />
  <db-compact>
    <scheduler hour="3" minute="0" />
    <keep cleanup-level="EVERYTHING" days="50" builds="30" />
    <keep cleanup-level="HISTORY_ENTRY" days="40" builds="20" />
    <keep cleanup-level="ARTIFACTS" days="30" builds="10" />
  </db-compact>
  <auth-type>
    <login-module />
    <login-description />
    <guest-login allowed="true" guest-username="guest" />
    <free-registration allowed="false" />
  </auth-type>
  <artifacts maxArtifactSize="300000000" />
  <comment-transformation>
    <transformation-pattern search="((https?://|ftp://|file://|mailto:)[\w`~@#$%^&amp;*-=|\/{}()\[\];:&quot;'&lt;&gt;?\.]+(?&lt;=[^\.,;&quot;'`\)\]}]))" replace="&lt;a target=&quot;_blank&quot; title=&quot;Click to open this link in a new window&quot; href=&quot;$1&quot;&gt;$1&lt;/a&gt;" description="Links transformation (default)" />
    <transformation-pattern search="(&#xD;?&#xA;|&#xD;)" replace="&lt;br&gt;" description="Line feed transformation (default)" />
  </comment-transformation>
  <report-tab title="Code Coverage" basePath="coverage.zip" />
  <report-tab title="JavaDoc" basePath="javadoc.zip" />
  <report-tab title="StyleCop" basePath="." startPage="stylecop.html" />
</server>



And the logfile:

[2010-12-02 09:40:16,411]   INFO -   jetbrains.buildServer.SERVER - Starting TeamCity server
[2010-12-02 09:40:16,447]   INFO -   jetbrains.buildServer.SERVER - TeamCity version: 6.0 (build 15772), data format version 418
[2010-12-02 09:40:16,483]   INFO -   jetbrains.buildServer.SERVER - TeamCity data directory: C:\Users\Daniel\.BuildServer
[2010-12-02 09:40:16,897]   INFO -   jetbrains.buildServer.SERVER - Data directory format version: 379
[2010-12-02 09:40:17,279]   INFO -   jetbrains.buildServer.SERVER - Database type: HSQLDB
[2010-12-02 09:40:17,279]   INFO -   jetbrains.buildServer.SERVER - Database connection URL: jdbc:hsqldb:file:C:/Users/Daniel/.BuildServer/system/buildserver
[2010-12-02 09:40:17,710]   INFO -   jetbrains.buildServer.SERVER - Database system: HSQL Database Engine 1.8.1
[2010-12-02 09:40:17,711]   INFO -   jetbrains.buildServer.SERVER - Database driver: HSQL Database Engine Driver 1.8.1
[2010-12-02 09:40:17,711]   INFO -   jetbrains.buildServer.SERVER - Database format version: 379
[2010-12-02 09:40:17,712]   INFO -   jetbrains.buildServer.SERVER - Administrator login is required from web UI using authentication token: 8096923787605177602
[2010-12-02 09:41:54,364]   INFO - Side.versioning.VersionManager - Configuration and Database versions are 379
[2010-12-02 09:41:54,444]   INFO - de.versioning.ConvertPerformer - Converter 380[do-nothing] starting...
[2010-12-02 09:41:54,477]   INFO - de.versioning.ConvertPerformer - Converter 380[do-nothing] finished.
[2010-12-02 09:41:54,477]   INFO - de.versioning.ConvertPerformer - Converter 381[do-nothing] starting...
[2010-12-02 09:41:54,491]   INFO - de.versioning.ConvertPerformer - Converter 381[do-nothing] finished.
[2010-12-02 09:41:54,491]   INFO - de.versioning.ConvertPerformer - Converter 382[do-nothing] starting...
[2010-12-02 09:41:54,507]   INFO - de.versioning.ConvertPerformer - Converter 382[do-nothing] finished.
[2010-12-02 09:41:54,508]   INFO - de.versioning.ConvertPerformer - Converter 383[class:DeprecatedDbPropertiesFilesConverter] starting...
[2010-12-02 09:41:54,533]   INFO - de.versioning.ConvertPerformer - Converter 383[class:DeprecatedDbPropertiesFilesConverter] finished.
[2010-12-02 09:41:54,533]   INFO - de.versioning.ConvertPerformer - Converter 384[class:CreateBackupTableConverter] starting...
[2010-12-02 09:41:54,592]  ERROR -   jetbrains.buildServer.SERVER - Exception occured while applying converters
java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\Daniel\.BuildServer\config\main-config.xml (The requested operation cannot be performed on a file with a user-mapped section open)
 at jetbrains.buildServer.util.FileUtil.processXmlFile(FileUtil.java:169)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionIntoMainConfigFile(VersionManager.java:192)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionToDisk(VersionManager.java:167)
 at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.writeDiskVersion(ConvertPerformer.java:104)
 at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverter(ConvertPerformer.java:96)
 at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverters(ConvertPerformer.java:78)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.upgradeIt(VersionManager.java:391)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.checkVersionsAndUpgradeSchemaIfNeeded(VersionManager.java:359)
 at jetbrains.buildServer.serverSide.versioning.VersionManager$2.run(VersionManager.java:415)
 at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withDB(TeamCityDatabaseManager.java:568)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.ensureActualDatabase(VersionManager.java:411)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerInternal(TeamCityDispatcherServlet.java:437)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerSafe(TeamCityDispatcherServlet.java:23)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.access$400(TeamCityDispatcherServlet.java:191)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet$5.run(TeamCityDispatcherServlet.java:2)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\Daniel\.BuildServer\config\main-config.xml (The requested operation cannot be performed on a file with a user-mapped section open)
 at java.io.FileOutputStream.open(Native Method)
 at java.io.FileOutputStream.<init>(Unknown Source)
 at java.io.FileOutputStream.<init>(Unknown Source)
 at jetbrains.buildServer.util.FileUtil.saveDocument(FileUtil.java:175)
 at jetbrains.buildServer.util.FileUtil.processXmlFile(FileUtil.java:166)
 ... 15 more
[2010-12-02 09:41:54,601]  ERROR -   jetbrains.buildServer.SERVER - Server startup exception: java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\Daniel\.BuildServer\config\main-config.xml (The requested operation cannot be performed on a file with a user-mapped section open)
java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\Daniel\.BuildServer\config\main-config.xml (The requested operation cannot be performed on a file with a user-mapped section open)
 at jetbrains.buildServer.util.FileUtil.processXmlFile(FileUtil.java:169)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionIntoMainConfigFile(VersionManager.java:192)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.writeVersionToDisk(VersionManager.java:167)
 at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.writeDiskVersion(ConvertPerformer.java:104)
 at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverter(ConvertPerformer.java:96)
 at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverters(ConvertPerformer.java:78)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.upgradeIt(VersionManager.java:391)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.checkVersionsAndUpgradeSchemaIfNeeded(VersionManager.java:359)
 at jetbrains.buildServer.serverSide.versioning.VersionManager$2.run(VersionManager.java:415)
 at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withDB(TeamCityDatabaseManager.java:568)
 at jetbrains.buildServer.serverSide.versioning.VersionManager.ensureActualDatabase(VersionManager.java:411)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerInternal(TeamCityDispatcherServlet.java:437)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerSafe(TeamCityDispatcherServlet.java:23)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.access$400(TeamCityDispatcherServlet.java:191)
 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet$5.run(TeamCityDispatcherServlet.java:2)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\Daniel\.BuildServer\config\main-config.xml (The requested operation cannot be performed on a file with a user-mapped section open)
 at java.io.FileOutputStream.open(Native Method)
 at java.io.FileOutputStream.<init>(Unknown Source)
 at java.io.FileOutputStream.<init>(Unknown Source)
 at jetbrains.buildServer.util.FileUtil.saveDocument(FileUtil.java:175)
 at jetbrains.buildServer.util.FileUtil.processXmlFile(FileUtil.java:166)
 ... 15 more



What can I do?

Thanks in advance!
2 comments

Just to add: This might have been caused by my anti-virus software. Can I restart the upgrade process somehow? I have temporarily disabled AVG.

0

Ok it seems I was able to solve this problem myself. Am I a great hacker or what? :^O Anyway here's what I did:

  • Changed version number in version.dat from 383 to 384. The log file was complaining that "Data directory format version: 383" and database version was 384.
  • This alone didn't help. It seemed the number 383 was also somewhere else: "TeamCity data format version mismatch: configuration version is 383 but database version is 384." So I found the number 383 in main-config.xml, changed it to 384 then restarted server again.
  • Entered new server authentication token from teamcity-server.log.
  • Success!


Lessons learnt:

  • Always backup data directory prior to server upgrade. For me this is C:\Users\Daniel\.BuildServer. Right-click drag&drop is so easy.
  • Do not run server together with anti-virus software.


Thanks for a great product!

Daniel

0

Please sign in to leave a comment.