SCM-Manager error after server restart

After installing Windows system updates, a server reboot was required.
After this, SCM Manager does not start and displays an error
Need help finding the cause of the error

SCM-Manager 2.32.2 on win server


com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInjectingConstructor]: InternalRepositoryException: failed read repository metadata
  at XmlRepositoryDAO.<init>(XmlRepositoryDAO.java:69)
  at XmlRepositoryDAO.class(XmlRepositoryDAO.java:55)
  at XmlRepositoryV1UpdateStep.<init>(XmlRepositoryV1UpdateStep.java:95)
      \_ for 2nd parameter
  while locating XmlRepositoryV1UpdateStep

Learn more:
  https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR

1 error

======================
Full classname legend:
======================
InternalRepositoryException: "sonia.scm.repository.InternalRepositoryException"
XmlRepositoryDAO:            "sonia.scm.repository.xml.XmlRepositoryDAO"
XmlRepositoryV1UpdateStep:   "sonia.scm.update.repository.XmlRepositoryV1UpdateStep"
========================
End of classname legend:
========================

	at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
	at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1103)
	at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1138)
	at sonia.scm.update.MigrationWizardModuleProvider.wizardNecessary(MigrationWizardModuleProvider.java:44)
	at sonia.scm.lifecycle.BootstrapContextListener.startEitherMigrationOrApplication(BootstrapContextListener.java:130)
	at sonia.scm.lifecycle.BootstrapContextListener.createMigrationOrNormalModuleProvider(BootstrapContextListener.java:124)
	at sonia.scm.lifecycle.BootstrapContextListener.createStageTwoInjector(BootstrapContextListener.java:117)
	at sonia.scm.lifecycle.BootstrapContextListener.getInjector(BootstrapContextListener.java:93)
	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.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	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)
Caused by: sonia.scm.repository.InternalRepositoryException: failed read repository metadata
	at sonia.scm.repository.xml.MetadataStore.read(MetadataStore.java:61)
	at sonia.scm.repository.xml.XmlRepositoryDAO.lambda$init$0(XmlRepositoryDAO.java:84)
	at sonia.scm.repository.xml.PathBasedRepositoryLocationResolver$1.lambda$forAllLocations$0(PathBasedRepositoryLocationResolver.java:124)
	at java.base/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603)
	at sonia.scm.repository.xml.PathBasedRepositoryLocationResolver$1.forAllLocations(PathBasedRepositoryLocationResolver.java:124)
	at sonia.scm.repository.xml.XmlRepositoryDAO.lambda$init$1(XmlRepositoryDAO.java:83)
	at sonia.scm.repository.xml.XmlRepositoryDAO.withWriteLockedMaps(XmlRepositoryDAO.java:225)
	at sonia.scm.repository.xml.XmlRepositoryDAO.init(XmlRepositoryDAO.java:81)
	at sonia.scm.repository.xml.XmlRepositoryDAO.<init>(XmlRepositoryDAO.java:77)
	at sonia.scm.repository.xml.XmlRepositoryDAO$$FastClassByGuice$$24386246.GUICE$TRAMPOLINE(<generated>)
	at sonia.scm.repository.xml.XmlRepositoryDAO$$FastClassByGuice$$24386246.apply(<generated>)
	at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82)
	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
	at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
	at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
	at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296)
	at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1100)
	... 36 more
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 31; columnNumber: 374; An invalid XML character (Unicode: 0xb) was found in the element content of the document.]
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:310)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:548)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:234)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:199)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:140)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:179)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:164)
	at sonia.scm.repository.xml.MetadataStore.read(MetadataStore.java:58)
	... 59 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 31; columnNumber: 374; An invalid XML character (Unicode: 0xb) was found in the element content of the document.
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1465)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2838)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:228)
	... 64 more

Hi @aleks ,

my first guess would be that one of your repositories contains an invalid character in its description. We recently fixed the issue, that the XML library we use did not filter such characters correctly, so that invalid files could be written but could not be read, which is cumbersome.

The question is, which repository is affected. If you haven’t changed too much, you will find a directory for each of your repositories in the repository directory in scm home path. In each of these, there is a file metadata.xml. If I do not mistake your trace, one of these files is broken. So you can take a look at them and search for characters like Tabs or other ASCII chard below Hex 20 (space) that are not line breaks. As I’ve mentioned, I’d expect one of these in one of the description tags.

If this does not help or if you need further information, feel free to contact us.

René

@pfeuffer I have the same issue. The version of my system is 3.7.1. I found the metadata.xml in one repo is broken, and it’s totally empty. These is no content in metadata.xml. May I know how to fix this issue? Thank you.

Hey @emeee , metadata.xml files all look the same :slight_smile:

You can take this template and recreate it:
Take the name of the directory where the metadata.xml file is stored as the id, fix the namespace and the name, set the type (git, hg or svn)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> directory_name_of_the_repository some_namespace a_repository_name git/svn/hg 1751350109573 1751350113762 false

You should be able to open the repository as an admin and set permissions again.

The question remains, why your files got corrupted. By default, SCM-Manager first creates a temporary file and replaces the old file when it is done, so no empty file ever should be created. Did you do anything out of the ordinary or did you notice anything else (power shortage, other corrupt files)?

Okay, the xml code example does not work. I’ve posted a gist for this here.