请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

在TOMCAT的server.xml加上<Context>标签启动报错

严重: A child container failed during start

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/upload]]

at java.util.concurrent.FutureTask.report(FutureTask.java:122)

at java.util.concurrent.FutureTask.get(FutureTask.java:192)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/upload]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)

... 6 more

Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@5e71feff]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)

at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4860)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4995)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 6 more

Caused by: java.lang.IllegalArgumentException: The main resource set specified [G:\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\Users\mo\Documents\work\image\upload] is not valid

at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:749)

at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:706)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 9 more


三月 02, 2018 12:06:37 上午 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.

三月 02, 2018 12:06:38 上午 org.apache.catalina.core.ApplicationContext log

信息: No Spring WebApplicationInitializer types detected on classpath

三月 02, 2018 12:06:38 上午 org.apache.catalina.core.ContainerBase startInternal

严重: A child container failed during start

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]

at java.util.concurrent.FutureTask.report(FutureTask.java:122)

at java.util.concurrent.FutureTask.get(FutureTask.java:192)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.startup.Catalina.start(Catalina.java:670)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

Caused by: org.apache.catalina.LifecycleException: A child container failed during start

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948)

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 6 more


三月 02, 2018 12:06:38 上午 org.apache.catalina.startup.Catalina start

严重: The required Server component failed to start so Tomcat is unable to start.

org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)

at org.apache.catalina.startup.Catalina.start(Catalina.java:670)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)

at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 7 more

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)

at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 9 more

Caused by: org.apache.catalina.LifecycleException: A child container failed during start

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948)

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 11 more


正在回答 回答被采纳积分+3

1回答

翔仔 2018-03-02 11:05:12

同学好,我的配置是tomcat8.0

如下配置是没问题的

<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
	license agreements. See the NOTICE file distributed with this work for additional 
	information regarding copyright ownership. The ASF licenses this file to 
	You under the Apache License, Version 2.0 (the "License"); you may not use 
	this file except in compliance with the License. You may obtain a copy of 
	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
	by applicable law or agreed to in writing, software distributed under the 
	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
	OF ANY KIND, either express or implied. See the License for the specific 
	language governing permissions and limitations under the License. --><!-- Note: A "Server" is not itself a "Container", so you may not define 
	subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --><Server port="8005" shutdown="SHUTDOWN">
	<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
	<!-- Security listener. Documentation at /docs/config/listeners.html <Listener 
		className="org.apache.catalina.security.SecurityListener" /> -->
	<!--APR library loader. Documentation at /docs/apr.html -->
	<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
	<!-- Prevent memory leaks due to use of particular java/javax APIs -->
	<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
	<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
	<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

	<!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html -->
	<GlobalNamingResources>
		<!-- Editable user database that can also be used by UserDatabaseRealm 
			to authenticate users -->
		<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
	</GlobalNamingResources>

	<!-- A "Service" is a collection of one or more "Connectors" that share 
		a single "Container" Note: A "Service" is not itself a "Container", so you 
		may not define subcomponents such as "Valves" at this level. Documentation 
		at /docs/config/service.html -->
	<Service name="Catalina">

		<!--The connectors can use a shared executor, you can define one or more 
			named thread pools -->
		<!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" 
			minSpareThreads="4"/> -->


		<!-- A "Connector" represents an endpoint by which requests are received 
			and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html 
			(blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) 
			Connector: /docs/apr.html Define a non-SSL/TLS HTTP/1.1 Connector on port 
			8080 -->
		<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
		<!-- A "Connector" using the shared thread pool -->
		<!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" 
			connectionTimeout="20000" redirectPort="8443" /> -->
		<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 This connector uses 
			the NIO implementation that requires the JSSE style configuration. When using 
			the APR/native implementation, the OpenSSL style configuration is required 
			as described in the APR/native documentation -->
		<!-- <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" 
			maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" 
			sslProtocol="TLS" /> -->

		<!-- Define an AJP 1.3 Connector on port 8009 -->
		<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>


		<!-- An Engine represents the entry point (within Catalina) that processes 
			every request. The Engine implementation for Tomcat stand alone analyzes 
			the HTTP headers included with the request, and passes them on to the appropriate 
			Host (virtual host). Documentation at /docs/config/engine.html -->

		<!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine 
			name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> -->
		<Engine defaultHost="localhost" name="Catalina">

			<!--For clustering, please take a look at documentation at: /docs/cluster-howto.html 
				(simple how to) /docs/config/cluster.html (reference documentation) -->
			<!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> -->

			<!-- Use the LockOutRealm to prevent attempts to guess user passwords 
				via a brute-force attack -->
			<Realm className="org.apache.catalina.realm.LockOutRealm">
				<!-- This Realm uses the UserDatabase configured in the global JNDI resources 
					under the key "UserDatabase". Any edits that are performed against this UserDatabase 
					are immediately available for use by the Realm. -->
				<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
			</Realm>

			<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

				<!-- SingleSignOn valve, share authentication between web applications 
					Documentation at: /docs/config/valve.html -->
				<!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" 
					/> -->

				<!-- Access log processes all example. Documentation at: /docs/config/valve.html 
					Note: The pattern used is equivalent to using pattern="common" -->
				<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>

				
				<Context docBase="/Users/baidu/work/image/upload" path="/upload"/>
			<Context docBase="o2o" path="/o2o" reloadable="true" source="org.eclipse.jst.jee.server:o2o"/></Host>
		</Engine>
	</Service>
</Server>

同学Context标签记得写在 </Host> 里面哦

0 回复 有任何疑惑可以回复我~
  • 提问者 慕慕0286245 #1
    我的是8.5,应该没区别吧?
    回复 有任何疑惑可以回复我~ 2018-03-03 00:06:44
  • 提问者 慕慕0286245 #2
    把上面的复制到TOMCAT8.5的SERVER.XML也是启动失败
    回复 有任何疑惑可以回复我~ 2018-03-03 00:12:15
  • 翔仔 回复 提问者 慕慕0286245 #3
    8.5的话server.xml不能全部复制过去呢,毕竟是8.0的,同学首先需要确保把<Context>写在<Host>里,并且我看错误是The main resource set specified [G:\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\Users\mo\Documents\work\image\upload] is not valid,
    即设置路径是非法的,请检查好自己的路径,你看我的是绝对路径/Users/baidu/work/image/upload,而同学的看样子是eclipse发布tomcat项目时候动态在控制台里生成的路径,这个是不对的,因为启动tomcat加载路径的时候这段路径还未生成,所以需要放到别的绝对值路径下,比如G:\image\upload,并保证这些文件夹已生成即该路径合法
    回复 有任何疑惑可以回复我~ 2018-03-03 01:48:25
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信