tomcat 7未能从eclipse中启动。

时间:2023-01-19 10:50:44

I am trying to do a run as...run on server of a spring mvc web app from within eclipse, and I am getting the following dialog box error:

我正在尝试在eclipse中运行spring mvc web应用的服务器上,我得到了下面的对话框错误:

tomcat 7未能从eclipse中启动。

Can someone show me how to fix this?

有人能告诉我怎么修理吗?

Here is the complete stack trace:

以下是完整的堆栈跟踪:

Mar 18, 2014 2:03:22 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: list of lotsa files with their paths.
Mar 18, 2014 2:03:22 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:KnowledgeManager' did not find a matching property.
Mar 18, 2014 2:03:22 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 18, 2014 2:03:22 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mar 18, 2014 2:03:22 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 637 ms
Mar 18, 2014 2:03:22 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 18, 2014 2:03:22 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Mar 18, 2014 2:03:23 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start      
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/KnowledgeManager]]  
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    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$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/KnowledgeManager]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 7 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ConfigurableApplicationContext
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
    at java.lang.Class.getDeclaredFields(Class.java:1743)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:263)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:92)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 7 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ConfigurableApplicationContext
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 21 more
Mar 18, 2014 2:03:23 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: 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$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:691)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    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$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 7 more
Mar 18, 2014 2:03:23 PM org.apache.catalina.startup.Catalina start
SEVERE: 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:154)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:691)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
    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:154)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    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:1131)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more
Mar 18, 2014 2:03:23 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Mar 18, 2014 2:03:23 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Mar 18, 2014 2:03:23 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Mar 18, 2014 2:03:23 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Mar 18, 2014 2:03:23 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]

Here is the spring-context dependency as it is written in my pom.xml:

这里是spring-context依赖项,它是在我的blog .xml中编写的:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${spring-framework.version}</version>
</dependency>  

I also did a maven update project, a maven download sources, and an eclipse clean project, but none of those things have fixed this problem.

我还做了一个maven更新项目、一个maven下载源和一个eclipse clean项目,但是这些都没有解决这个问题。

What can I do to fix the problem?

我能做些什么来解决这个问题呢?

6 个解决方案

#1


5  

Here is the cause of the exception:

以下是例外的原因:

java.lang.ClassNotFoundException: org.springframework.context.ConfigurableApplicationContext

You should add spring-context and all the jars that this artifact depends on to the classpath of your project, Ex: org.springframework spring-context ${org.springframework.version}

您应该将spring-context和这个工件所依赖的所有jar添加到项目的类路径,例如:org。springframework spring上下文$ { org.springframework.version }

EDIT:

编辑:

Right click your project -> properties -> Deployment Assembly and verify that your project dependencies are deployed to WEB-INF/lib:

右键单击您的项目—>属性—>部署程序集,并验证您的项目依赖项已部署到WEB-INF/lib:

tomcat 7未能从eclipse中启动。

EDIT:

编辑:

What really resolved the problem: right click on server(in the servers view of eclipse) -> clean + publish.

真正解决问题的是:右键单击服务器(在eclipse的servers视图中)-> clean + publish。

#2


3  

I also had the same problem. the problem was occurred because common logging .jar file was not added in my project build path. after adding it project works fine.

我也有同样的问题。出现这个问题是因为在我的项目构建路径中没有添加普通的log .jar文件。添加it项目之后,一切正常。

#3


1  

that stack trace clearly says ClassNotFoundException

堆栈跟踪显然是ClassNotFoundException

It seems that Spring-context.jar is not found in your class path.

看来spring上下文。在类路径中找不到jar。

Try adding that jar in your class path first.

首先尝试在类路径中添加jar。

#4


1  

Can you see the spring jars in the "Maven Dependencies" section on the project?

您能在项目的“Maven依赖项”部分看到spring jar吗?

If not, you can have a problem in your pom dependencies definition, or maybe update project didn't complete successfully. Try check dependencies definition and run update project again.

如果没有,您可能会在pom依赖定义中遇到问题,或者更新项目没有成功完成。尝试检查依赖定义并再次运行更新项目。

If so, did you try "clean..., "clean work directory" and "publish" on your server?

如果是的话,你试过“清洁……”,在您的服务器上“清理工作目录”和“发布”?

Hope it helps.

希望它可以帮助。

#5


0  

Check your url pattern in web.xml /webapp/* replace "webapp" with your path name

在web中检查url模式。将“webapp”替换为路径名

#6


0  

I had same problem because of dependencies which are available in pom.xml file,some of them are corrupted.I resolve that by simply removing .m2/repository folder contents and followed this steps.

由于pom中提供的依赖项,我也遇到了同样的问题。xml文件,其中一些已经损坏。我通过简单地删除.m2/repository文件夹内容来解决这个问题,并遵循以下步骤。

  1. Run as -> Maven clean.
  2. 运行as -> Maven clean。
  3. Run as -> Maven Install.(Use good internet provider).
  4. 以-> Maven安装方式运行。(使用良好的互联网服务提供商)。
  5. maven -> Update project.
  6. maven - >更新项目。

Hope it will help you too.

希望它也能帮助你。

#1


5  

Here is the cause of the exception:

以下是例外的原因:

java.lang.ClassNotFoundException: org.springframework.context.ConfigurableApplicationContext

You should add spring-context and all the jars that this artifact depends on to the classpath of your project, Ex: org.springframework spring-context ${org.springframework.version}

您应该将spring-context和这个工件所依赖的所有jar添加到项目的类路径,例如:org。springframework spring上下文$ { org.springframework.version }

EDIT:

编辑:

Right click your project -> properties -> Deployment Assembly and verify that your project dependencies are deployed to WEB-INF/lib:

右键单击您的项目—>属性—>部署程序集,并验证您的项目依赖项已部署到WEB-INF/lib:

tomcat 7未能从eclipse中启动。

EDIT:

编辑:

What really resolved the problem: right click on server(in the servers view of eclipse) -> clean + publish.

真正解决问题的是:右键单击服务器(在eclipse的servers视图中)-> clean + publish。

#2


3  

I also had the same problem. the problem was occurred because common logging .jar file was not added in my project build path. after adding it project works fine.

我也有同样的问题。出现这个问题是因为在我的项目构建路径中没有添加普通的log .jar文件。添加it项目之后,一切正常。

#3


1  

that stack trace clearly says ClassNotFoundException

堆栈跟踪显然是ClassNotFoundException

It seems that Spring-context.jar is not found in your class path.

看来spring上下文。在类路径中找不到jar。

Try adding that jar in your class path first.

首先尝试在类路径中添加jar。

#4


1  

Can you see the spring jars in the "Maven Dependencies" section on the project?

您能在项目的“Maven依赖项”部分看到spring jar吗?

If not, you can have a problem in your pom dependencies definition, or maybe update project didn't complete successfully. Try check dependencies definition and run update project again.

如果没有,您可能会在pom依赖定义中遇到问题,或者更新项目没有成功完成。尝试检查依赖定义并再次运行更新项目。

If so, did you try "clean..., "clean work directory" and "publish" on your server?

如果是的话,你试过“清洁……”,在您的服务器上“清理工作目录”和“发布”?

Hope it helps.

希望它可以帮助。

#5


0  

Check your url pattern in web.xml /webapp/* replace "webapp" with your path name

在web中检查url模式。将“webapp”替换为路径名

#6


0  

I had same problem because of dependencies which are available in pom.xml file,some of them are corrupted.I resolve that by simply removing .m2/repository folder contents and followed this steps.

由于pom中提供的依赖项,我也遇到了同样的问题。xml文件,其中一些已经损坏。我通过简单地删除.m2/repository文件夹内容来解决这个问题,并遵循以下步骤。

  1. Run as -> Maven clean.
  2. 运行as -> Maven clean。
  3. Run as -> Maven Install.(Use good internet provider).
  4. 以-> Maven安装方式运行。(使用良好的互联网服务提供商)。
  5. maven -> Update project.
  6. maven - >更新项目。

Hope it will help you too.

希望它也能帮助你。