eclipse 启动项目提示错误信息:

警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:com.mimvp.homer' did not find a matching property.

这个问题困扰很久了,逛了很多论坛,查了很多博客资料,终于得以解决:

四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version:        Apache Tomcat/7.0.77
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built:          Mar 28 2017 16:01:48 UTC
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number:         7.0.77.0
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name:               Windows 7
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version:            6.1
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture:          amd64
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home:             D:\Pro-files\JDK-1.8\jre-1.8
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version:           1.8.0_121-b13
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor:            Oracle Corporation
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE:         E:\myPro\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME:         D:\Pro\apache-tomcat-7.0.77
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=E:\myPro\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\Pro\apache-tomcat-7.0.77
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=E:\myPro\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\Pro\apache-tomcat-7.0.77\endorsed
四月 28, 2017 7:34:25 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=UTF-8
四月 28, 2017 7:34:25 下午 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:\Pro-files\JDK-1.8\jre-1.8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Pro-files/JDK-1.8/jre-1.8/bin/server;D:/Pro-files/JDK-1.8/jre-1.8/bin;D:/Pro-files/JDK-1.8/jre-1.8/lib/amd64;D:\Pro\Python27\;D:\Pro\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Lenovo\Fingerprint Manager Pro\;D:\App-files\QuickTime\QTSystem\;D:\Pro-files\maven-3.3.9\bin;D:\Pro-files\PuTTY\;D:\Pro\MySQL\mysql-5.7.17-winx64\bin;;D:\Pro-files\JDK-1.8\bin;D:\Pro-files\JDK-1.8\jre\bin;E:\myPro\eclipse;;.
四月 28, 2017 7:34:26 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
四月 28, 2017 7:34:26 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
四月 28, 2017 7:34:26 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1007 ms
四月 28, 2017 7:34:26 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
四月 28, 2017 7:34:26 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.77
四月 28, 2017 7:34:27 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [907] milliseconds.
四月 28, 2017 7:34:27 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor E:\myPro\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\com.mimvp.homer.xml
四月 28, 2017 7:34:27 下午 org.apache.catalina.startup.SetContextPropertiesRule begin
警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:com.mimvp.homer' did not find a matching property.
四月 28, 2017 7:34:27 下午 org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
信息: validateJarFile(E:\myPro\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\com.mimvp.homer\WEB-INF\lib\javaee-api-7.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
四月 28, 2017 7:34:30 下午 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.
四月 28, 2017 7:34:30 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
四月 28, 2017 7:34:30 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
[org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization started
[org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing Root WebApplicationContext: startup date [Fri Apr 28 19:34:30 CST 2017]; root of context hierarchy
[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [spring-mybatis.xml]
[org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] - Loading properties file from class path resource [jdbc.properties]
[org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 1431 ms
[org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'SpringMVC': initialization started
[org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing WebApplicationContext for namespace 'SpringMVC-servlet': startup date [Fri Apr 28 19:34:31 CST 2017]; parent: Root WebApplicationContext
四月 28, 2017 7:34:31 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'SpringMVC'
[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [spring-mvc.xml]
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - Mapped URL path [/user/showPwd] onto handler 'userController'
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - Mapped URL path [/user/showPwd.*] onto handler 'userController'
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - Mapped URL path [/user/showPwd/] onto handler 'userController'
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - Mapped URL path [/user/showUser] onto handler 'userController'
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - Mapped URL path [/user/showUser.*] onto handler 'userController'
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - Mapped URL path [/user/showUser/] onto handler 'userController'
[org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'SpringMVC': initialization completed in 666 ms
四月 28, 2017 7:34:32 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deployment of configuration descriptor E:\myPro\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\com.mimvp.homer.xml has finished in 4,589 ms
四月 28, 2017 7:34:32 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
四月 28, 2017 7:34:32 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
四月 28, 2017 7:34:32 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 6256 ms

 

1、网上给的解决方法失败

在Servers视图里双击server

warningsetcontextpropertiesrulecontextsettingpropertysourcetoorg-eclipse-jst-jee-servercom-mimvp-homerdidnotfindamatchingproperty-01

在Server Options栏,勾选中"Publish module contexts to separate XML files"选项

warningsetcontextpropertiesrulecontextsettingpropertysourcetoorg-eclipse-jst-jee-servercom-mimvp-homerdidnotfindamatchingproperty-02

但是,这种解决办法在tomcat6好用,不适合tomcat7;

 

2、修改配置文件 server.xml 失败

关闭tomcat,在server.xml中将Context的source属性去掉,

<Context docBase="com.mimvp.homer" path="/com.mimvp.homer" reloadable="true" source="org.eclipse.jst.jee.server:com.mimvp.homer"/>

修改为:

<Context docBase="com.mimvp.homer" path="/com.mimvp.homer" reloadable="true" />

 

3、删除项目重新编译成功

1) 打开server视图

Eclipse ——》 Window ——》 Show View ——》 Others ——》 Server ——》 Servers

删除servers里的项目名称,例如:删除下图中的 com.mimvp.homer

warningsetcontextpropertiesrulecontextsettingpropertysourcetoorg-eclipse-jst-jee-servercom-mimvp-homerdidnotfindamatchingproperty-03

 

2)修改tomcat服务器的配置文件 server.xml

warningsetcontextpropertiesrulecontextsettingpropertysourcetoorg-eclipse-jst-jee-servercom-mimvp-homerdidnotfindamatchingproperty-04

 

3)在server.xml文件里,删除你项目的配置Context

<Context docBase="com.mimvp.homer" path="/com.mimvp.homer" reloadable="true" source="org.eclipse.jst.jee.server:com.mimvp.homer"/></Host>

warningsetcontextpropertiesrulecontextsettingpropertysourcetoorg-eclipse-jst-jee-servercom-mimvp-homerdidnotfindamatchingproperty-05

 

4) 重新 clean build

Eclipse ——》 Project(菜单) ——》 Clean... ——》 选中“mimvpdemo”——》 重新编译

右键项目名(mimvpdemo) ——》 Run as ——》 Run On Server(不要直接Run Apache服务器)——》Apache Tomcat v7.0 ——》 Next (不要直接Finish)——》 选中项目“mimvpdemo”——》 Finish

上面红色字体,非常重要,可以在Servers —> Apache Tomcat v7.0-config —> server.xml 文件里,重新生成项目的根目录,如下图:

warningsetcontextpropertiesrulecontextsettingpropertysourcetoorg-eclipse-jst-jee-servercom-mimvp-homerdidnotfindamatchingproperty-06