搭建Dubbo+Myeclipse2015+Maven3.3.1的过程遇到问题集锦

1. 找不到dubbo2.8.4包的问题

在编译Maven工程的过程中,出现如下问题:

Description Resource Path Location Type
ArtifactDescriptorException: Failed to read artifact descriptor for com.alibaba:dubbo:jar:2.8.4: UnresolvableModelException: Failure to find com.alibaba:dubbo-parent:pom:2.8.4 in http://172.28.3.60:8081/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of thirdparty has elapsed or updates are forced pom.xml /FileIO line 1 Maven Dependency Problem

本地Maven的配置如下:settings.xml:

<settings 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/settings-1.0.0.xsd">  
 <mirrors>
    <mirror>
      <id>CN</id>
      <name>OSChina Central</name>                                                                                                                       
      <url>http://maven.oschina.net/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  
  <localRepository>D:\Java\m2\repository</localRepository>
</settings>

可见,本地的Maven库存放位置为:D:\Java\m2\repository,在这个目录下,有如下结构(正常情况下,异常情况下是没有这个结果的,而且dubbo2.8.4这个版本没有公开发布到maven中心库,需要自己进行编译,编译成功后,就可以得到如下的文件结构):

image

编译过程:1.从github上将大猫download下来,下载地址:https://github.com/dangdangdotcom/dubbox 

image

下载下来后,解压,在解压后的路径中,执行: mvn install -Dmaven.test.skip=true

image

执行完毕后,就可以生成本地maven库中dubbo的目录结构,这样工程中所有使用dubbo2.8.4的地方,都可以正常的编译:

image

2. 用Maven构建web工程,出现如下错误:

Description    Resource    Path    Location    Type
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path    index.jsp    /web Maven Webapp/src/main/webapp    line 1    JSP Problem

这个错误是因为没有导入web工程的运行时环境导致的,解决办法如下:

image  image

image

然后将project clean后,重新构建,错误自动消失。

3. 修改项目的JDK版本,有时会出现MyEclipse打出的war包,部署到Tomcat服务器上不能够使用的情况,错误一般如下,对于这种情况,要认真检查项目使用JDK版本,以及服务器运行时的JDK版本,只要匹配就不会有问题。

Unsupported major.minor version 52.0 (unable to load class:
What it means is that , your code is compiled with different version of java to java version which is running it . make sure you compile and runt it with the same version if java.

image

Image

Image

4. Maven POM中添加的 Spring版本和Myeclipse提供的Spring版本中出现冲突,解决办法是将Myeclipse中自带的Spring 4.1从Build中移除掉:

image

十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version:        Apache Tomcat/8.0.21
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built:          Mar 23 2015 14:11:21 UTC
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number:         8.0.21.0
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name:               Windows 7
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version:            6.1
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture:          amd64
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home:             C:\Program Files\Java\jdk1.8.0_45\jre
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version:           1.8.0_45-b14
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor:            Oracle Corporation
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE:         D:\tools\apache-tomcat-8.0.21
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME:         D:\tools\apache-tomcat-8.0.21
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dmaven.multiModuleProjectDirectory=M2_HOME
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=D:\tools\apache-tomcat-8.0.21
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\tools\apache-tomcat-8.0.21
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=D:\tools\apache-tomcat-8.0.21\webapps
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\tools\apache-tomcat-8.0.21\endorsed
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.library.path=C:\Program Files\Java\jdk1.8.0_45\bin;D:\tools\apache-tomcat-8.0.21\bin
十一月 12, 2015 8:16:31 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
十一月 12, 2015 8:16:31 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
十一月 12, 2015 8:16:31 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
十一月 12, 2015 8:16:31 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.1m 19 Mar 2015)
十一月 12, 2015 8:16:33 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
十一月 12, 2015 8:16:33 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
十一月 12, 2015 8:16:33 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2776 ms
十一月 12, 2015 8:16:33 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十一月 12, 2015 8:16:33 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.0.21
十一月 12, 2015 8:16:33 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\docs
十一月 12, 2015 8:16:33 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [177] milliseconds.
十一月 12, 2015 8:16:33 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\docs has finished in 623 ms
十一月 12, 2015 8:16:33 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\examples
十一月 12, 2015 8:16:34 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
十一月 12, 2015 8:16:34 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
十一月 12, 2015 8:16:34 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\examples has finished in 439 ms
十一月 12, 2015 8:16:34 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\FileIO
十一月 12, 2015 8:16:44 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
十一月 12, 2015 8:16:44 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
十一月 12, 2015 8:16:44 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
十一月 12, 2015 8:16:45 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'secretKeyService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.cetc.di.db.secretkeydb.service.impl.secretKeyServiceImpl.setSecretKeyMapper(com.cetc.di.db.secretkeydb.dao.secretKeyDtoMapper); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.cetc.di.db.secretkeydb.dao.secretKeyDtoMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'secretKeyDtoMapper' defined in file [D:\tools\apache-tomcat-8.0.21\webapps\FileIO\WEB-INF\classes\com\cetc\di\db\secretkeydb\dao\secretKeyDtoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotationAttributes(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Lorg/springframework/core/annotation/AnnotationAttributes;
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:326)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1204)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1096)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1756)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.cetc.di.db.secretkeydb.service.impl.secretKeyServiceImpl.setSecretKeyMapper(com.cetc.di.db.secretkeydb.dao.secretKeyDtoMapper); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.cetc.di.db.secretkeydb.dao.secretKeyDtoMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:630)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:323)
    ... 26 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.cetc.di.db.secretkeydb.dao.secretKeyDtoMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1261)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1009)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:904)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)
    ... 28 more
Related cause:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'secretKeyDtoMapper' defined in file [D:\tools\apache-tomcat-8.0.21\webapps\FileIO\WEB-INF\classes\com\cetc\di\db\secretkeydb\dao\secretKeyDtoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotationAttributes(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Lorg/springframework/core/annotation/AnnotationAttributes;
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:336)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1471)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(
AbstractAutowireCapableBeanFactory.java:1216)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1418)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:803)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:541)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:406)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:381)
    at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:187)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1066)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1006)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:904)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:323)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1204)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1096)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1756)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotationAttributes(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Lorg/springframework/core/annotation/AnnotationAttributes;
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:336)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1471)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1216)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    ... 46 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotationAttributes(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Lorg/springframework/core/annotation/AnnotationAttributes;
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:548)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.sup
port.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    ... 56 more
Caused by: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotationAttributes(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Lorg/springframework/core/annotation/AnnotationAttributes;
    at org.springframework.transaction.annotation.SpringTransactionAnnotationParser.parseTransactionAnnotation(SpringTransactionAnnotationParser.java:42)
    at org.springframework.transaction.annotation.AnnotationTransactionAttributeSource.determineTransactionAttribute(AnnotationTransactionAttributeSource.java:154)
    at org.springframework.transaction.annotation.AnnotationTransactionAttributeSource.findTransactionAttribute(AnnotationTransactionAttributeSource.java:133)
    at org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource.computeTransactionAttribute(AbstractFallbackTransactionAttributeSource.java:151)
    at org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource.getTransactionAttribute(AbstractFallbackTransactionAttributeSource.java:100)
    at org.springframework.transaction.interceptor.TransactionAttributeSourcePointcut.matches(TransactionAttributeSourcePointcut.java:41)
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:225)
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:262)
    at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:294)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:118)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:88)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:69)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:328)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:291)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1573)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
    ... 62 more

十一月 12, 2015 8:16:45 下午 org.apache.catalina.core.StandardContext startInternal
严重: Error listenerStart
十一月 12, 2015 8:16:45 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/FileIO] startup failed due to previous errors
十一月 12, 2015 8:16:45 下午 org.apache.catalina.core.StandardContext listenerStop
严重: Exception sending context destroyed event to listener instance of class com.github.miemiedev.mybatis.paginator.CleanupMybatisPaginatorListener
java.lang.NullPointerException
    at com.github.miemiedev.mybatis.paginator.CleanupMybatisPaginatorListener.contextDestroyed(CleanupMybatisPaginatorListener.java:15)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4775)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5389)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1096)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1756)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
十一月 12, 2015 8:16:45 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\FileIO has finished in 11,456 ms
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\host-manager
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\host-manager has finished in 35 ms
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\manager
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\manager has finished in 15 ms
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\ROOT
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\ROOT has finished in 9 ms
十一月 12, 2015 8:16:45 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
十一月 12, 2015 8:16:45 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
十一月 12, 2015 8:16:45 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 12662 ms

 

5.dubbo出现,Duplicate application configs,这个是因为,一个war包中,一次只能够有一个dubbo的app,出现这个错误的原因是因为在一个工程中,同时定义了两个dubbo的app,解决办法是将另外一个APP中要注册的服务放到另外一个APP中,就OK了。

image

十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version:        Apache Tomcat/8.0.21
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built:          Mar 23 2015 14:11:21 UTC
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number:         8.0.21.0
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name:               Windows 7
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version:            6.1
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture:          amd64
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home:             C:\Program Files\Java\jdk1.8.0_45\jre
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version:           1.8.0_45-b14
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor:            Oracle Corporation
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE:         D:\tools\apache-tomcat-8.0.21
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME:         D:\tools\apache-tomcat-8.0.21
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dmaven.multiModuleProjectDirectory=M2_HOME
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=D:\tools\apache-tomcat-8.0.21
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\tools\apache-tomcat-8.0.21
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=D:\tools\apache-tomcat-8.0.21\webapps
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\tools\apache-tomcat-8.0.21\endorsed
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.library.path=C:\Program Files\Java\jdk1.8.0_45\bin;D:\tools\apache-tomcat-8.0.21\bin
十一月 11, 2015 8:08:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
十一月 11, 2015 8:08:06 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
十一月 11, 2015 8:08:06 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
十一月 11, 2015 8:08:07 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.1m 19 Mar 2015)
十一月 11, 2015 8:08:07 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
十一月 11, 2015 8:08:07 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
十一月 11, 2015 8:08:07 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 880 ms
十一月 11, 2015 8:08:07 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十一月 11, 2015 8:08:07 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.0.21
十一月 11, 2015 8:08:07 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\docs
十一月 11, 2015 8:08:07 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [125] milliseconds.
十一月 11, 2015 8:08:07 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\docs has finished in 296 ms
十一月 11, 2015 8:08:07 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\examples
十一月 11, 2015 8:08:07 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
十一月 11, 2015 8:08:07 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
十一月 11, 2015 8:08:07 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\examples has finished in 207 ms
十一月 11, 2015 8:08:07 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\FileIO
十一月 11, 2015 8:08:10 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
十一月 11, 2015 8:08:10 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
十一月 11, 2015 8:08:10 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
十一月 11, 2015 8:08:12 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cetc.di.io.demoservice.DemoService': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Duplicate application configs: <dubbo:application name="diservice-provicer" id="diservice-provicer" /> and <dubbo:application name="hello-world-app" id="hello-world-app" />
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:835)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1096)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1756)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Duplicate application configs: <dubbo:application name="diservice-provicer" id="diservice-provicer" /> and <dubbo:application name="hello-world-app" id="hello-world-app" />
    at com.alibaba.dubbo.config.spring.ServiceBean.afterPropertiesSet(ServiceBean.java:165)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 25 more
十一月 11, 2015 8:08:12 下午 org.apache.catalina.core.StandardContext startInternal
严重: Error listenerStart
十一月 11, 2015 8:08:12 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/FileIO] startup failed due to previous errors
十一月 11, 2015 8:08:12 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\FileIO has finished in 4,408 ms
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\host-manager
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\host-manager has finished in 17 ms
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\manager
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\manager has finished in 15 ms
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tools\apache-tomcat-8.0.21\webapps\ROOT
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tools\apache-tomcat-8.0.21\webapps\ROOT has finished in 13 ms
十一月 11, 2015 8:08:12 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
十一月 11, 2015 8:08:12 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
十一月 11, 2015 8:08:12 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 4991 ms

提交成功后的dubbo控制台效果如下:

image

image

image

6. web.xml中配置注意事项:

image

 

7. 打成war包要注意check Maven依赖是否被成功的加入到了打包路径,在Deployment Assembly中设置:

Image

8. 在Mavne pom.xml文件中指定JDK版本:

image

 

9. 在maven pom.xml文件中指定多个地址:

image

在show view中找到maven,可以看到工程maven库的情况:

image

10. 更新整个工程,让maven重新check Pom文件,类似于idea intellij中 maven reimport:

image

11. 在执行run –> mvn compile/install/clean出现找不到M2_HOME的情况,解决方案如下:

在JDK中添加默认参数-Dmaven.multiModuleProjectDirectory=M2_HOME(前提是操作系统中设置了M2_HOME的环境变量,注意windows系统中,M2_HOME前面不能够添加$符号,在linux系统中必须要添加$符号

image

 

 

 

 

 

 

 

 

posted @ 2015-11-12 20:41  justinzhang  阅读(26783)  评论(0编辑  收藏  举报