为什么Artifactory服务不能访问mysql?

时间:2017-04-19 20:23:54

标签: mysql artifactory

我在AWS系统中运行了Artifactory,但我不得不将其关闭,因为我需要更改实例类型并增加磁盘空间。该实例已备份并正在运行。这是一个CentOS 7操作系统。

然而,当我启动artifactory服务时,我得到一个异常,上面写着“SQLException:访问被拒绝用户'神器'''localhost'(使用密码:YES)”

2017-04-19 20:11:18,111 [art-init] [WARN ] (o.a.s.ArtifactoryApplicationContext:207) - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDependencyDeclarationService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.artifactory.api.repo.RepositoryService org.artifactory.ui.rest.service.artifacts.browse.treebrowser.tabs.general.GetDependencyDeclarationService.repositoryService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repositoryServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.artifactory.api.security.AclService org.artifactory.repo.service.RepositoryServiceImpl.aclService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.artifactory.storage.security.service.AclStoreService org.artifactory.security.SecurityServiceImpl.aclStoreService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aclServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.artifactory.storage.db.DbService org.artifactory.storage.db.security.service.AclServiceImpl.dbService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbServiceImpl': Invocation of init method failed; nested exception is java.sql.SQLException: Access denied for user 'artifactory'@'localhost' (using password: YES)
...
2017-04-19 20:11:18,115 [art-init] [ERROR] (o.a.w.s.ArtifactoryContextConfigListener:96) - Application could not be initialized: Access denied for user 'artifactory'@'localhost' (using password: YES)
java.lang.reflect.InvocationTargetException: null

我正在使用mysql,当我以root身份访问它时,我看到以下内容。这是对的吗?

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

我也看到了

mysql> select user from mysql.user;
+-------------+
| user        |
+-------------+
| artifactory |
| mysql.sys   |
| root        |
+-------------+
3 rows in set (0.00 sec)

并已授予用户神器的所有权限。

1 个答案:

答案 0 :(得分:1)

您是否在与Artifactory相同的计算机上安装了MySQL?如果不是,您似乎需要授予Artifactory机器的IP权限。目前,似乎特权被授予神器'@ 'localhost',不确定这是否是问题,但值得检查。 另一件事是检查MySQL日志并查看Artifactory是否完全到达MySQL,或者是否有任何代理/防火墙阻止Artifactory到达MySQL服务器。