Bitbucket startup throws "Caused by: java.lang.IllegalArgumentException: NTFS ADS separator (':') in file name is forbidden." error after upgrade
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
After upgrading Bitbucket application to v7.13+ on a Windows VM, the application is not starting.
Environment
Windows server running Bitbucket v7.13+
Diagnosis
The following appears in the atlassian-bitbucket.log
:
2022-04-06 11:16:03,595 INFO [main] c.a.b.i.b.BitbucketServerApplication Starting BitbucketServerApplication v7.21.0 using Java 1.8.0_92 on XXXXXXX with PID 3652 (J:\Application\atlassian-bitbucket-7.21.0\atlassian-bitbucket-7.21.0\app\WEB-INF\classes started by xxxxxxx in J:\Application\atlassian-bitbucket-7.21.0\atlassian-bitbucket-7.21.0\bin)
....
2022-04-06 11:25:20,361 DEBUG [spring-startup] c.a.s.i.e.SingletonEventExecutorFactory Executor service has shutdown gracefully
2022-04-06 11:25:20,363 INFO [spring-startup] com.zaxxer.hikari.HikariDataSource bitbucket - Shutdown initiated...
2022-04-06 11:25:20,369 INFO [spring-startup] com.zaxxer.hikari.HikariDataSource bitbucket - Shutdown completed.
2022-04-06 11:25:20,372 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Releasing lock on J:\Application\bitbucket-home
2022-04-06 11:25:20,382 ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gitAuthHelper' defined in com.atlassian.stash.internal.scm.git.GitWiring: Unsatisfied dependency expressed through method 'gitAuthHelper' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gitScmConfig' defined in com.atlassian.stash.internal.scm.git.GitWiring: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.scm.git.GitScmConfig]: Factory method 'gitScmConfig' threw exception; nested exception is java.lang.IllegalArgumentException: NTFS ADS separator (':') in file name is forbidden.
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at java.lang.Thread.run(Thread.java:745)
... 18 frames trimmed
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gitScmConfig' defined in com.atlassian.stash.internal.scm.git.GitWiring: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.scm.git.GitScmConfig]: Factory method 'gitScmConfig' threw exception; nested exception is java.lang.IllegalArgumentException: NTFS ADS separator (':') in file name is forbidden.
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
... 5 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.scm.git.GitScmConfig]: Factory method 'gitScmConfig' threw exception; nested exception is java.lang.IllegalArgumentException: NTFS ADS separator (':') in file name is forbidden.
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
... 5 common frames omitted
Caused by: java.lang.IllegalArgumentException: NTFS ADS separator (':') in file name is forbidden.
at org.apache.commons.io.FilenameUtils.indexOfExtension(FilenameUtils.java:746)
at com.atlassian.stash.internal.scm.git.binary.DefaultGitBinaryHelper.applyExtension(DefaultGitBinaryHelper.java:89)
at com.atlassian.stash.internal.scm.git.binary.DefaultGitBinaryHelper.find(DefaultGitBinaryHelper.java:102)
at com.atlassian.stash.internal.scm.git.DefaultGitScmConfig.findBinary(DefaultGitScmConfig.java:647)
at com.atlassian.stash.internal.scm.git.DefaultGitScmConfig.<init>(DefaultGitScmConfig.java:175)
at com.atlassian.stash.internal.scm.git.GitWiring.gitScmConfig(GitWiring.java:374)
at com.atlassian.stash.internal.scm.git.GitWiring$$EnhancerBySpringCGLIB$$748618ac.CGLIB$gitScmConfig$1(<generated>)
Cause
Starting Bitbucket v7.13, the Apache commons.io.libversion
library was upgraded to v2.8. This included new handling of NTFS ADS filenames. Due to this change, on Windows Servers the file path or directory names should be passed with double slash(\\) instead of single slash(\) in Property files.
For example, say if the bitbucket.properties file contains below property to define the Git executable directory, on a Windows VM the Bitbucket application will fail to start on Bitbucket v7.13 or higher, with the above error.
plugin.bitbucket-git.path.executable=J:\path\to\git\bin\
Solution
After upgrading to Bitbucket v7.13 or higher on Windows, the solution is to update the all file path or directory names for all properties with double slash(\\) in the bitbucket.properties file. The application should now start without any errors.
For example,
plugin.bitbucket-git.path.executable=J:\\path\\to\\git\\bin\\