博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java.lang.ClassNotFoundException: org.apache.strut
阅读量:6072 次
发布时间:2019-06-20

本文共 2752 字,大约阅读时间需要 9 分钟。

  hot3.png

This is a common error message for a new Struts2 developer. Many Struts 2 related websites have been reported this problem. Overall, when we see a ClassNotFoundException, we should have a reflection that it is very possible that the build path is wrong somewhere.

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcherat org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)at org.apache.catalina.core.StandardService.start(StandardService.java:525)at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)at org.apache.catalina.startup.Catalina.start(Catalina.java:595)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

The problem is caused by the class path.

After you create a dynamic web project under eclipse, you should have the following directory underProject Explorer view.

You may Add External Jars under Java Build Path window like the following:

 

This works for regular Java project, but does not work for Struts2 web project.

The solution is to simply copy the jar files required to the "lib" directory, then the error message will be gone. 

(remove all jars from the class path if you added them before)

Note: Actually, when the error message is something about ClassNotFoundException, we should think in the direction of build path is not correct. Also, different kinds of Java project may use different way to configure build path, e.g., an eclipse plug-in project have to use plug-in to add some library to it.

转载于:https://my.oschina.net/i33/blog/371671

你可能感兴趣的文章
hadoop datanode 启动出错
查看>>
js颜色拾取器
查看>>
IDEA使用(1)intellIJ idea 配置 svn
查看>>
Thread Safety in Java(java中的线程安全)
查看>>
WPF 降低.net framework到4.0
查看>>
数据管理DMS 全量SQL诊断:你的SQL是健康的蓝色,还是危险的红色?
查看>>
搭建一个通用的脚手架
查看>>
开年巨制!千人千面回放技术让你“看到”Flutter用户侧问题
查看>>
开源磁盘加密软件VeraCrypt教程
查看>>
本地vs云:大数据厮杀的最终幸存者会是谁?
查看>>
阿里云公共镜像、自定义镜像、共享镜像和镜像市场的区别 ...
查看>>
shadowtunnel v1.7 发布:新增上级负载均衡支持独立密码
查看>>
Java线程:什么是线程
查看>>
mysql5.7 创建一个超级管理员
查看>>
【框架整合】Maven-SpringMVC3.X+Spring3.X+MyBatis3-日志、JSON解析、表关联查询等均已配置好...
查看>>
要想成为高级Java程序员需要具备哪些知识呢?
查看>>
带着问题去学习--Nginx配置解析(一)
查看>>
onix-文件系统
查看>>
java.io.Serializable浅析
查看>>
我的友情链接
查看>>