XRAY: Unable to save Xray settings
Description
While we are trying to save the Xray enabled checkbox from Artifactory by navigating to Administration > Xray > Settings > Advanced > Settings and try to check Xray enabled checkbox we encounter an error preventing us from saving changes, accompanied by an 'Unable to save changes' message.
In the Xray logs, we see the below error:
2024-02-08T09:29:21.261Z [jfrt ] [ERROR] [68006601b261c932] [o.a.a.x.XrayServiceImpl:995 ] [ttp-nio-8081-exec-15] - No Xray configured in Artifactory.
ResolutionWe see an error saying “No Xray configured in Artifactory” and “ Unable to save changes” pop up. This suggests that the problem lies within the config Descriptor file of Artifactory which doesn't have an Xray block incorporated. We must add an Xray block of configurations in the config descriptor to resolve this issue. We can perform this action with any of the 2 methods mentioned below:
Note: Please take a backup before making any changes in the Artifactory config descriptor before making the changes using Method 1.
Method 11. We can enable this configuration from the Artifactory config descriptor. Navigate to
Administration > Artifactory > Advanced > Config Descriptor and find the </addon> add the
below block to enable Xray configuration.
<xrayConfig> <enabled>true</enabled> <baseUrl>http://localhost:8046/xray/</baseUrl> <user></user> <password></password> <artifactoryId>default</artifactoryId> <xrayId></xrayId> <allowOperationsXrayUnavailable>true</allowOperationsXrayUnavailable> <allowBlockedArtifactsDownload>false</allowBlockedArtifactsDownload> <blockUnscannedTimeoutSeconds>60</blockUnscannedTimeoutSeconds> </xrayConfig>
2. Save the above configuration.
3. Restart Artifactory (for high availability setup a rolling restart is required).
4. Try saving the Xray settings again, we should be able to enable Xray now.
Method 2We may also make these changes in the artifactory.config.latest.xml file from the backend of the Artifactory server. To achieve the same please follow the below steps:
1. In the Artifactory instance via terminal navigate to $JFROG_HOME/var/etc/artifactory/and open
the artifactory.config.latest.xml file.
2. Take a backup of this file before you make the changes for the safer side.
3. Edit the file, search the line for </addon>, and add the below lines to the config descriptor.
<xrayConfig>
<enabled>true</enabled>
<baseUrl>http://localhost:8046/xray/</baseUrl>
<user></user>
<password></password>
<artifactoryId>default</artifactoryId>
<xrayId></xrayId>
<allowOperationsXrayUnavailable>true</allowOperationsXrayUnavailable>
<allowBlockedArtifactsDownload>false</allowBlockedArtifactsDownload>
<blockUnscannedTimeoutSeconds>60</blockUnscannedTimeoutSeconds>
</xrayConfig>
4. Rename the file $JFROG_HOME/var/etc/artifactory/artifactory.config.latest.xml to
$JFROG_HOME/var/etc/artifactory/artifactory.config.import.xml
5. Restart Artifactory (for high availability setup a rolling restart is required).
6. Try saving the Xray settings again, we should be able to enable Xray now.