解決Caused by: org.springframework.beans.factory.BeanCreationException:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailService' defined in class path resource [spring/spring-security.xml]: Cannot resolve reference to bean 'sellerService' while setting bean property 'sellerService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sellerService': FactoryBean threw exception on object creation; nested exception is org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000

或者

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userDetailService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailService' defined in class path resource [spring/spring-security.xml]: Cannot resolve reference to bean 'sellerService' while setting bean property 'sellerService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sellerService': FactoryBean threw exception on object creation; nested exception is org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000

以上報錯都是是連接zookeeper超時,解決步驟:

①:查看當前maven項目的配置文件的IP地址,與虛擬機中linux系統的IP地址是否相同,不相同則改爲相同
②:查看linux的zookeeper是否啓動,沒有啓動則將它啓動,啓動命令是
./zkServer.sh start(先進入zookeeper的安裝目錄下的bin目錄)

③:主機必須可以連接上linux虛擬機,打開黑窗口,輸入ping+空格+虛擬機IP地址
如果可以連接,則OK

確認修改後install項目,然後重寫用tomcat運行一遍即可

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章