Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-16669

REST API allows to create repository with white space in its name, resulting in Artifactory not starting up

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: 5.11.0
    • Fix Version/s: None
    • Component/s: REST API
    • Labels:
      None

      Description

      To reproduce:

      1. Create a repository using the REST API: (make sure that its name contains a white space)

      curl -XPUT -uadmin:password "http://localhost:8081/artifactory/api/repositories/local%20repo2" -d '{"key": "local repo2","rclass" : "local"}' -H "Content-Type: application/json" -v

      2. Restart Artifactory. It will fail to start and will show this error:

      2018-05-10 10:54:30,179 [art-init] [ERROR] (o.a.c.CentralConfigServiceImpl:697) - Could not load configuration due to: Failed to read object from stream
      java.lang.RuntimeException: Failed to read object from stream
      at org.artifactory.jaxb.JaxbHelper.read(JaxbHelper.java:131)
      at org.artifactory.jaxb.JaxbHelper.readConfig(JaxbHelper.java:63)
      at org.artifactory.descriptor.reader.CentralConfigReader.read(CentralConfigReader.java:62)
      at org.artifactory.config.CentralConfigServiceImpl.getCentralConfigDescriptorCache(CentralConfigServiceImpl.java:677)
      at org.artifactory.config.CentralConfigServiceImpl.access$000(CentralConfigServiceImpl.java:107)
      at org.artifactory.config.CentralConfigServiceImpl$1.call(CentralConfigServiceImpl.java:158)
      at org.artifactory.config.CentralConfigServiceImpl$1.call(CentralConfigServiceImpl.java:154)
      at org.artifactory.storage.db.security.service.VersioningCache.get(VersioningCache.java:66)
      at org.artifactory.config.CentralConfigServiceImpl.getDescriptor(CentralConfigServiceImpl.java:366)
      at org.artifactory.config.CentralConfigServiceImpl.getDescriptor(CentralConfigServiceImpl.java:103)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
      at com.sun.proxy.$Proxy150.getDescriptor(Unknown Source)
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.getAccessClientSettings(ArtifactoryAccessClientConfigStore.java:566)
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.getRawAdminToken(ArtifactoryAccessClientConfigStore.java:279)
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.getDecryptedAdminToken(ArtifactoryAccessClientConfigStore.java:269)
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.newClientBuilder(ArtifactoryAccessClientConfigStore.java:117)
      at org.artifactory.security.access.AccessServiceImpl.initAccessService(AccessServiceImpl.java:260)
      at org.artifactory.security.access.AccessServiceImpl.initIfNeeded(AccessServiceImpl.java:250)
      at org.artifactory.security.access.AccessServiceImpl.init(AccessServiceImpl.java:244)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      at org.artifactory.storage.fs.lock.aop.LockingAdvice.invoke(LockingAdvice.java:76)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      at com.sun.proxy.$Proxy142.init(Unknown Source)
      at org.artifactory.spring.ArtifactoryApplicationContext.refresh(ArtifactoryApplicationContext.java:248)
      at org.artifactory.spring.ArtifactoryApplicationContext.<init>(ArtifactoryApplicationContext.java:133)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.configure(ArtifactoryContextConfigListener.java:207)
      at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.access$200(ArtifactoryContextConfigListener.java:63)
      at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener$1.run(ArtifactoryContextConfigListener.java:88)
      Caused by: javax.xml.bind.UnmarshalException: null
      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:335)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:563)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:249)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)
      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:125)
      at org.artifactory.jaxb.JaxbHelper.read(JaxbHelper.java:129)
      ... 46 common frames omitted
      Caused by: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: 'local repo2' is not a valid value for 'NCName'.
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:452)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3230)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3145)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3055)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2134)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:853)
      at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.endElement(ValidatorHandlerImpl.java:584)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.endElement(ValidatingUnmarshaller.java:91)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.endElement(SAXConnector.java:165)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
      ... 50 common frames omitted
      2018-05-10 10:54:30,182 [art-init] [ERROR] (o.a.w.s.ArtifactoryContextConfigListener:92) - Application could not be initialized: null
      java.lang.reflect.InvocationTargetException: null
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.configure(ArtifactoryContextConfigListener.java:207)
      at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.access$200(ArtifactoryContextConfigListener.java:63)
      at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener$1.run(ArtifactoryContextConfigListener.java:88)
      Caused by: org.springframework.beans.factory.BeanInitializationException: Failed to initialize bean 'org.artifactory.security.access.AccessService'.; nested exception is java.lang.NullPointerException
      at org.artifactory.spring.ArtifactoryApplicationContext.refresh(ArtifactoryApplicationContext.java:250)
      at org.artifactory.spring.ArtifactoryApplicationContext.<init>(ArtifactoryApplicationContext.java:133)
      ... 7 common frames omitted
      Caused by: java.lang.NullPointerException: null
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.getAccessClientSettings(ArtifactoryAccessClientConfigStore.java:566)
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.getRawAdminToken(ArtifactoryAccessClientConfigStore.java:279)
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.getDecryptedAdminToken(ArtifactoryAccessClientConfigStore.java:269)
      at org.artifactory.security.access.ArtifactoryAccessClientConfigStore.newClientBuilder(ArtifactoryAccessClientConfigStore.java:117)
      at org.artifactory.security.access.AccessServiceImpl.initAccessService(AccessServiceImpl.java:260)
      at org.artifactory.security.access.AccessServiceImpl.initIfNeeded(AccessServiceImpl.java:250)
      at org.artifactory.security.access.AccessServiceImpl.init(AccessServiceImpl.java:244)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      at org.artifactory.storage.fs.lock.aop.LockingAdvice.invoke(LockingAdvice.java:76)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      at com.sun.proxy.$Proxy142.init(Unknown Source)
      at org.artifactory.spring.ArtifactoryApplicationContext.refresh(ArtifactoryApplicationContext.java:248)
      ... 8 common frames omitted

       

      Workaround:

      Edit $ARTIFACTORY_HOME/etc/artifactory.config.latest.xml and remove the problematic <localRepository> section. Then, rename the file to: artifactory.config.import.xml, in order to get it to load during bootstrap.

      Note that this workaround will remove this repository from Artifactory, while there could be (unharmful) leftovers in the database.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                avivb Aviv Blonder
              • Votes:
                6 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: