java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

发布于 2024-11-13 09:27:52 字数 4509 浏览 3 评论 0原文

我将这些包含在构建路径中:

  • 所有 Spring 库
  • Apache Tomcat 7.0 库

项目在启动过程中仍然失败:

SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    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)
Jun 2, 2011 11:07:38 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    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)
Jun 2, 2011 11:07:38 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    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)

在 org.sprintframework.web-3.1.0.M1.jar 中,我可以看到org.springframework.web.context.ContextLoaderListener

Google 上有人说应该包含 spring.jar,但我在 3.x 发行版中没有看到任何 spring.jar

Eclipse 3.6.2
Tomcat 7

编辑:Spring 论坛(离线)上有人说应该在项目属性中检查“自动更新依赖项”,但我在项目属性中没有看到类似的内容。

I included these in the Build Path:

  • all Spring libs
  • Apache Tomcat 7.0 library

The project still fails during startup:

SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    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)
Jun 2, 2011 11:07:38 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    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)
Jun 2, 2011 11:07:38 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    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)

In org.sprintframework.web-3.1.0.M1.jar, I can see the org.springframework.web.context.ContextLoaderListener.

Someone on Google says that spring.jar should be included but I don't see any spring.jar in 3.x distribution.

Eclipse 3.6.2
Tomcat 7

Edit: Someone on the Spring Forum (offline) said "Automatically update dependencies" should be checked in Project Properties but I don't see anything like that in project properties.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(30

尐偏执 2024-11-20 09:27:53

对我来说,实际的解决方案是安装“m2e-wtp - WTP 的 Maven 集成”。在这种情况下,马塞洛的解决方案是不必要的。

The actual solution for me was to install the "m2e-wtp - Maven integration for WTP". The solution of Marcelo is not neccessary in that case.

舟遥客 2024-11-20 09:27:53

如果上面的方法不起作用,请从侦听器类中删除 .class,即

<listener>
<listener-class>

org.springframework.web.context.ContextLoaderListener.class

</listener-class>
</listener>

if nothing from above works, remove the .class from the listener class i.e.

<listener>
<listener-class>

org.springframework.web.context.ContextLoaderListener.class

</listener-class>
</listener>
红颜悴 2024-11-20 09:27:53

这对我有用..

右键单击 Maven Web 项目
单击“属性”菜单
在弹出窗口的左侧选择“部署程序集”
单击弹出窗口右侧的“添加...”按钮
现在又出现一个弹出窗口(New Assembly Directivies)
单击“Java 构建路径条目”
单击“下一步”按钮
单击“完成”按钮,现在自动关闭“新装配指令”弹出窗口
现在单击“应用”按钮和“确定”按钮
运行您的网络应用程序

This works for me ..

Right Click on maven web project
Click 'Properties'menu
Select 'Deployment Assembly' in left side of the popped window
Click 'Add...' Button in right side of the popped up window
Now appear one more popup window(New Assembly Directivies)
Click 'Java Build path entries'
Click 'Next' Button
Click 'Finish' Button, now atomatically close New Assemby Directivies popup window
Now click 'Apply' Button and Ok Button
Run your webapplication

初雪 2024-11-20 09:27:53

当我使用 Gradle 在 IntelliJ 项目中更改 Hibernate 映射后,就发生了这种情况。简单地重建该项目对我来说很有效。

This happened to me after I made changes to my Hibernate mapping in an IntelliJ project using Gradle. Simply rebuilding the project worked for me.

ゝ偶尔ゞ 2024-11-20 09:27:53

当我的构建路径中有该库,但部署程序集中没有该库时,我得到了这个。另外当我缺少 context.xml 时。

I got this when I had the lib in my build path, but not in my deployment assembly. Also when I had a missing context.xml.

厌味 2024-11-20 09:27:52

在 Eclipse 管理的 tomcat 中运行 Spring Web 应用程序时,我遇到了类似的问题。我通过在项目的 Web 部署程序集中添加 Maven 依赖项解决了这个问题。

  1. 打开项目的属性(例如,在项目资源管理器中右键单击项目名称并选择“属性”)。
  2. 选择“部署程序集”。
  3. 单击右侧边缘的“添加...”按钮。
  4. 从指令类型菜单中选择“Java Build Path Entries”,然后单击“下一步”。
  5. 从 Java 构建路径条目菜单中选择“Maven 依赖项”,然后单击“完成”。

您应该看到“Maven 依赖项”已添加到 Web 部署程序集定义中。

I had a similar problem when running a spring web application in an Eclipse managed tomcat. I solved this problem by adding maven dependencies in the project's web deployment assembly.

  1. Open the project's properties (e.g., right-click on the project's name in the project explorer and select "Properties").
  2. Select "Deployment Assembly".
  3. Click the "Add..." button on the right margin.
  4. Select "Java Build Path Entries" from the menu of Directive Type and click "Next".
  5. Select "Maven Dependencies" from the Java Build Path Entries menu and click "Finish".

You should see "Maven Dependencies" added to the Web Deployment Assembly definition.

不必在意 2024-11-20 09:27:52

当我使用 Eclipse WDT 时,同样的事情时常发生在我身上。当这种情况发生在一个未经修改且之前正在运行的项目上时,这尤其令人沮丧。这就是我在最后一个场景中修复它的方法:

  1. 停止 Tomcat(如果它正在运行)
  2. 打开“服务器”视图: Window > >显示视图>其他>服务器>服务器
  3. 右键单击​​ Tomcat 服务器 >清理 Tomcat 工作目录。
  4. 右键单击 Tomcat 服务器 >干净地
  5. 重新启动服务器

这通常可以解决您提到的问题。

Same thing happens to me from time to time when using Eclipse WDT. Its specialy frustrating when this happens to a unmodified and previously working project. This is what I do to fix it in this last scenario:

  1. Stop Tomcat (if it's running)
  2. Open the "Servers" view: Window > Show view > Other > Server > Servers
  3. Right Click on Tomcat Server > Clean Tomcat Work Directory.
  4. Right Click on Tomcat Server > Clean
  5. Restart the server

This usually fixes the issue you mention.

为人所爱 2024-11-20 09:27:52

我用的是IntelliJ IDEA,编译成功,但是启动Tomcat时,却提示:

Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

一开始,我以为JAR丢失了,但是它就位了。

解决方案:
文件>项目结构> Artifacts,在Output Layout右侧面板中双击Available Elements名为Maven:...的库,它将被移动到左侧窗格中的WEB-INF/lib

接受并重新启动 Tomcat。

I used IntelliJ IDEA, compilation is successful, but when starting Tomcat, it says:

Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

In the beginning, I thought the JAR was missing, but it was in place.

Solution:
File > Project Structure > Artifacts, in the Output Layout double click in right panel Available Elements the library named like Maven:..., it will be moved to WEB-INF/lib in the left pane.

Accept and restart Tomcat.

陌路终见情 2024-11-20 09:27:52

您可以尝试“清理 Tomcat 工作目录”或简单地“清理..”。这应该丢弃所有已发布的状态并从头开始重新发布。

You could try "Clean Tomcat Work Directory" or simply "Clean..". This supposed to discard all published state and republish from scratch.

梦回旧景 2024-11-20 09:27:52

这肯定是 Eclipse 相关的问题。
对我有用的是在 eclipse 服务器选项卡中创建一个新服务器。
然后在这个新服务器上运行您的应用程序,它应该可以工作。

This is surely Eclipse related issue.
The thing which worked for me is creating a new server in eclipse server tab.
Then run your application in this new server, it should work.

谈场末日恋爱 2024-11-20 09:27:52

对于为 Tomcat 7 运行时配置的 eclipse 项目,我遇到了同样的问题

右键单击项目并转到项目属性。
单击“部署程序集”。我注意到我在编译时使用用户库创建的 spring 库 jar 丢失了。
只需添加 jar 即可,在 tomcat 启动期间您应该在控制台中看到没有错误

I was facing the same issue for a eclipse project configured for Tomcat 7 runtime

Right click on project and go to project properties.
Click on Deployment Assembly. I could notice that my spring library jars which I created during compile time with a user library was missing.
Just add the jars and you should see no errors in console during tomcat start up

坏尐絯 2024-11-20 09:27:52

您必须至少使用 spring-core 版本 3.2.8.RELEASE

对于 Maven,请在 pom.xml 中设置:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.2.8.RELEASE</version>
</dependency>

来源:http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/cglib/core/SpringNamingPolicy.html,因为3.2.8.

You have to use at least version 3.2.8.RELEASE of spring-core.

For Maven, set in your pom.xml:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.2.8.RELEASE</version>
</dependency>

Source: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/cglib/core/SpringNamingPolicy.html, since 3.2.8.

悲喜皆因你 2024-11-20 09:27:52

如果上述所有方法都不起作用,请尝试以下操作。这对我有用。

从服务器中删除您的项目>重新启动服务器>将您的项目添加到服务器>重新启动服务器。

详细说明:

1. Right click on server > Add and Remove
2. Select your project > Remove > Finish
3. Restart your server
4. Right click on server > Add and Remove
5. Select your project > Add > Finish
6. Restart your server again.

If everything mentioned above does not work try the following. It worked for me.

Remove your project from the server > Restart server > Add your project to server > Restart server.

Detailed Instruction:

1. Right click on server > Add and Remove
2. Select your project > Remove > Finish
3. Restart your server
4. Right click on server > Add and Remove
5. Select your project > Add > Finish
6. Restart your server again.
放肆 2024-11-20 09:27:52

如果您正在使用 Maven,则项目可能尚未构建。首先执行 mvn clean package 然后再次尝试重新部署。

If you're using maven, perhaps the project aint built yet. First do a mvn clean package then try redeploying again.

陌上芳菲 2024-11-20 09:27:52

Eclipse Luna 的解决方案:

  1. 右键单击​​ maven web 项目
  2. 单击“属性”菜单
  3. 在弹出窗口左侧选择“部署程序集”
  4. 单击弹出窗口右侧的“添加...”按钮
  5. 现在又出现一个弹出窗口(新程序集指令)
  6. 单击“Java 构建路径条目”
  7. 单击“下一步”按钮
  8. 单击“完成”按钮,现在自动关闭“新程序集指令”弹出窗口
  9. 现在单击“应用”按钮和“确定”按钮
  10. 运行您的 Web 应用程序

Solution for Eclipse Luna:

  1. Right Click on maven web project
  2. Click 'Properties'menu
  3. Select 'Deployment Assembly' in left side of the popped window
  4. Click 'Add...' Button in right side of the popped up window
  5. Now appear one more popup window(New Assembly Directivies)
  6. Click 'Java Build path entries'
  7. Click 'Next' Button
  8. Click 'Finish' Button, now atomatically close New Assemby Directivies popup window
  9. Now click 'Apply' Button and Ok Button
  10. Run your webapplication
时光瘦了 2024-11-20 09:27:52

如果您使用 IntelliJ IDEA,并在 Tomcat 服务器上部署应用程序,它会显示:
在“文件”菜单下

  1. ->
  2. 选择项目结构->
  3. 单击artifact,然后单击Output Layout->
  4. 在右侧选择您的 jar,双击它
  5. 现在它位于左侧窗格中的 WEB\lib ->
  6. 重新启动服务器

在此输入图像描述

If you are using IntelliJ IDEA, and deploy application on Tomcat Server, it says:
Under

  1. File menu ->
  2. Select project Structure ->
  3. Click artifact then Output Layout->
  4. Select your jars on the right, double click it
  5. Now its in the left pane in WEB\lib ->
  6. Restart server

enter image description here

不必你懂 2024-11-20 09:27:52

其实这是Tomcat的问题。
只需转到项目的“lib”文件夹并将所有“Spring”相关的 jar 复制到此文件夹中。刷新您的项目,就可以开始了。
这个问题有时会持续存在,因为 tomcat 无法找到 Spring 核心类。

Actually this is a problem of Tomcat.
Just go to 'lib' folder of your project and copy your all 'Spring' related jars into this. Refresh your project and you are all good to go.
This problem sometime persists because tomcat is unable to locate Spring core classes.

握住你手 2024-11-20 09:27:52

对我来说,修复方法是右键单击我的 webapp 模块 >梅文>更新项目

For me the fix was to right click on my webapp module > Maven > Update Project

难得心□动 2024-11-20 09:27:52

我也有同样的错误。我没有在我的 POM 文件中添加以下依赖项。

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>4.1.7.RELEASE</version>
  </dependency>

但我的项目甚至在我添加此依赖项之前就已经运行了。但在某一时刻它停止并开始给出与上述相同的错误。

如果有人无法解决此错误,他们也可以通过此解决 链接

I also had the same error. I had not added the below dependency in my POM file.

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>4.1.7.RELEASE</version>
  </dependency>

But My porject used to run even before I had added this dependency. But at one point it stopped and started giving the same above error.

If any one couldn't solve this error they can also solve by this link

小帐篷 2024-11-20 09:27:52

我有同样的问题。我通过在 pom.xml 中添加 spring-web 依赖 解决了这个问题。
确保您使用的 spring-web jar 具有 ContextLoaderListener 类扩展 ContextLoader 实现 ServletContextListener 并驻留在包 org.springframework.web.context 中。我用的是3.0.4.RELEASE

I had the same issue. I resolved it by adding spring-web dependency in my pom.
Make sure you use spring-web jar which has ContextLoaderListener class extends ContextLoader implements ServletContextListener and reside in the package org.springframework.web.context. I used 3.0.4.RELEASE

流殇 2024-11-20 09:27:52

我尝试了

  • 项目 clean mvn
  • clean
  • clean tomcat 工作目录 自动
  • 更新依赖项

至少暂时有效的唯一方法是将 Maven 依赖项添加到 Web 部署程序集定义

但这不会永远有效!几天后它就停止工作了。我的解决方案是删除 Maven 依赖项,应用更改并再次添加 Maven 依赖项。

我正在使用
- 日食朱诺
- 嵌入式maven
- 雄猫7

I tried the

  • project clean mvn
  • clean
  • clean tomcat work directory Automatically
  • update dependencies

The only thing that worked at least temporarily was to add Maven Dependencies to Web Deployment Assembly definition

But this does not work for ever! After a couple of days it stops working. My solution was to remove Maven Dependencies, apply change and add Maven Dependencies again.

I'm using
- eclipse Juno
- embedded maven
- tomcat 7

时光暖心i 2024-11-20 09:27:52

对于 gradle 用户,它适用于以下步骤

中的 Servers 选项卡停止并删除 tomcat 服务器

1) 从 eclipse eclipse tomcat tab

2) 从 tomcat 安装中清理 webapp 和工作目录 ,(参考,操作方法:清除 Tomcat 的缓存并修复过时的 JSP 问题)

$ rm -r /usr/local/AT7028/work/*
$ rm -r /usr/local/AT7028/webapps/WAR_NAME

3) 使用构建工具清理和 eclipsify 项目

$ ./gradlew clean eclipse //为mvn用户触发相应的命令,$ mvn clean package

4)在eclipse中配置一个新的Tomcat服务器,并且再次运行该项目。

For gradle users, It works with following steps

1) Stop and Delete tomcat server from Servers Tab in eclipse

eclipse tomcat tab

2) clean webapp and work directory from tomcat installation , (Reference, How-To: Clear out Tomcat’s cache and fix outdated JSP problems)

$ rm -r /usr/local/AT7028/work/*
$ rm -r /usr/local/AT7028/webapps/WAR_NAME

3) clean and eclipsify project using build tool

$ ./gradlew clean eclipse //fire respective command for mvn users, $ mvn clean package

4) configure a new Tomcat server in eclipse, and run the project again.

为你拒绝所有暧昧 2024-11-20 09:27:52

我也遇到了同样的问题....并通过以下步骤解决:

RC(右键单击网络项目)-->属性-->部署组装 -->添加--> Java 构建路径条目 -->下一步-->选择缺少的 jar 文件 -->下一个-->完成

应用程序正在成功运行...

i too faced the same problem.... and resolved by following the below steps:

RC(right click on web project) --> properties --> Deployment Assembly --> Add --> Java Build Path Entries --> Next --> select jar files which are missing --> next --> finish

Application is running successfully...

匿名。 2024-11-20 09:27:52

我有同样的问题,我已经使用上面提到的步骤解决了它。但是当我再次遇到这个问题时,我尝试以下操作,

RC(右键单击网络项目)-->属性-->部署组装 -->添加--> Java 构建路径条目 -->下一步-->

单击下一步后,它只是一个空白窗口,并且禁用了“下一步”和“完成”选项。现在我能做什么?

I have the same issue , and I have resolved it using the steps mentioned above.but no when I have this issue again and i try the following,

RC(right click on web project) --> properties --> Deployment Assembly --> Add --> Java Build Path Entries --> Next -->

after clicking on next its only a blank window with the options Next and Fnish disabled.What can I do now?

赏烟花じ飞满天 2024-11-20 09:27:52

我遇到了同样的问题。

只需从配置中删除服务器,并在重新启动 Eclipse 后通过将其添加到服务器运行时环境中将其重新添加回来。

I faced the same problem.

Just removed the server from configuration and added it back after restarting eclipse by adding it to the server runtime environment.

一杯敬自由 2024-11-20 09:27:52

我最喜欢的一种最适合这种情况的快速解决方案是简单地删除工作空间的 .metadata 文件夹并再次导入您的项目。如果您尝试所有其他选项,则不能保证成功。有时上述解决方案有效,有时您会花费宝贵的时间来修复此配置。

有一天,我决定清理我的工作站。我根据不同的客户将项目安排到合适的文件夹中。结果一切都乱了。花了一整天的时间,最终还是没有到固定的工作空间。第二天我只是删除了工作空间的.metadata文件夹并再次导入了所有项目。宾果游戏一切就绪。

One quick solution I prefer which I suited most for this situation is simply delete .metadata folder of your work space and import your projects again. If you try all other option it wont guarantee the success. Sometimes the above solutions work sometime you will spend your precious hours to fix this configuration.

One day i decided to clean my work station.I arranged the projects to their suitable folders according to different clients. As a result all got messed up. After spending a whole day it did not end up in a fixed work space. Next day I simply deleted the .metadata folder of the work space and imported all the projects again. Bingo all set.

画骨成沙 2024-11-20 09:27:52

如果您使用 Maven,请将 war 放入 pom.xml 中。
在这种情况下,也许是用jar打包的

你必须在Deployment Assembly中有Maven libs

Put <packaging>war</packaging> in your pom.xml if you are using Maven.
In that case, maybe it is with jar packaging

You must have Maven libs in Deployment Assembly

荒芜了季节 2024-11-20 09:27:52

我每个季度都会遇到几次这样的情况。这次我在 git diff 中有一个最小的更改摘要,并在 eclipse 中将问题跟踪到重置类路径(缺少我的 WEB-INF/lib 依赖项)。每当我拉入或拉出父级/同级 Maven 项目时,似乎都会发生这种情况。

有人提到将 spring jar 添加到 tomcat Web 容器库 - 这没问题,并且是大多数 EE 服务器运行的方式。但是请注意,通过将 spring 放置在 tomcat 上的类加载器树中更高的位置,您将运行在高于 war 上下文的类加载器级别的位置。我建议您将库保留在 per/war 较低级别的类加载器中。

在 eclipse 中进行结构项目更改后,我们会在 .classpath 被截断后看到以下内容。

Dec 18, 2016 11:13:39 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener

我的类路径已重置,WEB-INF/lib 依赖项已删除。

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>
</classpathentry>

放回去

<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>

,你就会没事的。

谢谢
/迈克尔

I ran into this a couple times a quarter. This time I had a minimal change summary in my git diff and tracked the problem to a reset classpath (missing my WEB-INF/lib dependency) in eclipse. This seems to occur any time I pull in or pull out parent/sibling maven projects.

There are mentions of adding your spring jars to the tomcat web container lib - this is ok and is the way most EE servers run. However be aware that by placing spring higher in the classloader tree on tomcat you will be running higher than the classloader level of your war context. I recommend you leave the libs in a per/war lower level classloader.

We see the following after a truncated .classpath after a structural project change in eclipse.

Dec 18, 2016 11:13:39 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener

My classpath was reset and the WEB-INF/lib dependency was removed.

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>
</classpathentry>

put back

<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>

and you will be OK.

thank you
/michael

硬不硬你别怂 2024-11-20 09:27:52

使用“更新项目配置”搞乱了项目的构建路径。

修复:打开“配置构建路径...”菜单(右键单击项目)并修复每个源文件夹的“包含/排除”选项。
这对我有用。

Using the "Update project configuartion" messed up the build path of the project.

Fix: Open the "configure build path..." menu (right click on the project) and fix the Included/Excluded options for each source folder.
That worked for me.

缱倦旧时光 2024-11-20 09:27:52

很多情况下是java方面的问题,jdk或jre或jsp版本与maven项目方面不同。

In many case It is java facet problem ,jdk or jre or jsp version is difference than maven project face.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文