org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘dbRealm’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userService’: Unsatisfied dependency expressed through field ‘baseMapper’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userRepository’ defined in file [D:\oneisalls\windbell\bussiness\admin\target\classes\cn\afterturn\boot\admin\repository\UserRepository.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
前端时间就遇到过这个问题,花费了很长时间解决了,许久又见到这个问题了竟然忘记了怎么解决的了
这里记录下防止下次再找不到
最终结果是nacos没有获取到配置文件
错误原因是
https://github.com/alibaba/nacos/issues/271
错误日志
01 2019-04-25 21:56:52.588 INFO [main :c.a.n.c.c.u.ParamUtils] [settings] [] [] [req-serv] nacos-server port:8848
01 2019-04-25 21:56:52.591 INFO [main :c.a.n.c.c.u.ParamUtils] [settings] [] [] [http-client] connect timeout:1000
01 2019-04-25 21:56:52.593 INFO [main :c.a.n.c.c.u.ParamUtils] [NACOS_CLIENT_VERSION:{}] [] [] ${project.version}
01 2019-04-25 21:56:52.593 WARN [main :c.a.n.c.c.u.ParamUtils] [] [] [] PER_TASK_CONFIG_SIZE:
01 2019-04-25 21:56:52.612 WARN [main :c.a.n.c.c.i.LocalConfigInfoProcessor] [LOCAL_SNAPSHOT_PATH:{}] [] [] C:\Users\jueyue\nacos\config
01 2019-04-25 21:56:52.658 INFO [main :c.a.n.c.c.i.Limiter] [] [] [] limitTime:5.0
01 2019-04-25 21:56:53.153 ERROR [main :c.a.n.c.c.i.LocalConfigInfoProcessor] [fixed-dev.cloud.afterturn.cn:8848-ef2b4237-03f0-4974-853e-a821dec0c7e3] [] [NACOS-XXXX] save snapshot error
01 2019-04-25 21:56:53.156 INFO [main :c.a.n.c.c.u.JVMUtil] [] [] [] isMultiInstance:false
01 2019-04-25 21:56:53.158 ERROR [main :c.a.n.c.c.i.LocalConfigInfoProcessor] [fixed-dev.cloud.afterturn.cn:8848-ef2b4237-03f0-4974-853e-a821dec0c7e3] [] [NACOS-XXXX] save snapshot error, C:\Users\jueyue\nacos\config\fixed-dev.cloud.afterturn.cn:8848-ef2b4237-03f0-4974-853e-a821dec0c7e3_nacos\snapshot-tenant\ef2b4237-03f0-4974-853e-a821dec0c7e3\DEFAULT_GROUP\lemur-admin-dev.yaml, java.io.FileNotFoundException: C:\Users\jueyue\nacos\config\fixed-dev.cloud.afterturn.cn:8848-ef2b4237-03f0-4974-853e-a821dec0c7e3_nacos\snapshot-tenant\ef2b4237-03f0-4974-853e-a821dec0c7e3\DEFAULT_GROUP\lemur-admin-dev.yaml (文件名、目录名或卷标语法不正确。)
window 目录文件不支持** : ** 所以无法创建本地目录
nacos-client 代码
ServerListManager 的方法
String getFixedNameSuffix(String... serverIps) {
StringBuilder sb = new StringBuilder();
String split = "";
for (String serverIp : serverIps) {
sb.append(split);
sb.append(serverIp.replaceAll(":", "_"));
split = "-";
}
return sb.toString();
}
```
我的版本是0.3 没有replaceAll,0.6之后的版本有了所以报错了 最新版本是0.9.0