实用:maven第一篇

1、 创建maven项目
 这是一篇很好的博文,足以满足你要创建maven项目的需求:https://blog.csdn.net/lewky_liu/article/details/78138381
 如果只想新建,直接参看即可:http://www.cnblogs.com/quanyongan/archive/2013/04/21/3033838.html
2、 编译,运行 maven项目

1)编译maven项目 clean install ,两种方式:
①操作界面为:
打开eclipse,如图,在debug或者run下,
这里写图片描述
选中右边实心小三角,debug->Debug Configurations,按照图示顺序操作
这里写图片描述

②操作界面为:
在要编译的模块上右键->run as->maven build 会弹出Edit configuration窗口
eg:这里写图片描述

这里写图片描述

推荐②,直接加载要编译的模块,不用自己去选中很方便虽然也没方便多少,嘿嘿,我比较小懒

2)启动maven项目,依然在要启动的模块上右键->run as/debug as->maven build 会弹出Edit configuration窗口
如果你的项目是tomcat程序,则启动命令为 tomcat7:run
这里写图片描述
如果是 jetty ,启动命令为 jetty:run ,操作界面为:
这里写图片描述

还有另一种是eclipse里安装jetty插件的运行方式,启动界面配置为:
这里写图片描述

3 、工作中会遇到的问题,持续更新中……
(1) 没有provider(提供者)报错信息 :
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxxService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.msyd.xindai.service.xxxxService. No provider available for the service yidai/com.msyd.xindai.service.xxxxService from the url zookeeper://172.30.1.108:2181/com.alibaba.dubbo.registry.RegistryService?application=msyd-wireless-service&dubbo=2.5.3&group=yidai&interface=com.msyd.xindai.service.xxxxService&methods=getXindaiBorrowedAmt,getXindaiToPayAmt,getXindaiRepayedAmt,getXindaiToPayAllAmt&pid=2742&revision=1.0&side=consumer&timestamp=1527823580259 to the consumer 172.33.2.111 use dubbo version 2.5.3
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:173)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1467)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:267)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:921)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:864)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:779)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:503)
        ... 36 more
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.msyd.xindai.service.xxxxService. No provider available for the service yidai/com.msyd.xindai.service.xxxxService from the url zookeeper://172.33.2.111:2181/com.alibaba.dubbo.registry.RegistryService?application=msyd-wireless-service&dubbo=2.5.3&group=yidai&interface=com.msyd.xindai.service.xxxxService&methods=getXindaiBorrowedAmt,getXindaiToPayAmt,getXindaiRepayedAmt,getXindaiToPayAllAmt&pid=2742&revision=1.0&side=consumer&timestamp=1527823580259 to the consumer 172.33.2.111 use dubbo version 2.5.3
        at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420)
        at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
        at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
        at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:166)
        ... 46 more

这里写图片描述

解决方案:
①先检查是spring-provider.xml里是否存在提供者
②再检查提供者服务模块是否有启动或者是正常启动
③在看消费者spring-consumer.xml是否有配置。
④ 查看下分组的ip是否正确,提供者分组的ip是否有效,如果无效,可以去掉提供者和消费者的分组。
⑤以上如果都没问题,那就clean一下,然后重新install,然后启动服务提供模块。

之后看到一篇比较不错的文章:
https://blog.csdn.net/bestcxx/article/details/54589039

猜你喜欢

转载自blog.csdn.net/haidaoxianzi/article/details/80535148