zoukankan      html  css  js  c++  java
  • spring + spring mvc 使用 maven 编译出现异常

    异常如下:

    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building ssm 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> tomcat7-maven-plugin:2.1:run (default-cli) > process-classes @ ssm >>>
    [WARNING] The artifact aspectj:aspectjweaver:jar:1.5.4 has been relocated to org.aspectj:aspectjweaver:jar:1.5.4
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ssm ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 1 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ssm ---
    [INFO] Changes detected - recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
    [INFO] Compiling 1 source file to D:gitssm argetclasses
    [INFO]
    [INFO] <<< tomcat7-maven-plugin:2.1:run (default-cli) < process-classes @ ssm <<<
    [WARNING] The artifact aspectj:aspectjweaver:jar:1.5.4 has been relocated to org.aspectj:aspectjweaver:jar:1.5.4
    [INFO]
    [INFO] --- tomcat7-maven-plugin:2.1:run (default-cli) @ ssm ---
    [INFO] Running war on http://localhost:8093/ssm
    [INFO] Creating Tomcat server configuration at D:gitssm arget omcat
    [INFO] create webapp with contextPath: /ssm
    十二月 25, 2017 9:46:54 下午 org.apache.coyote.AbstractProtocol init
    信息: Initializing ProtocolHandler ["http-bio-8093"]
    十二月 25, 2017 9:46:54 下午 org.apache.catalina.core.StandardService startInternal
    信息: Starting service Tomcat
    十二月 25, 2017 9:46:54 下午 org.apache.catalina.core.StandardEngine startInternal
    信息: Starting Servlet Engine: Apache Tomcat/7.0.37
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
    十二月 25, 2017 9:46:55 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
    十二月 25, 2017 9:46:56 下午 org.apache.catalina.core.ApplicationContext log
    信息: No Spring WebApplicationInitializer types detected on classpath
    十二月 25, 2017 9:46:56 下午 org.apache.catalina.core.ApplicationContext log
    信息: Initializing Spring root WebApplicationContext
    INFO [localhost-startStop-1] - Root WebApplicationContext: initialization started
    DEBUG [localhost-startStop-1] - Adding [servletConfigInitParams] PropertySource with lowest search precedence
    DEBUG [localhost-startStop-1] - Adding [servletContextInitParams] PropertySource with lowest search precedence
    DEBUG [localhost-startStop-1] - Adding [jndiProperties] PropertySource with lowest search precedence
    DEBUG [localhost-startStop-1] - Adding [systemProperties] PropertySource with lowest search precedence
    DEBUG [localhost-startStop-1] - Adding [systemEnvironment] PropertySource with lowest search precedence
    DEBUG [localhost-startStop-1] - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
    DEBUG [localhost-startStop-1] - Replacing [servletContextInitParams] PropertySource with [servletContextInitParams]
    INFO [localhost-startStop-1] - Refreshing Root WebApplicationContext: startup date [Mon Dec 25 21:46:56 CST 2017]; root of context hierarchy
    DEBUG [localhost-startStop-1] - Adding [systemProperties] PropertySource with lowest search precedence
    DEBUG [localhost-startStop-1] - Adding [systemEnvironment] PropertySource with lowest search precedence
    DEBUG [localhost-startStop-1] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
    INFO [localhost-startStop-1] - Loading XML bean definitions from class path resource [spring.xml]
    ERROR [localhost-startStop-1] - Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
    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:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
    ... 21 more
    十二月 25, 2017 9:46:56 下午 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.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
    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:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
    ... 21 more

    十二月 25, 2017 9:46:56 下午 org.apache.catalina.core.StandardContext startInternal
    严重: Error listenerStart
    十二月 25, 2017 9:46:56 下午 org.apache.catalina.core.StandardContext startInternal
    严重: Context [/ssm] startup failed due to previous errors
    十二月 25, 2017 9:46:56 下午 org.apache.catalina.core.ApplicationContext log
    信息: Closing Spring root WebApplicationContext
    INFO [localhost-startStop-1] - Closing Root WebApplicationContext: startup date [Mon Dec 25 21:46:56 CST 2017]; root of context hierarchy
    WARN [localhost-startStop-1] - Exception thrown from ApplicationListener handling ContextClosedEvent
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Mon Dec 25 21:46:56 CST 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:344)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:869)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:578)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5483)
    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$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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)
    WARN [localhost-startStop-1] - Exception thrown from LifecycleProcessor on context close
    java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Mon Dec 25 21:46:56 CST 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:877)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:578)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5483)
    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$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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)
    十二月 25, 2017 9:46:56 下午 org.apache.catalina.core.StandardContext listenerStop
    严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:908)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:578)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5483)
    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$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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)

    十二月 25, 2017 9:46:56 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    严重: The web application [/ssm] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    十二月 25, 2017 9:46:56 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    严重: The web application [/ssm] registered the JDBC driver [com.mysql.fabric.jdbc.FabricMySQLDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    十二月 25, 2017 9:46:56 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
    严重: The web application [/ssm] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
    十二月 25, 2017 9:46:56 下午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["http-bio-8093"]

    解决方法:

    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
    <source>1.6</source>
    <target>1.6</target>
    <encoding>UTF-8</encoding>
    </configuration>
    </plugin>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
    <warSourceExcludes>${warExcludes}</warSourceExcludes>
    </configuration>
    </plugin>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.4.3</version>
    <configuration>
    <testFailureIgnore>true</testFailureIgnore>
    </configuration>
    </plugin>
    <plugin>
    <inherited>true</inherited>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <executions>
    <execution>
    <id>attach-sources</id>
    <goals>
    <goal>jar</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <configuration>
    <encoding>UTF-8</encoding>
    </configuration>
    </plugin>

  • 相关阅读:
    ubuntu 12.04 配置iscsi共享及挂载iscsi共享
    python_数据类型
    python_基本操作
    shell习题第5题:批量更改文件后缀名
    shell习题第4题:监控ip地址存活
    shell习题第3题:统计内存大小
    shell习题第2题:统计ip访问量
    shell习题第1题:每日一文件
    IIS网站的应用程序与虚拟目录的区别及应用
    http状态码
  • 原文地址:https://www.cnblogs.com/bg7c/p/8111412.html
Copyright © 2011-2022 走看看