项目启动报错:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'videoService': FactoryBean threw exception on object creation; nested exception is com.weibo.api.motan.exception.MotanFrameworkException: error_message: ClusterSupport No service urls for the refer:motan://172.17.0.1:0/default_rpc/com.btzh.service.VideoService/1.0/referer, registries:[zookeeper://192.168.0.46:2181/com.weibo.api.motan.registry.RegistryService?group=default_rpc], status: 404, error_code: 10101,r=null
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1634)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1309)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1275)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
... 41 more
Caused by: com.weibo.api.motan.exception.MotanFrameworkException: error_message: ClusterSupport No service urls for the refer:motan://172.17.0.1:0/default_rpc/com.btzh.service.VideoService/1.0/referer, registries:[zookeeper://192.168.0.46:2181/com.weibo.api.motan.registry.RegistryService?group=default_rpc], status: 404, error_code: 10101,r=null
at com.weibo.api.motan.cluster.support.ClusterSupport.init(ClusterSupport.java:102)
at com.weibo.api.motan.config.handler.SimpleConfigHandler.buildClusterSupport(SimpleConfigHandler.java:55)
at com.weibo.api.motan.config.RefererConfig.createClusterSupport(RefererConfig.java:184)
at com.weibo.api.motan.config.RefererConfig.initRef(RefererConfig.java:128)
at com.weibo.api.motan.config.RefererConfig.getRef(RefererConfig.java:85)
at com.weibo.api.motan.config.springsupport.RefererConfigBean.getObject(RefererConfigBean.java:44)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 51 more
zookeeper服务正常, 但是服务未注册成功, 查看jenkins构建日志:
Clean the workspace:
Copy resources from Jenkins:
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
Run the application:
Well done!
Finished: SUCCESS
查看jenkins的ssh执行内容:
echo "Copy resources from Jenkins:"
scp -r root@192.168.0.48:/root/.jenkins/workspace/$artifactId/target/lib /usr/local/projects/$artifactId
scp root@192.168.0.48:/root/.jenkins/workspace/$artifactId/target/$artifactId-$version.jar /usr/local/projects/$artifactId/
echo "Run the application:"
nohup /usr/local/jdk1.8.0_91/bin/java -agentlib:jdwp=transport=dt_socket,address=192.168.0.44:8002,server=y,suspend=n -jar /usr/local/projects/$artifactId/$artifactId-$version.jar > /usr/local/projects/$artifactId-$version.log 2>&1 &
#nohup /usr/local/jdk1.8.0_91/bin/java -Xms512m -Xmx512m -jar /usr/local/projects/$artifactId/$artifactId-$version.jar > /usr/local/projects/$artifactId-$version.log 2>&1 &
是从jenkins主机上拷贝文件时连接失败.
查看48机器ssh_config配置文件中 PasswordAuthentication值为yes, 说明已经开启了ssh密码登录, 手动执行scp输入密码可以远程拷贝成功:
root@mach4:/usr/local/projects# scp root@192.168.0.48:/root/.jenkins/workspace/cc-service-impl-pay/target/cc-service-impl-pay-0.0.1.jar /usr/local/projects/abc/
root@192.168.0.48's password:
cc-service-impl-pay-0.0.1.jar
判定是登录jenkins主机失败, 查看auth.log日志内容:
44机器(执行scp脚本的机器):
Aug 3 10:04:38 mach4 systemd-logind[480]: New session 14 of user root.
Aug 3 10:08:04 mach4 sshd[8317]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.0.48 user=root
Aug 3 10:08:06 mach4 sshd[8317]: Accepted publickey for root from 192.168.0.48 port 42772 ssh2: RSA 1d:d1:16:65:a1:42:80:f5:25:a7:39:06:0f:83:5e:03
Aug 3 10:08:06 mach4 sshd[8317]: pam_unix(sshd:session): session opened for user root by (uid=0)
Aug 3 10:08:06 mach4 systemd-logind[480]: New session 15 of user root.
Aug 3 10:08:24 mach4 sshd[8317]: Received disconnect from 192.168.0.48: 11: disconnected by user
Aug 3 10:08:24 mach4 sshd[8317]: pam_unix(sshd:session): session closed for user root
Aug 3 10:17:01 mach4 CRON[8422]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 3 10:17:01 mach4 CRON[8422]: pam_unix(cron:session): session closed for user root
Aug 3 10:24:30 mach4 sshd[8442]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.0.48 user=root
Aug 3 10:24:31 mach4 sshd[8442]: Accepted publickey for root from 192.168.0.48 port 42814 ssh2: RSA 1d:d1:16:65:a1:42:80:f5:25:a7:39:06:0f:83:5e:03
Aug 3 10:24:31 mach4 sshd[8442]: pam_unix(sshd:session): session opened for user root by (uid=0)
48机器(jenkins主机):
root@mach8:/etc/security# cd /var/log/
root@mach8:/var/log# tail -f auth.log
Aug 3 11:14:07 mach8 sshd[11027]: Failed password for root from 192.168.0.44 port 17680 ssh2
Aug 3 11:14:07 mach8 sshd[11027]: Failed password for root from 192.168.0.44 port 17680 ssh2
Aug 3 11:14:07 mach8 sshd[11027]: Connection closed by 192.168.0.44 [preauth]
Aug 3 11:14:07 mach8 sshd[11029]: Failed password for root from 192.168.0.44 port 17682 ssh2
Aug 3 11:14:07 mach8 sshd[11029]: Failed password for root from 192.168.0.44 port 17682 ssh2
Aug 3 11:14:07 mach8 sshd[11029]: Connection closed by 192.168.0.44 [preauth]
Aug 3 11:17:01 mach8 CRON[11178]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 3 11:17:01 mach8 CRON[11178]: pam_unix(cron:session): session closed for user root
Aug 3 11:20:23 mach8 sshd[10166]: Received disconnect from 192.168.0.41: 11: disconnected by user
Aug 3 11:20:23 mach8 sshd[10166]: pam_unix(sshd:session): session closed for user root
Aug 3 11:27:37 mach8 sshd[11713]: Failed password for root from 192.168.0.44 port 17684 ssh2
Aug 3 11:27:37 mach8 sshd[11713]: Failed password for root from 192.168.0.44 port 17684 ssh2
Aug 3 11:27:37 mach8 sshd[11713]: Connection closed by 192.168.0.44 [preauth]
Aug 3 11:27:37 mach8 sshd[11715]: Failed password for root from 192.168.0.44 port 17686 ssh2
Aug 3 11:27:37 mach8 sshd[11715]: Failed password for root from 192.168.0.44 port 17686 ssh2
Aug 3 11:27:37 mach8 sshd[11715]: Connection closed by 192.168.0.44 [preauth]
报密码错误, 因为执行scp的shell脚本中没有输入48的密码, 所以是没有配置ssh免密码登录, 或是之前配置的免密码登录失效了.
设置ssh免密码登录.
将44机器上的id_rsa.pub复制到48机器.ssh目录下:
root@mach4:/var/log# scp /root/.ssh/id_rsa.pub root@192.168.0.48:~/.ssh/abc
root@192.168.0.48's password:
id_rsa.pub
将公钥追加到48机器的authorized_keys中:
root@mach8:~/.ssh# cat ./abc >> ./authorized_keys
再次构建项目正常.