Search code examples
artifactory

artifactory don't start with an illegal repo name


I have an illegal repository name, which starts with a number. It's an old repo, created with API request (in Artifactory 6.5.1 version)

Artifactory accepts illegal name with API requests but if you restart artifactory, it's down

So my problem is the same like here: https://www.jfrog.com/jira/browse/RTFACT-16669

Except the solution doesn't work for me.

Because my instance/server is new, so i have not this file $ARTIFACTORY_HOME/etc/artifactory.config.latest.xml with the local repository.

I have repositories on AWS S3 and a AWS RDS database

And my new AWS EC2 instance have to get repos on S3

My question is:

Can i start artifactory ignoring the bad repo ?

Or

Can i delete the repo without starting artifactory ? (without API request or GUI)

The logs are here:

    2019-05-13 14:37:11,581 [art-init] [ERROR] (o.a.c.CentralConfigServiceImpl:744) - 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:66)

    at org.artifactory.descriptor.reader.CentralConfigReader.readAndConvert(CentralConfigReader.java:76)

etc ...

Caused by: javax.xml.bind.UnmarshalException: null

    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:335)

    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:578)

    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:264)

    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:229)

    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)
    ... 56 common frames omitted

Caused by: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '0ta' is not a valid value for 'NCName'.

etc ...

[art-init] [ERROR] (o.a.w.s.ArtifactoryContextConfigListener:96) - Application could not be initialized: null
java.lang.reflect.InvocationTargetException: null

etc ...

Caused by: org.springframework.beans.factory.BeanInitializationException: Failed to initialize bean 'org.artifactory.security.access.AccessService'.; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException

etc ...

[http-nio-8081-exec-2] [ERROR] (o.a.w.s.ArtifactoryFilter:194) - Artifactory failed to initialize: Context is null

Thanks

Cyril


Solution

  • The Artifactory config descriptor is stored in the Artifactory DB schema under a table named configs. In order to overcome this, you can do the following:

    1. Extract the artifactory.config.xml config from the configs table
    2. Store the extracted configuration as a file in: $ARTIFACTORY_HOME/etc/artifactory.config.import.xml
    3. Edit the artifactory.config.import.xml file and manually fix/delete the '0ta' repository reference from the configuration file
    4. After modifying the descriptor, restart the Artifactory service.

    Note, if you already have artifacts assigned to the illegal repo name, you will not be able to see them after modifying the repository name, however, since it is a new installation, I'm not sure that that this is relevant for you.