• maven编译问题-maven项目运行时找不到文件,解决方案之一


    问题描述:
    以上信息是tomcat在启动项目的时候报的错误信息,发现没有找到配置文件,实际上配置文件在项目中是存在的,但是,在编译过程中,配置文件没有能加载到编译后的项目中。
    就造成了,找不到这些怕配置文件。

    六月 11, 2018 1:58:35 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
    警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:rtda' did not find a matching property.
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Server version:        Apache Tomcat/7.0.88
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Server built:          May 7 2018 11:12:57 UTC
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Server number:         7.0.88.0
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: OS Name:               Windows 7
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: OS Version:            6.1
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Architecture:          amd64
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Java Home:             D:Program FilesJavajdk1.7.0_80jre
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: JVM Version:           1.7.0_80-b15
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: JVM Vendor:            Oracle Corporation
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: CATALINA_BASE:         D:	omcatapache-tomcat-7.0.88
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: CATALINA_HOME:         D:	omcatapache-tomcat-7.0.88
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:53060
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Command line argument: -Dcatalina.base=D:	omcatapache-tomcat-7.0.88
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Command line argument: -Dcatalina.home=D:	omcatapache-tomcat-7.0.88
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Command line argument: -Dwtp.deploy=D:	omcatapache-tomcat-7.0.88webapps
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Command line argument: -Djava.endorsed.dirs=D:	omcatapache-tomcat-7.0.88endorsed
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.VersionLoggerListener log
    信息: Command line argument: -Dfile.encoding=UTF-8
    六月 11, 2018 1:58:35 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:Program FilesJavajdk1.7.0_80in;C:WindowsSunJavain;C:Windowssystem32;C:Windows;D:Program FilesJavajdk1.7.0_80jrein;D:/Program Files/Java/jdk1.7.0_80/bin/../jre/bin/server;D:/Program Files/Java/jdk1.7.0_80/bin/../jre/bin;D:/Program Files/Java/jdk1.7.0_80/bin/../jre/lib/amd64;D:mavenapache-maven-3.5.0in;D:Program FilesJavajdk1.7.0_80in;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;D:Program FilesTortoiseSVNin;C:Program Files (x86)MySQLMySQL Server 5.5in;D:IDEeclipse;;.
    六月 11, 2018 1:58:35 下午 org.apache.coyote.AbstractProtocol init
    信息: Initializing ProtocolHandler ["http-bio-8080"]
    六月 11, 2018 1:58:35 下午 org.apache.coyote.AbstractProtocol init
    信息: Initializing ProtocolHandler ["ajp-bio-8009"]
    六月 11, 2018 1:58:35 下午 org.apache.catalina.startup.Catalina load
    信息: Initialization processed in 847 ms
    六月 11, 2018 1:58:35 下午 org.apache.catalina.core.StandardService startInternal
    信息: Starting service Catalina
    六月 11, 2018 1:58:35 下午 org.apache.catalina.core.StandardEngine startInternal
    信息: Starting Servlet Engine: Apache Tomcat/7.0.88
    六月 11, 2018 1:58:37 下午 org.apache.catalina.startup.TldConfig execute
    信息: 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, 2018 1:58:37 下午 org.apache.catalina.core.ApplicationContext log
    信息: No Spring WebApplicationInitializer types detected on classpath
    六月 11, 2018 1:58:37 下午 org.apache.catalina.core.ApplicationContext log
    信息: Set web app root system property: 'webapp.root' = [D:	omcatapache-tomcat-7.0.88webapps
    tda]
    六月 11, 2018 1:58:37 下午 org.apache.catalina.core.ApplicationContext log
    信息: Initializing log4j from [classpath:log4j.xml]
    六月 11, 2018 1:58:37 下午 org.apache.catalina.core.StandardContext listenerStart
    严重: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener
    java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter: class path resource [log4j.xml] cannot be resolved to URL because it does not exist
    	at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:155)
    	at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5157)
    	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5680)
    	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1702)
    	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1692)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    	at java.lang.Thread.run(Thread.java:745)
    
    六月 11, 2018 1:58:37 下午 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, 2018 1:58:39 下午 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: Invalid bean definition with name 'dataSource' defined in class path resource [spring/applicationContext.xml]: Could not resolve placeholder 'dbcp.driver'
    	at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209)
    	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:220)
    	at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:84)
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:656)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
    	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5157)
    	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5680)
    	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1702)
    	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1692)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    	at java.lang.Thread.run(Thread.java:745)
    
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.StandardContext startInternal
    严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
    六月 11, 2018 1:58:39 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
    警告: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [105] milliseconds.
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.StandardContext startInternal
    严重: Context [/rtda] startup failed due to previous errors
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.ApplicationContext log
    信息: Closing Spring root WebApplicationContext
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.ApplicationContext log
    信息: Shutting down log4j
    六月 11, 2018 1:58:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory D:	omcatapache-tomcat-7.0.88webappsdocs
    六月 11, 2018 1:58:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory D:	omcatapache-tomcat-7.0.88webappsdocs has finished in 86 ms
    六月 11, 2018 1:58:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory D:	omcatapache-tomcat-7.0.88webappsexamples
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.ApplicationContext log
    信息: ContextListener: contextInitialized()
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.ApplicationContext log
    信息: SessionListener: contextInitialized()
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.ApplicationContext log
    信息: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@4984fd2f')
    六月 11, 2018 1:58:39 下午 org.apache.catalina.core.ApplicationContext log
    信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@34ed0665')
    六月 11, 2018 1:58:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory D:	omcatapache-tomcat-7.0.88webappsexamples has finished in 338 ms
    六月 11, 2018 1:58:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory D:	omcatapache-tomcat-7.0.88webappshost-manager
    六月 11, 2018 1:58:40 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory D:	omcatapache-tomcat-7.0.88webappshost-manager has finished in 154 ms
    六月 11, 2018 1:58:40 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory D:	omcatapache-tomcat-7.0.88webappsmanager
    六月 11, 2018 1:58:40 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory D:	omcatapache-tomcat-7.0.88webappsmanager has finished in 77 ms
    六月 11, 2018 1:58:40 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory D:	omcatapache-tomcat-7.0.88webappsROOT
    六月 11, 2018 1:58:40 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory D:	omcatapache-tomcat-7.0.88webappsROOT has finished in 67 ms
    六月 11, 2018 1:58:40 下午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["http-bio-8080"]
    六月 11, 2018 1:58:40 下午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["ajp-bio-8009"]
    六月 11, 2018 1:58:40 下午 org.apache.catalina.startup.Catalina start
    信息: Server startup in 4985 ms
    

     解决方案:
    1.在确定jdk和maven没有问题的时候,进行第二步操作;
    2.选择项目,右键“Maven”,选择“Select Maven profiles”,勾选dev选项,点击:OK按钮

    亲测好使。。。

  • 相关阅读:
    linux基础
    1-1python自动化测试环境搭建及开发工具安装
    Linux常用命令
    049.NET5_中间件
    045.NET5_基本鉴权授权
    044.NET5_基于Session_Cookies认证
    042-043.NET5_ResultFilter以及双语言应用
    041.NET5_ExceptionFilter
    040.NET5_ExceptionFilter
    039.NET5_自定义Filter匿名
  • 原文地址:https://www.cnblogs.com/zjiacun/p/9172647.html
Copyright © 2020-2023  润新知