1. 程式人生 > >微服務中springboot啟動問題

微服務中springboot啟動問題

log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
log4j:WARN Please initialize the log4j system properly.

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.1.RELEASE)

2018-06-15 13:49:01.727 [main] INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode!
2018-06-15 13:49:03.151 [main] INFO org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["https-jsse-nio-18086"]
2018-06-15 13:49:03.168 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
2018-06-15 13:49:03.168 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.29
2018-06-15 13:49:03.179 [localhost-startStop-1] INFO org.apache.catalina.core.AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\proAAASoft\java\jre1.8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/proAAASoft/java/jre1.8/bin/server;D:/proAAASoft/java/jre1.8/bin;D:/proAAASoft/java/jre1.8/lib/amd64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Java\jre7;D:\proAAASoft\java\jdk1.8\bin;D:\proAAASoft\java\jdk1.8\jre\bin;D:\proAAASoft\git\Git\cmd;D:\proAAASoft\svn\bin;D:\proAAASoft\maven\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;C:\Program Files\bin;D:\proAAASoft\zookeeper/bin;D:\proAAASoft\zookeeper/conf;;D:\proAAASoft\eclipseproAAA\eclipse;;.]
2018-06-15 13:49:03.329 [localhost-startStop-1] INFO org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2018-06-15 13:49:04.041 [main] INFO org.apache.catalina.core.StandardService - Stopping service [Tomcat]

 springboot啟動發現一起即停的現象。通過debug啟動報錯如下:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deviceController': Unsatisfied dependency expressed through field 'deviceService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deviceService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.proAAA.cloud.device.service.DeviceService. No provider available for the service com.proAAA.cloud.device.service.DeviceService:1.0.1 from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=sweep-machine&dubbo=2.5.6&interface=com.proAAA.cloud.device.service.DeviceService&methods=modifyDeviceName,userGetDeviceDetailByDeviceId,selectDeviceByPrimaryKey,getBindUserByDevice,getWorkStatistics,getAdminMapData,selectDeviceListByUserId,accountOverView,countMyDevice,unbind,getStatisticsDeviceWorkPlan,isMyDevice,userGetDeviceList,adminPerformanceEfficiency,getAdminMapTatal,bindDevice,selectDeviceDetailById,getWorkStatisticsSum,faultDeviceList&pid=8500&revision=1.0.1&side=consumer&timestamp=1529041094529&version=1.0.1 to the consumer 192.168.8.184 use dubbo version 2.5.6

這種錯誤往往是配置檔案有問題,該錯誤是因為,我們的其中一個專案進行了拆分,一個服務拆為兩個,於是需要在zookeeper上暴露介面註冊,需要定義兩個端點,而本地地址也要對應上。同時在pom.xml檔案中開放相應的開發模式,是線上,開發,測試,本地等,對應選擇。