TeamCity error: %1 is not a valid Win32 application

I posted a question about this on Stack Overflow:

http://stackoverflow.com/q/16671877/24874

Here's a copy of the text:

---------------


I'm trying to configure Git as a VCS for TeamCity 7.1.2.

When running a build, I'm seeing the following error:

> jetbrains.buildServer.vcs.VcsException: 'git fetch' command failed.
> exception: Cannot run program "c:\TeamCity\jre\bin\java" (in directory "C:\ProgramData\JetBrains\TeamCity\system\caches\git\git-5BB95C96.git"): CreateProcess error=193, %1 is not a valid Win32 application

If I cd to that path in a terminal on the build server and attempt to run the referenced java binary, it runs properly.

The full stack trace is:

    jetbrains.buildServer.vcs.VcsException: 'git fetch' command failed.
    exception: Cannot run program "c:\TeamCity\jre\bin\java" (in directory "C:\ProgramData\JetBrains\TeamCity\system\caches\git\git-5BB95C96.git"): CreateProcess error=193, %1 is not a valid Win32 application
        at jetbrains.buildServer.buildTriggers.vcs.git.CommandLineUtil.getCommandLineError(CommandLineUtil.java:44)
        at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetchInSeparateProcess(FetchCommandImpl.java:132)
        at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetch(FetchCommandImpl.java:70)
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.fetch(GitVcsSupport.java:391)
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.fetch(GitVcsSupport.java:407)
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.fetchBranchData(GitVcsSupport.java:377)
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.ensureRevCommitLoaded(GitVcsSupport.java:246)
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.buildPatch(GitVcsSupport.java:216)
        at jetbrains.buildServer.serverSide.impl.projectSources.BuildPatchUtil.buildPatch(BuildPatchUtil.java:1)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.buildCleanPatchToStream(PatchComposer.java:115)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.access$100(PatchComposer.java:104)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer$2.constructPatch(PatchComposer.java:1)
        at jetbrains.buildServer.serverSide.impl.projectSources.SmallPatchCache.getCachedCleanPatch(SmallPatchCache.java:12)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchCacheImpl.requestCachedPatch(PatchCacheImpl.java:5)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.getOrMakeCacheableCleanPatch(PatchComposer.java:153)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.makePatch(PatchComposer.java:141)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.buildPatchForRoot(PatchComposer.java:46)
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.buildPatch(PatchComposer.java:0)
        at jetbrains.buildServer.serverSide.impl.BuildTypeImpl.buildPatch(BuildTypeImpl.java:59)
        at jetbrains.buildServer.serverSide.impl.BuildStarter$2.call(BuildStarter.java:4)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Can anyone suggest something to try?

5 comments
Comment actions Permalink

Hi,

do you use parameters in the git VCS root?

0
Comment actions Permalink

Hi Dmitry,

No, I don't use any parameters.

Drew.

0
Comment actions Permalink

Please try adding the following to the .BuildServer/config/internal.properties (create it if it doesn't exist):

teamcity.git.fetch.process.java.exec=c:\\TeamCity\\jre\\bin\\java.exe

Let me know if it helps.

0
Comment actions Permalink

Hi Dmitry,

I added the line as described (although the file path was slightly different: /BuildServer/conf/internal.properties) but I still see the same message when attempting a build.

Is there anything else I can try? Unfortunately I only have intermittent access to the build environment, as and when I'm working with that client.

Drew.

0
Comment actions Permalink

Drew,

are you sure /BuildServer/conf/internal.properties is a correct path? I ask because usually git caches are placed under TEAMCITY_DATA_DIR/system/caches/git, in your case it is C:\ProgramData\JetBrains\TeamCity\system\caches\git\git-5BB95C96.git,therefore TEAMCITY_DATA_DIR is C:\ProgramData\JetBrains\TeamCity and internal.properties should be at C:\ProgramData\JetBrains\TeamCity\config\internal.properties.

Also please check that there is no file c:\TeamCity\jre\bin\java (without .exe in the end).

If that doesn't help, you can workaround the problem by disabling git fetch in a separate process. To do that add the following to internal.properties:

teamcity.git.fetch.separate.process=false

With such an option git-plugin runs the fetch in a TeamCity server process. This setup has its drawbacks - TeamCity server can run out of memory because fetch requires amount of RAM proportional to the biggest object in the repository. So if you store large binaries in git consider increasing amount of memory for TeamCity server.

0

Please sign in to leave a comment.