Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加载依赖报错,忽略依赖运行显示craete bean error, redis配置正确仍然报错 #6

Closed
404name opened this issue Feb 19, 2022 · 6 comments

Comments

@404name
Copy link

404name commented Feb 19, 2022

Cannot resolve com.microsoft.sqlserver:sqljdbc4:4.0
Cannot resolve com.oracle:ojdbc6:11.2.0.3

(然后控制台字体是黑的。。)

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redissonConnectionFactory' defined in class path resource [org/redisson/spring/starter/RedissonAutoConfiguration.class]: Unsatisfied dependency expressed through method 'redissonConnectionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisson' defined in class path resource [org/redisson/spring/starter/RedissonAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redisson' threw exception; nested exception is org.redisson.client.RedisConnectionException: Unable to connect to Redis server: 110.42.134.117/110.42.134.117:6379
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
	... 89 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisson' defined in class path resource [org/redisson/spring/starter/RedissonAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redisson' threw exception; nested exception is org.redisson.client.RedisConnectionException: Unable to connect to Redis server: 110.42.134.117/110.42.134.117:6379
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
	... 103 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redisson' threw exception; nested exception is org.redisson.client.RedisConnectionException: Unable to connect to Redis server: 110.42.134.117/110.42.134.117:6379
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
@uncarbon97
Copy link
Owner

我这边使用阿里云提供的 maven 中央仓库镜像,是可以拉到依赖的;
如果你不用SQL Server 和 Oracle 数据库的话,可以排除这两个 JDBC 驱动
原 pom.xml 依赖引入

<dependency>
    <groupId>cc.uncarbon.framework</groupId>
    <artifactId>helio-starter-crud</artifactId>
</dependency>

修改为:

<dependency>
    <groupId>cc.uncarbon.framework</groupId>
    <artifactId>helio-starter-crud</artifactId>
    <exclusions>
        <exclusion>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
        </exclusion>

        <exclusion>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
        </exclusion>
    </exclusions>
</dependency>

下面那个creating bean with name 'redissonConnectionFactory' ,可以错误信息拉到最右边,是 redis 连接失败了;姑且确认一下 redis设置里监听的端口、防火墙有没有开放端口、云服务商防火墙白名单有没有开放端口;
如果是宝塔安装的redis,还会有点坑,可以重启系统后用特权账户启动试一下能不能启动起来

@404name
Copy link
Author

404name commented Feb 19, 2022

前面问题已经解决了,后面那个问题应该是redis报错,我启动这个项目控制台日志是黑色的字体(不清楚是不是你项目配置了颜色还是我idea突然抽风了),配合背景我啥都看不清qwq,刚刚才看到是redis连接错误,我redis其他项目能用的,这里报错了,我启动个本地的看看

@uncarbon97
Copy link
Owner

控制台打印颜色应该是被 banner.txt 连累了-。-
最后一行可以先改成 ${AnsiColor.BRIGHT_CYAN} 会比较明显
后续版本我也要修正一下这个

@404name
Copy link
Author

404name commented Feb 19, 2022

眼睛治好了😁,就看清楚报错有个redis [Auth] 就想起了可能是密码问题(字体颜色的锅,哈哈),我密码是置空的,我把password删了就好了,前后台都能跑了。学习学习大佬的代码👍

@404name 404name closed this as completed Feb 19, 2022
@uncarbon97
Copy link
Owner

hh 辛苦辛苦
banner 里面 字体改成 ${AnsiColor.BLACK} 在黑底 IDEA 里就会显示成纯白……

@404name
Copy link
Author

404name commented Feb 19, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants