Setting SCM_Home To a network location gives an error

I’m using version 2.34.0

When setting SCM_Home in the scm-server.xml to a local path, then it works.
However, I want the settings and repository to be located on a network location (Which has much larger storage and faster drives).

At first I tried creating a symbolic link for the repositories directory, and it didn’t work.

I then found out about the SCM_Home settings in the scm-server.xml and set the value to “\storage\Path\SCM-Manager”
However, I get:
sonia.scm.plugin.PluginLoadException: failed to load clazz
at sonia.scm.plugin.ExtensionCollector.load(ExtensionCollector.java:209)
at sonia.scm.plugin.ExtensionCollector.collectClasses(ExtensionCollector.java:178)

Looking at the logs, I see:
ERROR sonia.scm.lifecycle.BootstrapContextListener - failed to create stage two injector
sonia.scm.plugin.PluginLoadException: failed to load clazz
.
.
.
Caused by: java.lang.ClassNotFoundException: sonia.scm.api.v2.resources.SvnConfigResource

So, I’ve created a network drive called Z:, which is mapped to \storage\Path\ and I have changed the SCM_Home to “Z:\SCM-Manager”, but now I get:
java.lang.IllegalStateException: could not create home directory at Z:\SCM-Manager

I did restart the service, and I also made sure that the service (SCM manager is running on Windows), is logged using the user that created the Z: drive, and which also have permissions to access the network location.

Error from log:
ERROR sonia.scm.lifecycle.BootstrapContextListener - received unrecoverable error during startup
java.lang.IllegalStateException: could not create home directory at Z:\SCM-Manager
at sonia.scm.BasicContextProvider.error(BasicContextProvider.java:207)
at sonia.scm.BasicContextProvider.findBaseDirectory(BasicContextProvider.java:191)
at sonia.scm.BasicContextProvider.(BasicContextProvider.java:99)
at sonia.scm.SCMContext.getContext(SCMContext.java:88)
at sonia.scm.lifecycle.BootstrapContextListener.getInjector(BootstrapContextListener.java:84)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at sonia.scm.lifecycle.BootstrapContextListener.contextInitialized(BootstrapContextListener.java:75)
at sonia.scm.lifecycle.BootstrapContextFilter.initializeContext(BootstrapContextFilter.java:74)
at sonia.scm.lifecycle.BootstrapContextFilter.init(BootstrapContextFilter.java:65)
at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:140)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:731)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:755)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:910)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.server.Server.start(Server.java:423)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
at org.eclipse.jetty.server.Server.doStart(Server.java:387)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at sonia.scm.server.ScmServer.init(ScmServer.java:130)
at sonia.scm.server.ScmServer.run(ScmServer.java:91)
at sonia.scm.server.ScmServerDaemon.main(ScmServerDaemon.java:53)

Is it even possible to have the SCM_Home placed on a network drive?

Thanks.

After some trail and error (lots of errors), I was able to make it work.
At first, as I wrote, I made a symbolic link for the repositories directory only, and it didn’t work.

Now, I’ve created a folder in C: with a symbolic link to the directory in the Storage network location (entire data, not just the repositories directory), and it seem to work.
I have no idea why using network path as \Storage\SomePath\ didn’t work, and also why creating a network drive also didn’t work.
At least I now have a workaround. I hope it will help others.

2 Likes

Thank you @saragani for sharing your solution with the community!
Really appreciated!

Can this issue investigated, as of why network path and network drive gave those errors?
sonia.scm.plugin.PluginLoadException: failed to load clazz
and
java.lang.IllegalStateException: could not create home directory at Z:\SCM-Manager

Do you want me to open an issue?

Hey @saragani,

we will open an issue on our internal issue tracker and try to figure out what went wrong. Thanks for the report.

BR, Eduard

Hi @saragani,

unfortunately, the Windows service cannot access mapped network drives because the SCM Manager service is started with the local system account. Also, the service wrapper that we use to provide a Windows service for the SCM Manager is not able to access a UNC path.

What else you could try is to change the service account to a local user account using the Windows Service Manager. This may work, but there is no guarantee that a mapped network drive will be accessible.

We would appreciate if you share your findings with us.

Matthias

But I already changed the scm-server to run as local user account, where the mapped drive was mapped in and it didn’t work (the errors that I have posted are from that scenario).

Hi @saragani,

to keep you updated: we have found many hints on how to permanently map a network share as a local system user, but none of them worked as expected. We also can’t figure out if the drive is not mapped or if there is a lack of privileges or something like that when the service starts.

We will now check if updating the underlying service wrapper to version 3.x can fix the problem. Also, at the point where the SCM Manager tries to create the home folder, we add some additional debugging information. Maybe this will give us some useful insights.

Matthias

Hi @saragani,

sorry for the late reply. Unfortunately the underlying service is still in alpha stage. We will come back to it when a stable version gets released.

Matthias