(三) 架构搭建-项目基础框架启动

先总结下问题:

1、模拟启动子服务异常-子服务是工具服务

模拟器的测试类

先启动zkServer.cmd

需要的包

"C:\Program Files\Java\jdk1.7.0_80\bin\java" "-javaagent:E:\KF\IntelliJ IDEA 2017.1\lib\idea_rt.jar=54798:E:\KF\IntelliJ IDEA 2017.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.7.0_80\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\jfxrt.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\rt.jar;G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\test-classes;G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes;C:\Users\Administrator\.m2\repository\redis\clients\jedis\2.5.1\jedis-2.5.1.jar;C:\Users\Administrator\.m2\repository\org\apache\commons\commons-pool2\2.0\commons-pool2-2.0.jar;C:\Users\Administrator\.m2\repository\commons-net\commons-net\3.3\commons-net-3.3.jar;C:\Users\Administrator\.m2\repository\org\jsoup\jsoup\1.7.2\jsoup-1.7.2.jar;C:\Users\Administrator\.m2\repository\org\slf4j\slf4j-log4j12\1.7.7\slf4j-log4j12-1.7.7.jar;C:\Users\Administrator\.m2\repository\org\slf4j\slf4j-api\1.7.7\slf4j-api-1.7.7.jar;C:\Users\Administrator\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Users\Administrator\.m2\repository\javax\javaee-api\7.0\javaee-api-7.0.jar;C:\Users\Administrator\.m2\repository\com\sun\mail\javax.mail\1.5.0\javax.mail-1.5.0.jar;C:\Users\Administrator\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\Administrator\.m2\repository\org\apache\httpcomponents\httpcore\4.4.6\httpcore-4.4.6.jar;C:\Users\Administrator\.m2\repository\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;C:\Users\Administrator\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\Administrator\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;C:\Users\Administrator\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;C:\Users\Administrator\.m2\repository\net\sf\json-lib\json-lib\2.4\json-lib-2.4-jdk15.jar;C:\Users\Administrator\.m2\repository\commons-beanutils\commons-beanutils\1.8.0\commons-beanutils-1.8.0.jar;C:\Users\Administrator\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;C:\Users\Administrator\.m2\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar;C:\Users\Administrator\.m2\repository\net\sf\ezmorph\ezmorph\1.0.6\ezmorph-1.0.6.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-core\4.0.2.RELEASE\spring-core-4.0.2.RELEASE.jar;C:\Users\Administrator\.m2\repository\com\alibaba\fastjson\1.1.41\fastjson-1.1.41.jar;C:\Users\Administrator\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Users\Administrator\.m2\repository\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;C:\Users\Administrator\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\Administrator\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-beans\4.0.2.RELEASE\spring-beans-4.0.2.RELEASE.jar;C:\Users\Administrator\.m2\repository\com\alibaba\dubbo\2.5.3\dubbo-2.5.3.jar;C:\Users\Administrator\.m2\repository\org\javassist\javassist\3.15.0-GA\javassist-3.15.0-GA.jar;C:\Users\Administrator\.m2\repository\org\jboss\netty\netty\3.2.5.Final\netty-3.2.5.Final.jar;C:\Users\Administrator\.m2\repository\org\apache\zookeeper\zookeeper\3.4.9\zookeeper-3.4.9.jar;C:\Users\Administrator\.m2\repository\jline\jline\0.9.94\jline-0.9.94.jar;C:\Users\Administrator\.m2\repository\io\netty\netty\3.10.5.Final\netty-3.10.5.Final.jar;C:\Users\Administrator\.m2\repository\com\101tec\zkclient\0.10\zkclient-0.10.jar;C:\Users\Administrator\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-jms\4.0.2.RELEASE\spring-jms-4.0.2.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-aop\4.0.2.RELEASE\spring-aop-4.0.2.RELEASE.jar;C:\Users\Administrator\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-context\4.0.2.RELEASE\spring-context-4.0.2.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-expression\4.0.2.RELEASE\spring-expression-4.0.2.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-tx\4.0.2.RELEASE\spring-tx-4.0.2.RELEASE.jar" ConfigDubboProvider
2018-10-26 10:31:44,113: org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:110) [DEBUG] - Adding [systemProperties] PropertySource with lowest search precedence
2018-10-26 10:31:44,122: org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:110) [DEBUG] - Adding [systemEnvironment] PropertySource with lowest search precedence
2018-10-26 10:31:44,123: org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:126) [DEBUG] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2018-10-26 10:31:44,128: org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:513) [INFO] - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7141cf63: startup date [Fri Oct 26 10:31:44 GMT+08:00 2018]; root of context hierarchy
2018-10-26 10:31:44,194: org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:110) [DEBUG] - Adding [systemProperties] PropertySource with lowest search precedence
2018-10-26 10:31:44,195: org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:110) [DEBUG] - Adding [systemEnvironment] PropertySource with lowest search precedence
2018-10-26 10:31:44,195: org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:126) [DEBUG] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2018-10-26 10:31:44,215: org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:316) [INFO] - Loading XML bean definitions from URL [file:/G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/spring-mvc-config.xml]
2018-10-26 10:31:44,239: org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:73) [DEBUG] - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
2018-10-26 10:31:44,296: org.springframework.beans.factory.xml.PluggableSchemaResolver.getSchemaMappings(PluggableSchemaResolver.java:141) [DEBUG] - Loading schema mappings from [META-INF/spring.schemas]
2018-10-26 10:31:44,306: org.springframework.beans.factory.xml.PluggableSchemaResolver.getSchemaMappings(PluggableSchemaResolver.java:147) [DEBUG] - Loaded schema mappings: {http://code.alibabatech.com/schema/dubbo/dubbo.xsd=META-INF/dubbo.xsd, http://www.springframework.org/schema/jee/spring-jee-3.2.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-4.0.xsd, http://www.springframework.org/schema/jms/spring-jms-4.0.xsd=org/springframework/jms/config/spring-jms-4.0.xsd, http://www.springframework.org/schema/jms/spring-jms-3.0.xsd=org/springframework/jms/config/spring-jms-3.0.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-4.0.xsd, http://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd, http://www.springframework.org/schema/cache/spring-cache.xsd=org/springframework/cache/config/spring-cache-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-4.0.xsd=org/springframework/aop/config/spring-aop-4.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-4.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool-3.1.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-3.1.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-4.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.2.xsd=org/springframework/transaction/config/spring-tx-3.2.xsd, http://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/util/spring-util-3.2.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd, http://www.springframework.org/schema/lang/spring-lang-3.2.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-4.0.xsd=org/springframework/beans/factory/xml/spring-beans-4.0.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/cache/spring-cache-3.2.xsd=org/springframework/cache/config/spring-cache-3.2.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/task/spring-task-4.0.xsd=org/springframework/scheduling/config/spring-task-4.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/jms/spring-jms-3.2.xsd=org/springframework/jms/config/spring-jms-3.2.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-4.0.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-4.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool-4.0.xsd=org/springframework/beans/factory/xml/spring-tool-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.2.xsd=org/springframework/aop/config/spring-aop-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.1.xsd=org/springframework/transaction/config/spring-tx-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-4.0.xsd=org/springframework/ejb/config/spring-jee-4.0.xsd, http://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-3.1.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd, http://www.springframework.org/schema/cache/spring-cache-3.1.xsd=org/springframework/cache/config/spring-cache-3.1.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-4.0.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-4.0.xsd, http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms-3.1.xsd=org/springframework/jms/config/spring-jms-3.1.xsd, http://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.1.xsd=org/springframework/aop/config/spring-aop-3.1.xsd, http://www.springframework.org/schema/tx/spring-tx-4.0.xsd=org/springframework/transaction/config/spring-tx-4.0.xsd, http://www.springframework.org/schema/task/spring-task-3.2.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd, http://www.springframework.org/schema/context/spring-context-4.0.xsd=org/springframework/context/config/spring-context-4.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-4.0.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/cache/spring-cache-4.0.xsd=org/springframework/cache/config/spring-cache-4.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/util/spring-util-4.0.xsd=org/springframework/beans/factory/xml/spring-util-4.0.xsd, http://www.springframework.org/schema/lang/spring-lang-4.0.xsd=org/springframework/scripting/config/spring-lang-4.0.xsd, http://www.springframework.org/schema/tool/spring-tool-3.2.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd}
2018-10-26 10:31:44,310: org.springframework.beans.factory.xml.PluggableSchemaResolver.resolveEntity(PluggableSchemaResolver.java:119) [DEBUG] - Found XML schema [http://www.springframework.org/schema/beans/spring-beans-3.1.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-3.1.xsd
2018-10-26 10:31:44,365: org.springframework.beans.factory.xml.PluggableSchemaResolver.resolveEntity(PluggableSchemaResolver.java:119) [DEBUG] - Found XML schema [http://www.springframework.org/schema/context/spring-context-3.1.xsd] in classpath: org/springframework/context/config/spring-context-3.1.xsd
2018-10-26 10:31:44,376: org.springframework.beans.factory.xml.PluggableSchemaResolver.resolveEntity(PluggableSchemaResolver.java:119) [DEBUG] - Found XML schema [http://www.springframework.org/schema/tool/spring-tool-3.1.xsd] in classpath: org/springframework/beans/factory/xml/spring-tool-3.1.xsd
2018-10-26 10:31:44,641: org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108) [DEBUG] - Loading bean definitions
2018-10-26 10:31:44,660: org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.getHandlerMappings(DefaultNamespaceHandlerResolver.java:157) [DEBUG] - Loaded NamespaceHandler mappings: {http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://code.alibabatech.com/schema/dubbo=com.alibaba.dubbo.config.spring.schema.DubboNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler, http://www.springframework.org/schema/c=org.springframework.beans.factory.xml.SimpleConstructorNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/jms=org.springframework.jms.config.JmsNamespaceHandler, http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler}
2018-10-26 10:31:44,688: org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:110) [DEBUG] - Adding [systemProperties] PropertySource with lowest search precedence
2018-10-26 10:31:44,688: org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:110) [DEBUG] - Adding [systemEnvironment] PropertySource with lowest search precedence
2018-10-26 10:31:44,688: org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:126) [DEBUG] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2018-10-26 10:31:44,731: org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.registerDefaultFilters(ClassPathScanningCandidateComponentProvider.java:242) [DEBUG] - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
2018-10-26 10:31:44,734: org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.registerDefaultFilters(ClassPathScanningCandidateComponentProvider.java:250) [DEBUG] - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
2018-10-26 10:31:44,739: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindMatchingFileSystemResources(PathMatchingResourcePatternResolver.java:553) [DEBUG] - Looking for matching resources in directory tree [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc]
2018-10-26 10:31:44,739: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,742: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,742: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\config] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,743: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\config\properties] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,745: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,746: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\encryption] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,747: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\exceptions] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,840: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\format] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,841: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,845: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\redis] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,846: org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(PathMatchingResourcePatternResolver.java:615) [DEBUG] - Searching directory [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\verify] for files matching pattern [G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/com/ibc/**/*.class]
2018-10-26 10:31:44,850: org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:354) [DEBUG] - Resolved location pattern [classpath*:com/ibc/**/*.class] to resources [file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\config\properties\PropertiesHotis.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\CookieUtils.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\DateUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\DtoDealWith.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\encryption\AesRsaUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\encryption\AESUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\encryption\MD5Util.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\exceptions\CommonException.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\exceptions\ServiceException.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\format\JsonFormatUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\format\MapFormatUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\format\ObjectFormatUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\format\StringFormatUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\format\XmlFormatUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\FtpUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpGetUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpPostUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpsClientWeChatUtils$1.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpsClientWeChatUtils$2.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpsClientWeChatUtils.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpUtils$1.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpUtils$2.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\HttpUtils.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\SSLUtil$1.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\SSLUtil$2.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\http\SSLUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\IPUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\MyPubUtil$1.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\MyPubUtil$2.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\MyPubUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\PKUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\RandomUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\redis\RedisCallback.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\redis\RedisExpireUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\redis\RedisUtil.class], file [G:\ibc-svn\private\HelloWorld\HelloWorldRoot\HelloWorldConfig\target\classes\com\ibc\config\utils\verify\RegularVerify.class]]
---------------异常org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc]
Offending resource: URL [file:/G:/ibc-svn/private/HelloWorld/HelloWorldRoot/HelloWorldConfig/target/classes/spring-mvc-config.xml]

好吧还是最常见的问题,缺jar  

下面是该子工程全部的jar

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>HelloWorld</artifactId>
        <groupId>com.com.ibc</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.com.ibc.config</groupId>
    <artifactId>HelloWorldConfig</artifactId>

    <dependencies>
        <!--Redis-->
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.5.1</version>
        </dependency>
        <!--FTP-->
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.3</version>
        </dependency>
        <!--Java HTML解析器-->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.7.2</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

        <!-- java ee jar 包 -->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>
        <!-- JSON -->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
        </dependency>

        <!--json-->
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <classifier>jdk15</classifier>
        </dependency>


        <!-- json 格式化对象,方便输出日志 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>

        <!--commons-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>


        <!-- spring核心包 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
        </dependency>


        <!--dubbo-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!--zookeeper-->
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
        </dependency>
        <!--java启动zkclient模拟-->
        <dependency>
            <groupId>com.101tec</groupId>
            <artifactId>zkclient</artifactId>
            <version>0.10</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
    </dependencies>

</project>

尝试启动远程服务

启动web的单元测试,加载配置文件,调用远程的接口和工具类

结果呢。。调用成功了,但是连续执行了两次,肯定不符合我们的要求。继续改

首先排除了 dubbo超时重复调用的问题,因为单元测试类就重复执行了两次。

我先检查了web项目的spring的配置,发现没问题,将调用切到另一个user服务,还是出现两次问题,

排查单元测试方法的时候发现。。多了一个@Autowired注解。。没删干净很尴尬。。。

因为Spring会先实例化所有Bean,然后根据配置进行扫描,当检测到@Autowired后进行注入,注入时调用这个方法。所以被两套机制分别调用了。

删掉注解问题解决。通信基本完成。

回头把工具服务放到远程服务器上试试。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 首先,你需要安装 sanic 框架。你可以使用以下命令在你的系统中安装 sanic: ``` pip install sanic ``` 然后,你可以在你想要创建项目的目录中运行以下命令来创建项目框架: ``` sanic init ``` 这将创建一个包含以下文件和目录的项目框架: - app.py:包含初始化 Sanic 应用程序的代码。 - routes.py:包含你的应用程序路由的代码。 - templates/:包含你的 HTML 模板的目录。 - static/:包含你的静态文件(如 CSS 和 JavaScript 文件)的目录。 你可以在 app.py 中添加路由,并在 routes.py 中添加处理程序函数。然后,你可以在 templates/ 目录中创建 HTML 模板,并在 static/ 目录中添加静态文件。 例如,你可以在 app.py 中添加以下路由: ```python @app.route("/") async def index(request): return await template("index.html") ``` 在 routes.py 中,你可以创建一个处理程序函数,该函数将返回数据给页面: ```python async def get_data(request): data = {"message": "Hello, World!"} return json(data) ``` 然后,你可以在 templates/ 目录中创建一个名为 index.html 的文件,并在其中包含你的 HTML 代码。 在 static/ 目录中,你可以添加你的 CSS 和 JavaScript 文件。你 ### 回答2: 创建一个sanic项目框架脚手架需要以下完整的项目架构: 1. 安装依赖:首先需要安装sanic框架和其他常用的python依赖库。可以使用pip来安装sanic和其它相关的库,例如: ```shell $ pip install sanic ``` 2. 创建项目文件夹和文件结构:在项目所在的目录下创建一个文件夹作为项目的根目录,然后在根目录下创建以下基本文件和文件夹: - `app`文件夹:用于存放应用程序相关的文件。 - `app/main.py`文件:用于启动服务器和设置路由。 - `app/views.py`文件:用于编写视图函数和业务逻辑。 - `app/models.py`文件:用于定义数据模型。 - `app/templates`文件夹:用于存放HTML模板文件。 - `app/static`文件夹:用于存放静态文件,如CSS、JS和图像等。 - `tests`文件夹:用于存放测试文件。 3. 编写主要代码:在`main.py`中,引入`sanic`库和其他必要的模块,然后创建一个`sanic`应用程序的实例。编写路由和视图函数,添加各个路由的URL和对应的处理函数,如: ```python from sanic import Sanic from sanic.response import json app = Sanic() @app.route('/') async def index(request): return json({'message': 'Welcome to Sanic Project!'}) if __name__ == "__main__": app.run(host="0.0.0.0", port=8000) ``` 4. 编写视图函数和业务逻辑:在`views.py`文件中,编写处理不同路由请求的视图函数和相关的业务逻辑。 5. 设计数据模型:在`models.py`文件中,根据项目需要定义相应的数据模型和数据操作方法。 6. 设置HTML模板和静态文件:在`templates`文件夹下,编写HTML模板文件供视图函数使用;在`static`文件夹下,存放静态文件。 7. 编写测试代码:在`tests`文件夹中编写相应的测试用例,用于对项目的功能进行测试和验证。 这样,一个基本的sanic项目框架脚手架就创建完成了。通过该框架,可以搭建一个基本的sanic应用程序,并编写相应的路由、视图函数和业务逻辑,同时可以进行测试和验证。可以根据项目的需求,进一步扩展和优化该框架。 ### 回答3: 创建一个sanic项目框架脚手架需要以下完整的项目架构: 1. 项目主目录结构: - app/:存放应用逻辑的代码。 - config/:存放配置文件。 - tests/:存放测试代码。 - static/:存放静态文件,如CSS和JavaScript。 - templates/:存放模板文件。 - main.py:项目的入口文件。 2. main.py:项目的入口文件,用于初始化Sanic应用并启动服务器: ```python from sanic import Sanic app = Sanic(__name__) if __name__ == '__main__': app.run(host='0.0.0.0', port=8000, debug=True) ``` 3. config/:存放配置文件,可以分为不同环境的配置文件如develop.py、production.py等。其中配置文件可以包含以下内容: - 应用的主机和端口配置。 - 数据库连接配置。 - 缓存配置。 - 日志配置。 - 其他自定义配置。 4. app/:存放应用逻辑的代码,可以按照模块或功能进行划分,例如: - app/ - routes/:存放路由相关的代码。 - handlers/:存放视图函数(处理请求和返回响应)的代码。 - models/:存放数据模型的代码。 - services/:存放业务逻辑的代码。 - utils/:存放工具类或函数的代码。 5. routes/:存放URL路由相关的代码,例如创建和管理路由的代码: ```python from sanic import Blueprint from .handlers import hello_world, create_user, get_user bp = Blueprint('app', url_prefix='/app') bp.add_route(hello_world, '/') bp.add_route(create_user, '/user', methods=['POST']) bp.add_route(get_user, '/user/<user_id>') ``` 6. handlers/:存放视图函数的代码,处理请求和返回响应,例如: ```python from sanic.response import json async def hello_world(request): return json({'message': 'Hello, World!'}) async def create_user(request): # 处理创建用户的逻辑 pass async def get_user(request, user_id): # 处理获取用户的逻辑 pass ``` 7. models/:存放数据模型的代码,例如定义用户模型的代码: ```python from sqlalchemy import Column, Integer, String from .database import Base class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) email = Column(String) ``` 8. services/:存放业务逻辑的代码,例如用户服务的代码: ```python from .models import User class UserService: def create_user(self, name, email): # 创建用户的逻辑 def get_user(self, user_id): # 获取用户的逻辑 ``` 以上是创建一个sanic项目框架脚手架需要的完整项目架构,可以根据实际需求进行扩展和修改。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值